8 Replies Latest reply: Apr 23, 2012 1:12 PM by Dahn Maier RSS

Issues with servlet loading in JBoss7

Dahn Maier Newbie

Hi everyone,

 

I have recently migrated a JavaSE application (.war) to JBoss7. After spending the customary time to understand the new structure and configurations I have finally managed to run the app (including connect to the database). However there are several servlets that do not work and the only indication I have to the problem is a warning message in web.xml such as:

 

DescriptionResourcePathLocationType
servlet-class references to org.jboss.seam.servlet.SeamResourceServlet that does not implement interface javax.servlet.Servletweb.xml/MyApp/WebContent/WEB-INFline 57Web XML Problem

 

For sure this class implements the given interface. Also the compiler offers to "Configure problem severity for preference 'Invalid Server Class' ".

I have looked over the web a lot trying to find the way that JBoss7 handles the servlets but haven't been able to make any progress. Any help / suggestions would be greatly appreciated as I am so close to running.

 

Previously I was on JBoss 4.2.3 (all working fine).

 

Here is the full web.xml:

 

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"

  version="3.0">

 

  <display-name>MyApp</display-name>

  <!-- <welcome-file-list>

     <welcome-file>index.html</welcome-file>

    <welcome-file>index.htm</welcome-file>

    <welcome-file>index.jsp</welcome-file>

    <welcome-file>default.html</welcome-file>

    <welcome-file>default.htm</welcome-file>

    <welcome-file>default.jsp</welcome-file>

 

  </welcome-file-list> -->

 

  <listener>

    <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>

  </listener>

 

  <!-- place the GraniteConfigListener after the seam listener -->

  <listener>

     <listener-class>org.granite.config.GraniteConfigListener</listener-class>

  </listener> 

 

  <filter>

    <filter-name>Seam Filter</filter-name>

    <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>

  </filter>

  <filter-mapping>

    <filter-name>Seam Filter</filter-name>

    <url-pattern>/*</url-pattern>  

  </filter-mapping>

 

  <!-- Seam resource -->

    <servlet>

   <servlet-name>Seam Resource Servlet</servlet-name>

    <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>

  </servlet>

  <servlet-mapping>

    <servlet-name>Seam Resource Servlet</servlet-name>

    <url-pattern>/seam/resource/*</url-pattern>

  </servlet-mapping>

 

     <filter>

        <filter-name>AMFMessageFilter</filter-name>

        <filter-class>org.granite.messaging.webapp.AMFMessageFilter</filter-class>

    </filter>  

    <filter-mapping>

        <filter-name>AMFMessageFilter</filter-name>

        <url-pattern>/graniteamf/*</url-pattern>

    </filter-mapping>

 

 

    <!-- AMF Servlet -->

     <servlet>

     <display-name>AMFMessageServlet</display-name>

        <servlet-name>AMFMessageServlet</servlet-name>

        <servlet-class>org.granite.messaging.webapp.AMFMessageServlet</servlet-class>

        <load-on-startup>1</load-on-startup>

     </servlet>

     <servlet-mapping>

        <servlet-name>AMFMessageServlet</servlet-name>

        <url-pattern>/graniteamf/*</url-pattern>

     </servlet-mapping>

 

 

  <!-- place the GravityServlet at the end of the file -->

  <servlet>

        <servlet-name>GravityServlet</servlet-name>

        <servlet-class>org.granite.gravity.servlet3.GravityAsyncServlet</servlet-class>

        <load-on-startup>1</load-on-startup>

    <!--        <async-supported>true</async-supported> -->

    </servlet>

    <servlet-mapping>

        <servlet-name>GravityServlet</servlet-name>

        <!-- map this to "gravityamf" not "gravity" -->

        <url-pattern>/gravityamf/*</url-pattern>

    </servlet-mapping>

</web-app>

 

 

 

Many thanks!

Dahn

  • 1. Re: Issues with servlet loading in JBoss7
    jaikiran pai Master

    Where do you see that error? Can you post the entire exception stacktrace? And which exact version of AS7 are you using?

  • 2. Re: Issues with servlet loading in JBoss7
    Dahn Maier Newbie

    Hi Jaikirai - thank you.

     

    I'm using Jboss 7.1.1 Final. The message is a warning not an error (I changed the severity to error) in Eclipse Indigo. It shows up as an exclamation mark on the side in web.xml (so no error stacktrace) at the level of where the servlet-class is defined (underlined in the listing above). However I know that the servlets are not loaded as the functionality they are supposed to deliver is not available at runtime.

     

    Dahn

  • 3. Re: Issues with servlet loading in JBoss7
    jaikiran pai Master

    Dahn, I've moved this to an appropriate forum where you might get some help.

  • 4. Re: Issues with servlet loading in JBoss7
    Dahn Maier Newbie

    Thank you.

  • 5. Re: Issues with servlet loading in JBoss7
    Max Rydahl Andersen Master

    Dahn, eclipse's warnings/errors is based on assumptions from how your eclipse is configured and might not be the same you actually see at runtime.

     

    what happens when you actually deploy ?

     

    any errors.?

  • 6. Re: Issues with servlet loading in JBoss7
    Dahn Maier Newbie

    Hi Max. Thank you. Yes.

     

    I use Hibernate 3.5+ with Seam 2.2.0 and JPA. When accessing the entityManager all is ok but sometimes I need the actual Hibernate session through the delegate (Session) entityManager.getDelegate().

    When that happens I get the following error (jboss-seam.jar is in my WEB-INF lib folder):

     

    java.lang.NoClassDefFoundError: org/jboss/seam/persistence/HibernateSessionProxy

              at org.jboss.seam.persistence.HibernatePersistenceProvider.proxySession(HibernatePersistenceProvider.java:116) [jboss-seam.jar:2.2.0.GA]

              at org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:140) [jboss-seam.jar:2.2.0.GA]

              at org.jboss.seam.persistence.EntityManagerProxy.getDelegate(EntityManagerProxy.java:97) [jboss-seam.jar:2.2.0.GA]

              at org.granite.tide.seam.lazy.PersistenceContextManager.fetchEntity(PersistenceContextManager.java:90) [granite-seam21.jar:]

              at org.granite.tide.seam.lazy.PersistenceContextManager.attachEntity(PersistenceContextManager.java:60) [granite-seam21.jar:]

              at org.granite.tide.seam.lazy.SeamInitializer.lazyInitialize(SeamInitializer.java:89) [granite-seam21.jar:]

              at org.granite.tide.seam.SeamServiceInvoker.initializeObject(SeamServiceInvoker.java:70) [granite-seam21.jar:]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_31]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_31]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_31]

              at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_31]

              at org.granite.messaging.service.ServiceInvocationContext.invoke(ServiceInvocationContext.java:71) [granite.jar:]

              at org.granite.messaging.service.security.AbstractSecurityService.endAuthorization(AbstractSecurityService.java:67) [granite.jar:]

              at org.granite.seam21.security.Seam21SecurityService.authorize(Seam21SecurityService.java:120) [granite-seam21.jar:]

              at org.granite.messaging.service.ServiceInvoker.invoke(ServiceInvoker.java:214) [granite.jar:]

              at org.granite.messaging.amf.process.AMF3MessageProcessor.processRemotingMessage(AMF3MessageProcessor.java:136) [granite.jar:]

              at org.granite.messaging.amf.process.AMF3MessageProcessor.process(AMF3MessageProcessor.java:59) [granite.jar:]

              at org.granite.messaging.amf.process.AMF0MessageProcessor.process(AMF0MessageProcessor.java:78) [granite.jar:]

              at org.granite.messaging.webapp.AMFEndpoint.service(AMFEndpoint.java:71) [granite.jar:]

              at org.granite.seam21.FlexFilter.doFilter(FlexFilter.java:242) [granite-seam21.jar:]

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) [jboss-seam.jar:2.2.0.GA]

              at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73) [jboss-seam.jar:2.2.0.GA]

              at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) [jboss-seam.jar:2.2.0.GA]

              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]

              at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]

              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]

              at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]

              at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]

              at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]

              at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]

    Caused by: java.lang.ClassNotFoundException: org.jboss.seam.persistence.HibernateSessionProxy from [Module "deployment.Stylect.war:main" from Service Module Loader]

              at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

              at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

              at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)



    Also I am using GraniteDS to glue the server to the client and collection initialization calls that work seamlessly on JBoss 4.2.3 do not trigger any kind of server actions in JBoss 7.1

    That could be related to this warning that JBoss shows at startup:

     

    19:46:54,974 WARN  [org.jboss.as.ee] (MSC service thread 1-11) JBAS011006: Not installing optional component org.granite.gravity.servlet3.AsyncRequestListener due to exception: org

    .jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.granite.gravity.servlet3.AsyncRequestListener

              at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:606)

              at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81)

              at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]

              at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_31]

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_31]

              at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_31]

     

     

    Again - none of this in JBoss 4.2.3

     

    Thanks again for looking into this.

     

    Dahn

  • 7. Re: Issues with servlet loading in JBoss7
    Max Rydahl Andersen Master

    okey - so you got multiple problems

     

    1) is the error in the tooling  - do you have both the Seam and the javax api on the classpath ? does this change wether you are targeting AS4 or AS7 from within the IDE ?

     

    2) runtime issues concerning use of seam/granitds on AS7 - this is a questio for the AS7/Seam forums - afaik Seam 2.x won't run out of the box on as7 before Seam 2.3 - but better to ask that runtime issue on jboss or seam forum.

  • 8. Re: Issues with servlet loading in JBoss7
    Dahn Maier Newbie

    Hi Max , this is helpful.

     

    RE 1 - yes to both questions. I don't get the error in AS4 and I have both javax and seam on the classpath.

    I have (in WEB-INF.lib) all the required jars from the Hibernate 4 download (it didn't work otherwise) as well as the seam jars:

    jboss-seam-debug.jar

    jboss-seam-excel.jar

    jboss-seam-ioc.jar

    jboss-seam-mail.jar

    jboss-seam-pdf.jar

    jboss-seam-remoting.jar

    jboss-seam-ui.jar

    jboss-seam.jar

     

    Any suggestions?

     

    RE 2 - got it - will ask on the Seam forum.

     

    Thanks,

    Dahn