jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Jetty
  • JETTY-1486

Dependency jar files are no longer scanned for .tld files with jetty-maven-plugin

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 7.5.4, 7.6.0
  • Fix Version/s: 7.6.2
  • Component/s: Maven
  • Labels:
    None
  • Testcase included:
    yes

Description

Checking some archetypes for MyFaces Core project I notice the latest version of jetty does not work.

MyFaces has a listener entry in a .tld file, and that is not loaded or scanned anymore

I'll attach a example webapp for this one. Just type mvn clean -PjettyConfig jetty:run. With jetty 7.4.5.v20110725 works but if you change maven.jetty.plugin.version property inside the pom to 7.6.0.v20120127 it does not, throwing a ClassNotFoundException. Later, I added myfaces jars as dependencies for the plugin but the tlds are not scanned, so myfaces listener is not loaded and another exception occur (Factory not loaded). Later if I add:

<listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

Into web.xml the app works, but contextPath is not added.

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. Hide
    Zip Archive
    myfaces-helloworld20.zip
    08/Feb/12 7:49 PM
    11 kB
    Leonardo Uribe
    1. XML File
      myfaces-helloworld20/pom.xml 6 kB
    2. Java Source File
      myfaces-helloworld20/.../HelloWorldController.java 2 kB
    3. File
      myfaces-helloworld20/.../helloWorld.xhtml 2 kB
    4. HTML File
      myfaces-helloworld20/src/.../index.html 0.9 kB
    5. File
      myfaces-helloworld20/src/.../page2.xhtml 1 kB
    6. File
      myfaces-helloworld20/src/.../css/style.css 1 kB
    7. XML File
      myfaces-helloworld20/.../faces-config.xml 1 kB
    8. XML File
      myfaces-helloworld20/src/.../WEB-INF/web.xml 6 kB
    Download Zip
    Show
    Zip Archive
    myfaces-helloworld20.zip
    08/Feb/12 7:49 PM
    11 kB
    Leonardo Uribe

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Jan Bartel added a comment - 08/Feb/12 8:17 PM

Leonard,

The changes to the version of jsp that we use in jetty 7 require that you make a couple of changes if you want to use jsf. Its documented here:
http://wiki.eclipse.org/Jetty/Howto/Configure_JSP

Let me know if things are working after you define the context attribute as described above.

Jan

Show
Jan Bartel added a comment - 08/Feb/12 8:17 PM Leonard, The changes to the version of jsp that we use in jetty 7 require that you make a couple of changes if you want to use jsf. Its documented here: http://wiki.eclipse.org/Jetty/Howto/Configure_JSP Let me know if things are working after you define the context attribute as described above. Jan
Hide
Permalink
Leonardo Uribe added a comment - 28/Feb/12 12:57 PM

Hi

I tried this with jetty 7.6.1.v20120215 as described in the wiki:

<profile>
<!-- Plugin embedded jetty 7 container.
Just running use:
mvn clean -Dcontainer=jetty7 jetty:run
-->
<!-- For debugging use (attach debugger port 8000):
mvnDebug clean -Dcontainer=jetty7 jetty:run
-->
<id>jetty7Config</id>
<activation>
<property>
<name>container</name>
<value>jetty7</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<!--This plugin allows to run the war using mvn jetty:run -->
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>7.6.1.v20120215</version>
<configuration>
<systemProperties>
<systemProperty>
<!-- use the ecj compiler -->
<name>org.apache.jasper.compiler.disablejsr199</name>
<value>true</value>
</systemProperty>
</systemProperties>
<contextXml>${basedir}/src/conf/jetty/context.xml</contextXml>
<webApp>
<contextPath>/${artifactId}</contextPath>
</webApp>
<scanIntervalSeconds>5</scanIntervalSeconds>
</configuration>
<dependencies>
<!-- Tld scanning only works when JSF is included
as container 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>runtime</scope>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>

src/conf/jetty/context.xml

<Configure class="org.eclipse.jetty.webapp.WebAppContext">

<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/.*myfaces-impl-[^/]\.jar$|./.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg>
</Call>

</Configure>

Throws no factories configured for application (happens because the listener on myfaces tld does not load correctly).

But I tried this using jetty 8.1.1.v20120215:

<profile>
<!-- Plugin embedded jetty 8 container.
Just running use:
mvn clean jetty:run or mvn clean jetty:run
-->
<!-- For debugging use (attach debugger port 8000):
mvnDebug clean jetty:run or mvn clean jetty:run
-->
<id>jettyConfig</id>
<activation>
<property>
<name>!container</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<!--This plugin allows to run the war using mvn jetty:run -->
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.maven.plugin.version}</version>
<configuration>
<systemProperties>
<systemProperty>
<!-- optional to use the ecj compiler -->
<name>org.apache.jasper.compiler.disablejsr199</name>
<value>true</value>
</systemProperty>
</systemProperties>
<webApp>
<contextPath>/${artifactId}</contextPath>
</webApp>
<scanIntervalSeconds>5</scanIntervalSeconds>
</configuration>
<dependencies>
<!-- Tld scanning only works when JSF is included
as container 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>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>

It works.

Why it does not work with jetty-maven-plugin 7? no idea. In jetty 8 it works because MyFaces has a ServletInitializer that do what's necessary according to Servlet spec 3. Jetty 8 is enough for me. Thanks for your help. I'll keep an eye on this one if someday is fixed.

Show
Leonardo Uribe added a comment - 28/Feb/12 12:57 PM Hi I tried this with jetty 7.6.1.v20120215 as described in the wiki: <profile> <!-- Plugin embedded jetty 7 container. Just running use: mvn clean -Dcontainer=jetty7 jetty:run --> <!-- For debugging use (attach debugger port 8000): mvnDebug clean -Dcontainer=jetty7 jetty:run --> <id>jetty7Config</id> <activation> <property> <name>container</name> <value>jetty7</value> </property> </activation> <build> <plugins> <plugin> <!--This plugin allows to run the war using mvn jetty:run --> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>7.6.1.v20120215</version> <configuration> <systemProperties> <systemProperty> <!-- use the ecj compiler --> <name>org.apache.jasper.compiler.disablejsr199</name> <value>true</value> </systemProperty> </systemProperties> <contextXml>${basedir}/src/conf/jetty/context.xml</contextXml> <webApp> <contextPath>/${artifactId}</contextPath> </webApp> <scanIntervalSeconds>5</scanIntervalSeconds> </configuration> <dependencies> <!-- Tld scanning only works when JSF is included as container 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>runtime</scope> </dependency> <dependency> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> <version>2.2.1</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.glassfish.web</groupId> <artifactId>javax.el</artifactId> <version>2.2.1</version> <scope>provided</scope> </dependency> </dependencies> </plugin> </plugins> </build> </profile> src/conf/jetty/context.xml <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <Call name="setAttribute"> <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg> <Arg>.*/.*myfaces-impl-[^/]\.jar$|./.*jsp-api-[^/]\.jar$|./.*jsp-[^/]\.jar$|./.*taglibs[^/]*\.jar$</Arg> </Call> </Configure> Throws no factories configured for application (happens because the listener on myfaces tld does not load correctly). But I tried this using jetty 8.1.1.v20120215: <profile> <!-- Plugin embedded jetty 8 container. Just running use: mvn clean jetty:run or mvn clean jetty:run --> <!-- For debugging use (attach debugger port 8000): mvnDebug clean jetty:run or mvn clean jetty:run --> <id>jettyConfig</id> <activation> <property> <name>!container</name> </property> </activation> <build> <plugins> <plugin> <!--This plugin allows to run the war using mvn jetty:run --> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>${jetty.maven.plugin.version}</version> <configuration> <systemProperties> <systemProperty> <!-- optional to use the ecj compiler --> <name>org.apache.jasper.compiler.disablejsr199</name> <value>true</value> </systemProperty> </systemProperties> <webApp> <contextPath>/${artifactId}</contextPath> </webApp> <scanIntervalSeconds>5</scanIntervalSeconds> </configuration> <dependencies> <!-- Tld scanning only works when JSF is included as container 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>runtime</scope> </dependency> </dependencies> </plugin> </plugins> </build> </profile> It works. Why it does not work with jetty-maven-plugin 7? no idea. In jetty 8 it works because MyFaces has a ServletInitializer that do what's necessary according to Servlet spec 3. Jetty 8 is enough for me. Thanks for your help. I'll keep an eye on this one if someday is fixed.
Hide
Permalink
Jan Bartel added a comment - 29/Feb/12 12:08 AM

Hi Leonard,

Yes, you're right, 7.6.x does not work! That was my fault, I was overwriting the attribute org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern in the startup of the plugin (attempting to make sure that all the jars that we distribute with jetty that have tlds get scanned - unfortunately I forgot about jsf!).

So now I have added in a pattern for the common jsf impls: myfaces and the jsf from sun, so from jetty-7.6.2 onwards you won't have to set any attributes or anything. Just ensure that the jsf jars are on the plugin classpath, not the webapp's classpath.

If you have other jars that need to be scanned, then you'll need to specify their pattern in a context xml file, but these will now be additive to the patterns defined inside the plugin startup. In other words, if you have a new dependency jar foo-123.jar that contains tlds that you want scanned, then you would put the following in your context xml file:

<Call name="setAttribute">
<Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
<Arg>.*/.*foo-[^/]*\.jar$</Arg>
</Call>

The plugin implementation will take care of adding in all the other standard patterns.

cheers
Jan

Show
Jan Bartel added a comment - 29/Feb/12 12:08 AM Hi Leonard, Yes, you're right, 7.6.x does not work! That was my fault, I was overwriting the attribute org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern in the startup of the plugin (attempting to make sure that all the jars that we distribute with jetty that have tlds get scanned - unfortunately I forgot about jsf!). So now I have added in a pattern for the common jsf impls: myfaces and the jsf from sun, so from jetty-7.6.2 onwards you won't have to set any attributes or anything. Just ensure that the jsf jars are on the plugin classpath, not the webapp's classpath. If you have other jars that need to be scanned, then you'll need to specify their pattern in a context xml file, but these will now be additive to the patterns defined inside the plugin startup. In other words, if you have a new dependency jar foo-123.jar that contains tlds that you want scanned, then you would put the following in your context xml file: <Call name="setAttribute"> <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg> <Arg>.*/.*foo-[^/]*\.jar$</Arg> </Call> The plugin implementation will take care of adding in all the other standard patterns. cheers Jan
Hide
Permalink
Jan Bartel added a comment - 29/Feb/12 12:59 AM

I also updated the wiki page here: http://wiki.eclipse.org/Jetty/Howto/Configure_JSP#Jetty_Maven_Plugin

Show
Jan Bartel added a comment - 29/Feb/12 12:59 AM I also updated the wiki page here: http://wiki.eclipse.org/Jetty/Howto/Configure_JSP#Jetty_Maven_Plugin

People

  • Assignee:
    Jan Bartel
    Reporter:
    Leonardo Uribe
Vote (0)
Watch (0)

Dates

  • Created:
    08/Feb/12 7:49 PM
    Updated:
    29/Feb/12 12:59 AM
    Resolved:
    29/Feb/12 12:08 AM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.