12 Replies Latest reply on Apr 3, 2012 9:15 AM by asoldano

    JAXWS error on jboss 6.0

    jayaramimca

      Hi,

       

      I have just upgraded my application from jboss5.0 to jboss 6.0, I am consuming a JAXWS webservices, below are the configuration :

       

      <bean id="registerService" class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">

        <property name="serviceInterface" value="com.friendsmirror.register.controller.UserRegisterController" />

        <property name="wsdlDocumentUrl" value="http://127.0.0.1:8080/FriendsMirrorRegisterWS/Register?wsdl" />

        <property name="namespaceUri" value="http://controller.register.friendsmirror.com/" />

        <property name="serviceName" value="UserRegisterControllerImplService" />

        <property name="portName" value="UserRegisterControllerImplPort" />

        </bean>

       

      while injecting this bean, is throwing exception like:

       

      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registerService' defined in ServletContext resource [/WEB-INF/spring/friendsmirrorBeans.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/springframework/beans/BeansException

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1444) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) [:3.1.0.RC2]

                ... 96 more

      Caused by: java.lang.NoClassDefFoundError: org/springframework/beans/BeansException

                at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.getSpringBusFactory(JBossWSBusFactory.java:120) [:3.4.1.GA]

                at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.createBus(JBossWSBusFactory.java:54) [:3.4.1.GA]

                at org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:69) [:3.4.1.GA]

                at javax.xml.ws.Service.<init>(Service.java:57) [:1.0.0.Final]

                at javax.xml.ws.Service.create(Service.java:687) [:1.0.0.Final]

                at org.springframework.remoting.jaxws.LocalJaxWsServiceFactory.createJaxWsService(LocalJaxWsServiceFactory.java:125) [:3.1.0.RC2]

                at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.prepare(JaxWsPortClientInterceptor.java:334) [:3.1.0.RC2]

                at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.afterPropertiesSet(JaxWsPortClientInterceptor.java:316) [:3.1.0.RC2]

                at org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean.afterPropertiesSet(JaxWsPortProxyFactoryBean.java:42) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1503) [:3.1.0.RC2]

                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1441) [:3.1.0.RC2]

                ... 103 more

      Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from BaseClassLoader@263b84ee{vfs:///Users/Jayaram/Program/Servers/jboss-6.0.0.Final/server/all/conf/jboss-service.xml}

                at org.jboss.classloader.spi.base.BaseClassLoader.loadClass(BaseClassLoader.java:480) [jboss-classloader.jar:2.2.0.GA]

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

                ... 114 more

       

      19:44:27,215 INFO  [config] Initializing Mojarra 2.0.9 (FCS 20120216) for context '/FriendsMirrorWAR'

       

       

      While using the same from stand alone test method or junit, is working absolutly fine, Even its working fine with jboss5.0, I migrated to jboss 6.0 as I required JSF2.0.

       

      Please help me out, Stucked from past 3 Days.

       

      Thanks in advance.

       

      Jayaram

        • 1. Re: JAXWS error on jboss 6.0
          jbalunas

          Hmm, I'm not sure, but I'm going to move this post over the the WS project they might know for sure.

          • 2. Re: JAXWS error on jboss 6.0
            jayaramimca

            Hello Jay,

             

            Thanks for the quick reply, Please go ahed to move this post and let me know how can I will keep track of this issue.

             

             

            I need to add one more point to the above, On hit and trail basics trying to resolve the issue, I put spring-beans-3.0.5.RELEASE.jar to ${JBOSS-SERVER}/lib/

             

            folder, Now the

            Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException , issue is not coming, where as its not able to detect the proxy class created by wsimport, I mean not able to inject this service.

             

            Thanks,

            Jayaram.

            • 3. Re: JAXWS error on jboss 6.0
              jbalunas

              You should be able to get email notifications as an option near the top of the post, and hopefully one of the guys here will have a better answer for you!

              • 4. Re: JAXWS error on jboss 6.0
                asoldano

                The reason for the NCDFE moving from AS 5 to AS6 might be related to fact that AS 6 comes with JBossWS-CXF stack installed by default. Can you provide more details about your application?

                 

                This said, I assume you have a spring bean declaration (is Apache CXF also involved?) for creating a jaxws client. JBoss AS comes with his spec compliant JAXWS impl and you're supposed to use that. As a matter of fact, the stacktrace above suggests that Spring's LocalJaxWsServiceFactory used the JAXWS Service API, which resolved the configured javax.xml.ws.spi.Provider implementation and got the jbossws-cxf one (it's configured though a META-INF/services declaration in one of the jars living in lib/endorsed folder). The jbossws-cxf stack then tries to build the client, goes for the Spring version of the CXF bus (probably because you have Spring jars in your app, classloading is a bit of a mess in AS6) and eventually fails, perhaps because the jbws stack can't load Spring from the jbossws stack classloader.

                I don't have a 100% sure solution for this, I'd need to try something.

                On AS7 this might be solved (I want to verify this btw) by configuring the javax.xml.ws.spi.Provider impl to use for the specific application (AS7 does not use the "endorsed" lib concept).

                 

                Consider posting the other exception you get after installing Spring in server/lib, perhaps we can find a workaround...

                • 5. Re: JAXWS error on jboss 6.0
                  jayaramimca

                  Hi Alessio,

                   

                  Thanks for the quick response.

                   

                  Yes you are rite this is having jar mess up from application lib with ${JBOSS_HOME}/lib/endrosed/ and jboss-service.xml.

                   

                  I am not using any Apache CXF, specification, I am sticking to the jaxws 2.1 metro specifications.

                   

                  PFB, for the steps I undergone, for consuming as a client.

                   

                  Step1: Genrate the clint from the wsdl, using wsimport

                  Step2: bunndelled with jar and put inside my application lib directory, I tried to test the service working by intastining the proxy service like :

                  new UserRegisterControllerImplService();

                  and got the port and able to use, When I am trying to inject in a spring way by  JaxWsPortProxyFactoryBean, Its end up with this kind of exception

                   

                  Please Note: I didn't modify any jboss directory and jboss-service.xml intially and got that above posted error.

                   

                  For a work arround i tried with mutiple way like:

                   

                  Way 1: removed all jars from the endrosed floder and put

                  bossws-native-jaxrpc.jar

                            jbossws-native-jaxws.jar

                            jbossws-native-jaxws-ext.jar

                            jbossws-native-saaj.jar

                   

                  as a jboss 5.0 way, its not giving any exception, where as its not able to intatiate also, i mean getting time out issue incresing the server time out to 800 also, I think Its getting locked.

                   

                  Way 2: I tried to keep all the jars default provided by jboss in endroseed and put jaxwsimpl, jaxb then it gave me the exception for the ploicy jar of jaxws.

                   

                  Then I tried with putting the policy jar provided by sun.java.net, end up with the same senario of thread lock.

                   

                  Way 3: Tried to put all spring and jaxws releated jars to lib directory, by that I am able to remove that beanexception class not found but end up with no matching bean, Which means its not all able to detect JaxWsPortProxyFactoryBean .

                   

                  As you mentioned, I even Tried with jboss 6.1 Final, Jboss 7.0 but stuck in same situation.

                   

                  Could you please guide me what exactly need to changed in jboss-service.xml for JAXWS SOAP to consume, So that will give a try hoping for best lock.

                   

                  Also, i will be grate full to you if you will provide me any way to see the class loader sequence of Jboss, i mean somthing how enable debug of jboss to see internal class loader and where its getting stucked , i am unware as I always tried to application debug but never tried with class loader deug of server.

                   

                  Some where from this forum I noticed about the cxf jars issue, i removed all them and it has no impact of solution.

                   

                  So I think, Jboss6 or heighr is not able to get the spring remoting functionality properly , As I tried with jboss5.0, all are working well with endrossed mechansim.

                   

                  Please let me know for any other clarifications.

                   

                  Thanks for to be with me to find a work arround for this.

                   

                  Thanks,

                  Jayaram.



                  • 6. Re: JAXWS error on jboss 6.0
                    asoldano

                    I will probably have time to do some actual tries end of this week; in the mean time, a workaround solution might be to download and install jbossws-native 3.4.1 stack on AS6.0.0.Final or jbossws-native 4.0.2 on AS 7 (check https://community.jboss.org/wiki/JBossWS-SupportedTargetContainers ).

                    I'm going to check the proper way of having this run with jbossws-cxf stack installed installed on AS7.

                    1 of 1 people found this helpful
                    • 7. Re: JAXWS error on jboss 6.0
                      jayaramimca

                      Also, Tried with the steps from this post:

                       

                      https://community.jboss.org/thread/156261?tstart=0

                       

                      But not feesible, I believe there should be less confugration required from my application point  not from server side, its my assumption, Please correct me in case I m wrong.

                      • 8. Re: JAXWS error on jboss 6.0
                        jayaramimca

                        Alessio,

                         

                        Thanks for your effort. Please take your own time, Will try to implement the solution provided by you above, will keep you update in case of issue or resolved.

                        • 9. Re: JAXWS error on jboss 6.0
                          jayaramimca

                          Alessio,

                           

                          I tried jaxws native 3.4.1 stack as you suggested, after deploying, I saw a mutiple changes in lib and endrosed folder, the changes like jaxb-impl and jboss-native-factories.jar got added respectivly.

                           

                          Where as when trying to deploye the application, the application is getting stucked in:

                           

                          00:44:46,950 INFO  [STDOUT]  -<init>[2012-44-28 12:44,   484]INFO [Thread-3](DefaultListableBeanFactory.java:557) - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@7c00f5e: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,propertyPlaceholderConfigurer,dateFactory,loginBoService,registerationService,registerService,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy

                           

                          Its not at all proceeding further, Could you please let me know any other work arround, I mean any other way consuming this in spring remoting way.

                           

                          Thanks

                          • 10. Re: JAXWS error on jboss 6.0
                            jayaramimca

                            Hi Alessio,

                             

                            I tried with jaxws stack as well with jbossws-metro stack, where as I am finding the below exception for both the cases:

                             

                            05:46:00,756 INFO  [STDOUT] Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/web/tomcat/service/WebCtxLoader$ENCLoader) previously initiated loading for a different type with name "javax/xml/soap/AttachmentPart"

                            05:46:00,756 INFO  [STDOUT]           at java.lang.Class.forName0(Native Method)

                            05:46:00,756 INFO  [STDOUT]           at java.lang.Class.forName(Class.java:169)

                            05:46:00,756 INFO  [STDOUT]           at $Proxy296.<clinit>(Unknown Source)

                            05:46:00,756 INFO  [STDOUT]           at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                            05:46:00,757 INFO  [STDOUT]           at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                            05:46:00,757 INFO  [STDOUT]           at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                            05:46:00,757 INFO  [STDOUT]           at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                            05:46:00,757 INFO  [STDOUT]           at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:588)

                            05:46:00,757 INFO  [STDOUT]           at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.createProxy(ServiceDelegateImpl.java:406)

                            05:46:00,757 INFO  [STDOUT]           at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPortInternal(ServiceDelegateImpl.java:243)

                            05:46:00,757 INFO  [STDOUT]           at org.jboss.ws.core.jaxws.spi.ServiceDelegateImpl.getPort(ServiceDelegateImpl.java:570)

                            05:46:00,757 INFO  [STDOUT]           at javax.xml.ws.Service.getPort(Service.java:99)

                            05:46:00,758 INFO  [STDOUT]           at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.getPortStub(JaxWsPortClientInterceptor.java:413)

                            05:46:00,758 INFO  [STDOUT]           at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.prepare(JaxWsPortClientInterceptor.java:337)

                            05:46:00,758 INFO  [STDOUT]           at org.springframework.remoting.jaxws.JaxWsPortClientInterceptor.afterPropertiesSet(JaxWsPortClientInterceptor.java:316)

                            05:46:00,758 INFO  [STDOUT]           at org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean.afterPropertiesSet(JaxWsPortProxyFactoryBean.java:42)

                            05:46:00,758 INFO  [STDOUT]           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1503)

                            05:46:00,758 INFO  [STDOUT]           at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1441)

                            05:46:00,758 INFO  [STDOUT]           ... 104 more

                             

                            By looking at the stack trace can tell that its entering to jaxwsportproxy of spring to instansiate the bean.

                             

                            and the issue of linkage error, I thought May be jar miss match from my src jar and webinf/lib directory of saj-api and saj-impl, I updated both with same version as well added javaxactivation.jar to the web-inf/lib still stuck on the same issue of linkage error.

                             

                            I am sure I m getting close for this. Could you please let me suggest any option to overide the linkage issue ?

                             

                            Thanks,

                            Jayaram.

                            • 11. Re: JAXWS error on jboss 6.0
                              jayaramimca

                              Finally Issue got resolved by installing jboss jaxws native 3.4.1 .

                               

                              After installing this stack, you may end up

                               

                              java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/web/tomcat/service/WebCtxLoader$ENCLoader) previously initiated loading for a different type with name "javax/xml/soap/AttachmentPart"

                               

                              as error suggest, classloader trying to load class is missmatching the type, so for this make sure, in web-inf/lib, you don't have any jar for his. In my case I removed saj-api,saj-impl and soap releated jars.

                              • 12. Re: JAXWS error on jboss 6.0
                                asoldano

                                Thanks for having followed up here with your achievements.

                                Right, you need to remove the saaj api and impl jars from the deployment, those are already provided in the server.

                                 

                                For the records, I've run some tests on JBos AS 7.1 with the latest jbossws-cxf 4.1.0-SNAPSHOT integration. The use case here should basically work in that environment as thanks to the fix for JBWS-3453 (https://issues.jboss.org/browse/JBWS-3453) the JBossWS-CXF impl of JAXWS SPI Provider won't try to create a spring version of the cxf bus.

                                I've also verified it's possible to customize the implementation of JAXWS SPI Provider to be used, a testcase for that has also been committed while working on JBWS-3477 (https://issues.jboss.org/browse/JBWS-3477).