1 Reply Latest reply on Feb 25, 2013 4:30 PM by Elian Laura

    java.lang.NoClassDefFoundError when i included <listener-class> to web.xml

    Elian Laura Newbie

      Hello,

      Help me please,, i don't find the reason for this error.

       

      I created a class LogoutListener.java, this implements HttpSessionListener, with its two abstract methods: sessionCreated and sessionDestroyed.

      And i added to the web.xml the respective <listener> tag:

       

      ..........

      <servlet>

                          <servlet-name>Faces Servlet</servlet-name>

                          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>

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

                </servlet>

       

                <servlet-mapping>

                          <servlet-name>Faces Servlet</servlet-name>

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

                </servlet-mapping>

       

       

                <!-- Listeners used by application -->

       

                <listener>

                              <listener-class>com.akson.encuesta.session.helper.LogoutListener</listener-class>

                </listener>

       

                <security-constraint>

                          <display-name>Restrict raw XHTML Documents</display-name>

                          <web-resource-collection>

                                    <web-resource-name>XHTML</web-resource-name>

                                    <url-pattern>*.xhtml</url-pattern>

                          </web-resource-collection>

                          <auth-constraint />

                </security-constraint>

      ......

       

       

      When i delete the <listener> tag, the server don't trhorw error, but when the tag is in web.xml the server thorw error:

       

       

      ................

      12:16:12,550 INFO  [SessionSpecContainer] Starting jboss.j2ee:jar=demoencuesta06

      .war,name=TimerServiceDispatcher,service=EJB3

      12:16:12,551 INFO  [EJBContainer] STARTED EJB: org.jboss.seam.async.TimerService

      Dispatcher ejbName: TimerServiceDispatcher

      12:16:12,557 INFO  [JndiSessionRegistrarBase] Binding the following Entries in G

      lobal JNDI:

       

               TimerServiceDispatcher/local - EJB3.x Default Local Business Interface

              TimerServiceDispatcher/local-org.jboss.seam.async.LocalTimerServiceDispa

      tcher - EJB3.x Local Business Interface

       

       

      12:16:12,559 WARN  [TimerServiceContainer] EJBTHREE-2193: using deprecated Timer

      ServiceFactory for restoring timers

      12:16:12,763 INFO  [TomcatDeployment] deploy, ctxPath=/demoencuesta06

      12:16:12,806 ERROR [[/demoencuesta06]] Error configurando escuchador de aplicaci

      ¾n de clase com.akson.encuesta.session.helper.LogoutListener: java.lang.ClassNot

      FoundException: com.akson.encuesta.session.helper.LogoutListener

              at java.net.URLClassLoader$1.run(URLClassLoader.java:202) [:1.6.0_33]

              at java.security.AccessController.doPrivileged(Native Method) [:1.6.0_33

      ]

              at java.net.URLClassLoader.findClass(URLClassLoader.java:190) [:1.6.0_33

      ]

              at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [:1.6.0_33]

              at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [:1.6.0_33]

              at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(Tom

      catInjectionContainer.java:278) [:6.1.0.Final]

              at org.jboss.web.tomcat.service.TomcatInjectionContainer.newInstance(Tom

      catInjectionContainer.java:264) [:6.1.0.Final]

              at org.apache.catalina.core.StandardContext.contextListenerStart(Standar

      dContext.java:3319) [:6.1.0.Final]

              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3

      828) [:6.1.0.Final]

              at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy

      Internal(TomcatDeployment.java:294) [:6.1.0.Final]

              at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy

      (TomcatDeployment.java:146) [:6.1.0.Final]

              at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeploy

      ment.java:476) [:6.1.0.Final]

              at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118) [:6

      .1.0.Final]

              at org.jboss.web.deployers.WebModule.start(WebModule.java:95) [:6.1.0.Fi

      nal]

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_3

      3]

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.

      java:39) [:1.6.0_33]

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces

      sorImpl.java:25) [:1.6.0_33]

              at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_33]

              at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatch

      er.java:157) [:6.0.0.GA]

              at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96) [:6.0.0.G

      A]

              at org.jboss.mx.server.Invocation.invoke(Invocation.java:88) [:6.0.0.GA]

       

       

              at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.

      java:271) [:6.0.0.GA]

              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670)

      ...................

       

       

       

       

       

       

       

      I'm using Eclipse Indigo, Jboss, Seam, RichFaces

       

      Please i need to know why don't work.

       

      thank you