0

I have a lot of trouble getting tomahawk to run. I used the myfaces hellworld20 archetype a while ago to create a new project. Now I wanted to extend it using tomahawk. The new pom.xml looks like this:

<properties>
    <jsf-myfaces.version>2.1.8</jsf-myfaces.version>
</properties>
<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
            </plugin>
        </plugins>
    </pluginManagement>
    <!-- To use the plugin goals in your POM or parent POM -->
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<!-- Project dependencies -->
<dependencies>
    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>commons</artifactId>
        <version>${project.version}</version>
    </dependency>

    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>configuration</artifactId>
        <version>${project.version}</version>
    </dependency>

    <dependency>
        <groupId>${project.groupId}</groupId>
        <artifactId>application</artifactId>
        <version>${project.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-servlet_2.5_spec</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-el_2.2_spec</artifactId>
        <version>1.0.2</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-annotation_1.0_spec</artifactId>
        <version>1.1.1</version>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-api</artifactId>
        <version>${jsf-myfaces.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.myfaces.core</groupId>
        <artifactId>myfaces-impl</artifactId>
        <version>${jsf-myfaces.version}</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        <scope>runtime</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.myfaces.tomahawk</groupId>
        <artifactId>tomahawk20</artifactId>
        <version>1.1.13</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>org.apache.myfaces.tomahawk</groupId>
        <artifactId>tomahawk-sandbox</artifactId>
        <version>1.1.6</version>
        <scope>compile</scope>
    </dependency>

    <dependency>
        <groupId>com.google.code.tomahawk</groupId>
        <artifactId>tomahawk-facelets</artifactId>
        <version>1.1.6.3</version>
        <exclusions>
            <exclusion>
                <groupId>com.sun.facelets</groupId>
                <artifactId>jsf-facelets</artifactId>
            </exclusion>
            <exclusion>
                <groupId>javax.servlet</groupId>
                <artifactId>jstl</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.myfaces.tomahawk</groupId>
                <artifactId>tomahawk</artifactId>
            </exclusion>
            <exclusion>
                <groupId>org.apache.myfaces.tomahawk</groupId>
                <artifactId>tomahawk-sandbox</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>com.sun.facelets</groupId>
        <artifactId>jsf-facelets</artifactId>
        <version>1.1.13</version>
    </dependency>

</dependencies>

<profiles>
    <profile>
        <id>bundle-myfaces</id>
        <activation>
            <property>
                <name>jsf</name>
                <value>myfaces</value>
            </property>
        </activation>
        <!-- Include MyFaces jars into the war -->
        <dependencies>
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-api</artifactId>
                <version>${jsf-myfaces.version}</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-impl</artifactId>
                <version>${jsf-myfaces.version}</version>
                <scope>runtime</scope>
            </dependency>
        </dependencies>
    </profile>

    <profile>
        <id>maven-tomcat7</id>
        <activation>
            <property>
                <name>container</name>
                <value>tomcat7</value>
            </property>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.tomcat.maven</groupId>
                    <artifactId>tomcat7-maven-plugin</artifactId>
                    <version>2.0</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>aspectj-maven-plugin</artifactId>
                    <version>1.3</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>compile</goal><!-- to weave all your main classes -->
                                <goal>test-compile</goal><!-- to weave all your test classes -->
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <aspectLibraries>
                            <aspectLibrary>
                                <groupId>${project.groupId}</groupId>
                                <artifactId>configuration</artifactId>
                            </aspectLibrary>
                        </aspectLibraries>
                        <sources>
                            <source>
                                <basedir>src/main/java</basedir>
                                <includes>
                                    <include>**/*.aj</include>
                                </includes>
                            </source>
                        </sources>
                        <source>1.5</source>
                        <target>1.5</target>
                        <encoding>utf-8</encoding>
                        <complianceLevel>1.5</complianceLevel>
                        <verbose>true</verbose>
                        <showWeaveInfo>true</showWeaveInfo>
                    </configuration>
                </plugin>
            </plugins>

            <pluginManagement>
                <plugins>
                    <!--This plugin's configuration is used to store Eclipse m2e settings 
                        only. It has no influence on the Maven build itself. -->
                    <plugin>
                        <groupId>org.eclipse.m2e</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>1.0.0</version>
                        <configuration>
                            <lifecycleMappingMetadata>
                                <pluginExecutions>
                                    <pluginExecution>
                                        <pluginExecutionFilter>
                                            <groupId>org.codehaus.mojo</groupId>
                                            <artifactId>
                                                aspectj-maven-plugin
                                            </artifactId>
                                            <versionRange>
                                                [1.3,)
                                            </versionRange>
                                            <goals>
                                                <goal>compile</goal>
                                                <goal>test-compile</goal>
                                            </goals>
                                        </pluginExecutionFilter>
                                        <action>
                                            <ignore></ignore>
                                        </action>
                                    </pluginExecution>
                                </pluginExecutions>
                            </lifecycleMappingMetadata>
                        </configuration>
                    </plugin>
                </plugins>
            </pluginManagement>
        </build>
        <dependencies>
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-api</artifactId>
                <version>${jsf-myfaces.version}</version>
                <scope>compile</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.myfaces.core</groupId>
                <artifactId>myfaces-impl</artifactId>
                <version>${jsf-myfaces.version}</version>
                <scope>runtime</scope>
            </dependency>
        </dependencies>
    </profile>

</profiles>
<repositories>
    <repository>
        <releases>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
            <checksumPolicy>warn</checksumPolicy>
        </releases>
        <snapshots>
            <enabled>false</enabled>
            <updatePolicy>never</updatePolicy>
            <checksumPolicy>fail</checksumPolicy>
        </snapshots>
        <id>Tomahawk-Facelets</id>
        <name>Tomahawk-Facelets releases</name>
        <url>http://tomahawk-facelets.googlecode.com/svn/maven2/repository</url>
        <layout>default</layout>
    </repository>
</repositories>

As soon as I comment all tomahawk related dependencies out, the server deploys properly though it seems that the tomhawk related tags don't work.

If I do not comment it out I get an error message like this:

Jul 03, 2012 3:07:00 AM org.apache.catalina.startup.Embedded start
Information: Starting tomcat server
Jul 03, 2012 3:07:00 AM org.apache.catalina.core.StandardEngine start
Information: Starting Servlet Engine: Apache Tomcat/6.0.29
Jul 03, 2012 3:07:01 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getStandardFacesConfig
Information: Reading standard config META-INF/standard-faces-config.xml
Jul 03, 2012 3:07:01 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getWebAppFacesConfig
Information: Reading config /WEB-INF/faces-config.xml
Jul 03, 2012 3:07:02 AM org.apache.myfaces.config.DefaultFacesConfigurationProvider getClassloaderFacesConfig
Information: Reading config : jar:file:/E:/Users/Andreas/Dropbox/Studium/4.Semester/Software-Projekt/Marx1/trunk/deliverable3/parent/webui/target/webui-0.0.1/WEB-INF/lib/jsf-facelets-1.1.13.jar!/META-INF/faces-config.xml
Jul 03, 2012 3:07:02 AM org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
Schwerwiegend: An error occured while initializing MyFaces: java.lang.NullPointerException
javax.faces.FacesException: java.lang.NullPointerException
    at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getClassloaderFacesConfig(DefaultFacesConfigurationProvider.java:279)
    at org.apache.myfaces.config.DefaultFacesConfigurationMerger.getFacesConfigData(DefaultFacesConfigurationMerger.java:101)
    at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:416)
    at org.apache.myfaces.webapp.AbstractFacesInitializer.buildConfiguration(AbstractFacesInitializer.java:338)
    at org.apache.myfaces.webapp.Jsp21FacesInitializer.initContainerIntegration(Jsp21FacesInitializer.java:73)
    at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:140)
    at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:119)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
    at org.apache.catalina.startup.Embedded.start(Embedded.java:825)
    at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMojo.java:558)
    at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java:255)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:107)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:534)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: java.lang.NullPointerException
    at com.bluecast.xml.Piccolo.addAttributeDefinition(Piccolo.java:1167)
    at com.bluecast.xml.Piccolo.yyparse(Piccolo.java:1699)
    at com.bluecast.xml.Piccolo.parse(Piccolo.java:702)
    at org.apache.commons.digester.Digester.parse(Digester.java:1745)
    at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.getFacesConfig(DigesterFacesConfigUnmarshallerImpl.java:309)
    at org.apache.myfaces.config.impl.digester.DigesterFacesConfigUnmarshallerImpl.getFacesConfig(DigesterFacesConfigUnmarshallerImpl.java:36)
    at org.apache.myfaces.config.DefaultFacesConfigurationProvider.getClassloaderFacesConfig(DefaultFacesConfigurationProvider.java:265)
    ... 36 more
Jul 03, 2012 3:07:02 AM org.apache.catalina.core.ApplicationContext log
Schwerwiegend: StandardWrapper.Throwable
java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

I have been searching for hours now visiting tons of pages related to the tags tomhawk, maven, facelets. But I don't seem to find a solution which is why I ask here. Maybe it is trivial and probably even obvious but I can't find the answer to why this is not working.

saenridanra
  • 45
  • 1
  • 11
  • So I have played around for quite a lot more hours... I have tried using tomahawk-sandbox12 as the maven dependency and it works, the only thing now is that it doesn't render the tags. – saenridanra Jul 04 '12 at 12:36

1 Answers1

0

I don't think that could work. You can't use tomahawk-sandbox 1.1.6 with tomahawk20 1.1.13, because tomahawk-sandbox is only for JSF 1.1/1.2. Also, you don't need com.sun.facelets, because the JSF implementation, in this case JSF 2.0/2.1 implementation (in this case MyFaces Core) has facelets already inside its jars. Don't use com.google.code.tomahawk, facelets support was added to tomahawk long time ago. Try first add only tomahawk20 1.1.13, which is just add it as dependency and then you can try add sandbox, but note sandbox is never released, so you need to build it manually from source code or take it from snapshot repo.

lu4242
  • 2,318
  • 1
  • 15
  • 15
  • Thank you for your answer, but I have given up. Maybe the solution you're offering is going to work, that's for someone else to decide. I switched to primefaces and I am very glad that I did that. It works perfectly fine with myfaces and the results are really good. Still thank you! – saenridanra Jul 06 '12 at 13:27