4 Replies Latest reply on Mar 14, 2010 8:29 PM by Carey Foushee

    WebService WAR POJO + JBOSS 5.0.0.GA + SEAM 2.1.1.GA

    Gábor Sift Newbie

      Hi,


      I have a WebService implemented, but have some trouble with it..


      The good news is that methods login and logout work perfect.


      The bad news is that listPartners just won't do it.


      It is throwing a NoClassDefFoundError for org.domain.tracker.session.partner.PartnerList when I try to invoke it.


      Please somebody take a look at my code where am I going wrong, because I've been struggling with this for days now and I can't get it!


      The WebService is like this:



      package org.domain.tracker.ws;
      
      import java.util.List;
      
      import javax.jws.WebMethod;
      import javax.jws.WebService;
      import javax.jws.soap.SOAPBinding;
      
      import org.domain.tracker.entity.Partner;
      import org.domain.tracker.session.partner.PartnerList;
      import org.jboss.seam.Component;
      import org.jboss.seam.annotations.security.Restrict;
      import org.jboss.seam.security.Identity;
      
      @WebService(name = "TrackerService", serviceName = "TrackerService")
      @SOAPBinding(style = SOAPBinding.Style.RPC)
      public class TrackerService {
           
           @WebMethod
           public boolean login(String username, String password) {
                Identity.instance().setUsername(username);
                Identity.instance().setPassword(password);
                Identity.instance().login();
                return Identity.instance().isLoggedIn();
           }
      
           @WebMethod
           public boolean logout() {
                Identity.instance().logout();
                return !Identity.instance().isLoggedIn();
           }
      
           @WebMethod
           @Restrict("#{identity.loggedIn}")
           public Partner[] listPartners() {
                PartnerList pl = (PartnerList) Component.getInstance(PartnerList.class, true);
                List<Partner> partners = pl.getResultList();
                return partners.toArray(new Partner[partners.size()]);
           }
      
      }



      web.xml is like this:



          <servlet>
              <servlet-name>TrackerService</servlet-name>
              <servlet-class>org.domain.tracker.entity.TrackerService</servlet-class>
          </servlet>
          <servlet-mapping>
              <servlet-name>TrackerService</servlet-name>
              <url-pattern>/trackerService</url-pattern>
          </servlet-mapping>



      components.xml is like this:



      <web:context-filter url-pattern="/trackerService"/>



      Directory tree is like this:


      D:\GANYMEDE\WORKSPACE\TRACKER
      ?   .classpath
      ?   .project
      ?   hibernate-console.properties
      ?   tracker.launch
      ?   
      ????.settings
      ?       .jsdtscope
      ?       org.eclipse.jdt.core.prefs
      ?       org.eclipse.jst.common.project.facet.core.prefs
      ?       org.eclipse.wst.common.component
      ?       org.eclipse.wst.common.project.facet.core.xml
      ?       org.eclipse.wst.jsdt.ui.superType.container
      ?       org.eclipse.wst.jsdt.ui.superType.name
      ?       org.hibernate.eclipse.console.prefs
      ?       org.jboss.tools.jst.web.xml
      ?       org.jboss.tools.seam.core.prefs
      ?       
      ????build
      ?   ????classes
      ?       ?   components.properties
      ?       ?   import.sql
      ?       ?   messages_en.properties
      ?       ?   seam.properties
      ?       ?   security.drl
      ?       ?   
      ?       ????META-INF
      ?       ?       persistence.xml
      ?       ?       
      ?       ????org
      ?           ????domain
      ?               ????tracker
      ?                   ????entity
      ?                   ?       Country.class
      ?                   ?       Partner.class
      ?                   ?       PartnerType.class
      ?                   ?       Role.class
      ?                   ?       TimeTable.class
      ?                   ?       User.class
      ?                   ?       UserDetail.class
      ?                   ?       
      ?                   ????ws
      ?                           TrackerService.class
      ?                           
      ????resources
      ?       tracker-ds.xml
      ?       
      ????src
      ?   ????hot
      ?   ?   ?   seam.properties
      ?   ?   ?   
      ?   ?   ????org
      ?   ?       ????domain
      ?   ?           ????tracker
      ?   ?               ????session
      ?   ?                   ?   AuthenticationEvents.java
      ?   ?                   ?   ChartProcesser.java
      ?   ?                   ?   TimeTableManager.java
      ?   ?                   ?   TrackerMenu.java
      ?   ?                   ?   
      ?   ?                   ????auth
      ?   ?                   ?       PasswordBean.java
      ?   ?                   ?       
      ?   ?                   ????country
      ?   ?                   ?       CountryHome.java
      ?   ?                   ?       CountryList.java
      ?   ?                   ?       
      ?   ?                   ????partner
      ?   ?                   ?       PartnerHome.java
      ?   ?                   ?       PartnerList.java
      ?   ?                   ?       PartnerTypeHome.java
      ?   ?                   ?       PartnerTypeList.java
      ?   ?                   ?       
      ?   ?                   ????role
      ?   ?                   ?       RoleHome.java
      ?   ?                   ?       RoleList.java
      ?   ?                   ?       
      ?   ?                   ????user
      ?   ?                           RegisterUser.java
      ?   ?                           UserDetailHome.java
      ?   ?                           UserDetailList.java
      ?   ?                           UserHome.java
      ?   ?                           UserList.java
      ?   ?                           
      ?   ????main
      ?       ?   components.properties
      ?       ?   import.sql
      ?       ?   messages_en.properties
      ?       ?   seam.properties
      ?       ?   security.drl
      ?       ?   
      ?       ????META-INF
      ?       ?       persistence.xml
      ?       ?       
      ?       ????org
      ?           ????domain
      ?               ????tracker
      ?                   ????entity
      ?                   ?       Country.java
      ?                   ?       Partner.java
      ?                   ?       PartnerType.java
      ?                   ?       Role.java
      ?                   ?       TimeTable.java
      ?                   ?       User.java
      ?                   ?       UserDetail.java
      ?                   ?       
      ?                   ????ws
      ?                           TrackerService.java
      ?                           
      ????WebContent
          ?   country.xhtml
          ?   countryList.xhtml
          ?   editUser.xhtml
          ?   error.xhtml
          ?   home.xhtml
          ?   index.html
          ?   login.page.xml
          ?   login.xhtml
          ?   partner.xhtml
          ?   partnerList.xhtml
          ?   partnerType.xhtml
          ?   partnerTypeList.xhtml
          ?   pie.xhtml
          ?   registerUser.xhtml
          ?   role.xhtml
          ?   roleList.xhtml
          ?   showUser.xhtml
          ?   timeTable.xhtml
          ?   userList.xhtml
          ?   
          ????img
          ?       dtpick.gif
          ?       error.gif
          ?       manytoone.gif
          ?       msgerror.png
          ?       msginfo.png
          ?       msgwarn.png
          ?       onetomany.gif
          ?       seamlogo.png
          ?       
          ????layout
          ?       display.xhtml
          ?       edit.xhtml
          ?       menu.xhtml
          ?       sort.xhtml
          ?       template.xhtml
          ?       
          ????META-INF
          ?       MANIFEST.MF
          ?       
          ????stylesheet
          ?       theme.css
          ?       theme.xcss
          ?       
          ????WEB-INF
              ?   .pages.xml.spdia
              ?   components.xml
              ?   faces-config.xml
              ?   jboss-web.xml
              ?   pages.xml
              ?   web.xml
              ?   
              ????classes
              ?   ????META-INF
              ????dev
              ?   ?   seam.properties
              ?   ?   
              ?   ????org
              ?       ????domain
              ?           ????tracker
              ?               ????session
              ?                   ?   AuthenticationEvents.class
              ?                   ?   ChartProcesser.class
              ?                   ?   TimeTableManager.class
              ?                   ?   TrackerMenu.class
              ?                   ?   
              ?                   ????auth
              ?                   ?       PasswordBean.class
              ?                   ?       
              ?                   ????country
              ?                   ?       CountryHome.class
              ?                   ?       CountryList.class
              ?                   ?       
              ?                   ????partner
              ?                   ?       PartnerHome.class
              ?                   ?       PartnerList.class
              ?                   ?       PartnerTypeHome.class
              ?                   ?       PartnerTypeList.class
              ?                   ?       
              ?                   ????role
              ?                   ?       RoleHome.class
              ?                   ?       RoleList.class
              ?                   ?       
              ?                   ????user
              ?                           RegisterUser.class
              ?                           UserDetailHome.class
              ?                           UserDetailList.class
              ?                           UserHome.class
              ?                           UserList.class
              ?                           
              ????lib
                      antlr-runtime.jar
                      commons-beanutils.jar
                      commons-digester.jar
                      core.jar
                      drools-compiler.jar
                      drools-core.jar
                      jboss-el.jar
                      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
                      jbpm-jpdl.jar
                      jcommon.jar
                      jfreechart.jar
                      jsf-facelets.jar
                      jxl.jar
                      mvel14.jar
                      richfaces-api.jar
                      richfaces-impl.jar
                      richfaces-ui.jar



      Thanks for reading it through!


      Gabor

        • 1. Re: WebService WAR POJO + JBOSS 5.0.0.GA + SEAM 2.1.1.GA
          Gábor Sift Newbie

          Stack trace follows:


          00:09:39,984 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
          java.lang.reflect.UndeclaredThrowableException
               at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:225)
               at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:498)
               at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
               at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
               at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
               at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:109)
               at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
               at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
               at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.ContextFilter$1.process(ContextFilter.java:42)
               at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
               at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
               at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
               at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
               at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:601)
               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
               at java.lang.Thread.run(Unknown Source)
          Caused by: java.lang.NoClassDefFoundError: org/domain/tracker/session/partner/PartnerList
               at org.domain.tracker.ws.TrackerService.listPartners(TrackerService.java:36)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:99)
               at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:219)
               ... 52 more
          Caused by: java.lang.ClassNotFoundException: org.domain.tracker.session.partner.PartnerList


          • 2. Re: WebService WAR POJO + JBOSS 5.0.0.GA + SEAM 2.1.1.GA
            Julien Kronegg Novice

            At first sight, it seems that WebContent/WEB-INF/dev contains the files which should be in the WebContent/WEB-INF/classes directory. Thus, when packaged in the WAR file, the ClassLoader can not find the class.


            If you are using Eclipse, check the project Properties/Java Build Path/checkbox Allow output folders for source folders.


            If the above does not work, please post the WAR file and directory list.

            • 3. Re: WebService WAR POJO + JBOSS 5.0.0.GA + SEAM 2.1.1.GA
              Gábor Sift Newbie

              YESSS!! :)


              You made my day! After moving the class from dev to classes everything is working! This was the only thing I didn't try, thanks for pointing it out. :)

              • 4. Re: WebService WAR POJO + JBOSS 5.0.0.GA + SEAM 2.1.1.GA
                Carey Foushee Newbie

                I believe I'm having the same issue you had, see WebserviceNotDeployingEndpoint. So I'm trying to understand your code to fix my problem.  But one question I have is your servlet entries in the web.xml confuse me.  Why is the servlet-class defined as the entity.TrackerService when in your tree listing you don't even have an entity.TrackerService?  Was that just a typo?


                Did you add a standard-jaxws-endpoint-config.xml file anywhere?