Bug 799911

Summary: EAP6 wsprovide.sh does not correctly resolve classpath if Spring is a part of the archive
Product: [Retired] JBoss Enterprise WFK Platform 2 Reporter: Karel Piwko <kpiwko>
Component: SpringAssignee: Marius Bogoevici <mariusb>
Status: CLOSED NEXTRELEASE QA Contact: Karel Piwko <kpiwko>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0.0.ER1CC: mnovotny, rnewton, rruss
Target Milestone: ---   
Target Release: 2.0.0.ER4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The Snowdrop module, which provides Spring for other modules, and its dependencies are not made available by default to other modules. This means some modules such as WSProvide cannot access them when needed. This issue is now fixed with the JBoss Web Framework Kit 2 GA release, and the Snowdrop dependencies are available by default.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-09-24 14:56:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Karel Piwko 2012-03-05 11:57:51 UTC
Description of problem:

WSProvide


Version-Release number of selected component (if applicable):

Snowdrop Sportsclub example 3.1

How reproducible:

Always


Steps to Reproduce:
1. Find a class which implements a 
2. Prepare a classpath, like extract all jars into a single directory or make a classpath string
3. Execute wsprovide.sh
  
Actual results:

Failed to invoke JavaToWS
java.lang.NoClassDefFoundError: org/springframework/beans/BeansException
        at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.getSpringBusFactory(JBossWSBusFactory.java:120)
        at org.jboss.wsf.stack.cxf.client.configuration.JBossWSBusFactory.createBus(JBossWSBusFactory.java:54)
        at org.apache.cxf.BusFactory.getDefaultBus(BusFactory.java:98)
        at org.apache.cxf.BusFactory.createThreadBus(BusFactory.java:164)
        at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:154)
        at org.apache.cxf.BusFactory.getThreadDefaultBus(BusFactory.java:139)
        at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.getBus(JavaToWSDLProcessor.java:315)
        at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.getServiceBuilder(JavaToWSDLProcessor.java:207)
        at org.apache.cxf.tools.java2wsdl.processor.JavaToWSDLProcessor.process(JavaToWSDLProcessor.java:100)
        at org.apache.cxf.tools.java2ws.JavaToWSContainer.processWSDL(JavaToWSContainer.java:110)
        at org.apache.cxf.tools.java2ws.JavaToWSContainer.execute(JavaToWSContainer.java:75)
        at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:103)
        at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:45)
        at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:82)
        at org.jboss.wsf.stack.cxf.tools.CXFProviderImpl.provide(CXFProviderImpl.java:190)
        at org.jboss.wsf.stack.cxf.tools.CXFProviderImpl.provide(CXFProviderImpl.java:103)
        at org.jboss.ws.tools.cmd.WSProvide.generate(WSProvide.java:207)
        at org.jboss.ws.tools.cmd.WSProvide.main(WSProvide.java:83)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jboss.modules.Module.run(Module.java:260)
        at org.jboss.modules.Main.main(Main.java:291)
Caused by: java.lang.ClassNotFoundException: org.springframework.beans.BeansException from [Module "org.apache.cxf:main" from local module loader @65b60280 (roots: /opt/eap6/modules)]
        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)
        ... 24 more

Expected results:

It generates source and resources based on code.

Additional info:

Executed command:

[kpiwko@kapy-ntb spring-3_1]$ /opt/eap6/bin/wsprovide.sh -w -k -c /home/kpiwko/devel/wfk/wfk-qa/spring/demo/target/sportsclub-2.0.0.ER1/spring-3.1/sportsclub-invoicing-webmvc/target/classes -o jaxws-target -r jaxws-resources -s jaxws-sources org.jboss.snowdrop.samples.sportsclub.ws.PaymentNotificationService
Could not find log4j.xml configuration, logging to console.

java2ws -s /home/kpiwko/devel/wfk/jboss-wfk-2.0.0.ER1-demo/examples/sportsclub-2.0.0.ER1/spring-3_1/jaxws-sources -classdir /home/kpiwko/devel/wfk/jboss-wfk-2.0.0.ER1-demo/examples/sportsclub-2.0.0.ER1/spring-3_1/jaxws-target -d /home/kpiwko/devel/wfk/jboss-wfk-2.0.0.ER1-demo/examples/sportsclub-2.0.0.ER1/spring-3_1/jaxws-resources -verbose -wsdl -cp /home/kpiwko/devel/wfk/wfk-qa/spring/demo/target/sportsclub-2.0.0.ER1/spring-3.1/sportsclub-invoicing-webmvc/target/classes/: -wrapperbean -createxsdimports org.jboss.snowdrop.samples.sportsclub.ws.PaymentNotificationService
java2ws - Apache CXF 2.4.6-redhat-1

Related part of CXF:

    public Bus createBus(String cfgFiles[], boolean includeDefaults) {
        try {
            String userCfgFile = System.getProperty(Configurer.USER_CFG_FILE_PROPERTY_NAME);
            String sysCfgFileUrl = System.getProperty(Configurer.USER_CFG_FILE_PROPERTY_URL);
            Resource r = BusApplicationContext.findResource(Configurer.DEFAULT_USER_CFG_FILE);
            if (context == null && userCfgFile == null && cfgFiles == null && sysCfgFileUrl == null 
                && (r == null || !r.exists()) && includeDefaults) {
                return new org.apache.cxf.bus.CXFBusFactory().createBus();
            }
            return finishCreatingBus(createApplicationContext(cfgFiles, includeDefaults));
        } catch (BeansException ex) {
            LogUtils.log(LOG, Level.WARNING, "APP_CONTEXT_CREATION_FAILED_MSG", ex, (Object[])null);
            throw new RuntimeException(ex);
        }
    }

Comment 1 Karel Piwko 2012-03-05 11:59:56 UTC
Description of the problem:

WSProvide finds a Spring Context as a part of the classpath, however Spring is not a part of the wsprovide.sh classpath, e.g. Spring module is not reachable from within CXF module.

Classpath seems to be isolated.

Comment 2 Karel Piwko 2012-03-05 12:19:58 UTC
Works if org/apache/cxf/main/module.xml module is modified in following way:

        <module name="org.springframework.spring" slot="snowdrop" export="true" optional="true" />

Comment 3 Karel Piwko 2012-03-05 12:27:22 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Snowdrop module, which provides Spring for other modules has it's dependencies not broadly exported.

In order to have them exported, modify $JBOSS_HOME/modules/org/apache/cxf/main/module.xml to have correct Snowdrop module version and export it's dependencies to make it a part of classpath for other modules via:

<module name="org.springframework.spring" slot="snowdrop" export="true" optional="true" />

Comment 4 JBoss JIRA Server 2012-03-06 17:04:14 UTC
Alessio Soldano <asoldano> made a comment on jira JBPAPP-8346

This requires backporting of JBWS-3453.

Comment 5 Marius Bogoevici 2012-03-07 23:04:21 UTC
Agree with note.

Comment 6 Rebecca Newton 2012-03-08 01:42:50 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,5 +1,2 @@
-Snowdrop module, which provides Spring for other modules has it's dependencies not broadly exported.
+The dependencies for the Snowdrop module, which provides Spring for other modules, are not broadly available. This means some modules such as WSProvide cannot access them when needed. To workaround this issue, change the Snowdrop module version to export its dependencies and make it part of the classpath for other modules. To do this, add <module name="org.springframework.spring" slot="snowdrop" export="true"
-
+optional="true" /> to $JBOSS_HOME/modules/org/apache/cxf/main/module.xml.-In order to have them exported, modify $JBOSS_HOME/modules/org/apache/cxf/main/module.xml to have correct Snowdrop module version and export it's dependencies to make it a part of classpath for other modules via:
-
-<module name="org.springframework.spring" slot="snowdrop" export="true" optional="true" />

Comment 7 Marius Bogoevici 2012-03-13 17:20:17 UTC
Mod'd to:

The Snowdrop module, which provides Spring for other modules, and its dependencies are not made available by default to other modules. This means some modules such as WSProvide cannot access them when needed. To workaround this issue, modify the Apache CXF module to access Snowdrop and its dependencies and make them part of the classpath for other modules that depend on it. To do this, add <module name="org.springframework.spring" slot="snowdrop" export="true"
optional="true" /> to $JBOSS_HOME/modules/org/apache/cxf/main/module.xml.

Comment 8 Marius Bogoevici 2012-03-13 17:20:17 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,2 +1,2 @@
-The dependencies for the Snowdrop module, which provides Spring for other modules, are not broadly available. This means some modules such as WSProvide cannot access them when needed. To workaround this issue, change the Snowdrop module version to export its dependencies and make it part of the classpath for other modules. To do this, add <module name="org.springframework.spring" slot="snowdrop" export="true"
+The Snowdrop module, which provides Spring for other modules, and its dependencies are not made available by default to other modules. This means some modules such as WSProvide cannot access them when needed. To workaround this issue, modify the Apache CXF module to access Snowdrop and its dependencies and make them part of the classpath for other modules that depend on it. To do this, add <module name="org.springframework.spring" slot="snowdrop" export="true"
 optional="true" /> to $JBOSS_HOME/modules/org/apache/cxf/main/module.xml.

Comment 9 JBoss JIRA Server 2012-04-02 12:49:32 UTC
Alessio Soldano <asoldano> updated the status of jira JBPAPP-8346 to Resolved

Comment 10 Marek Novotny 2012-04-11 08:25:45 UTC
Check if that is already fixed in EAP6

Comment 11 Marek Novotny 2012-04-11 08:26:08 UTC
Check if that is already fixed in EAP6 ER5

Comment 12 JBoss JIRA Server 2012-04-18 14:14:36 UTC
Karel Piwko <kpiwko> updated the status of jira JBPAPP-8346 to Closed

Comment 13 JBoss JIRA Server 2012-04-18 14:14:36 UTC
Karel Piwko <kpiwko> made a comment on jira JBPAPP-8346

Verified in WFK 2.0.0.ER4 and EAP 6.0.0.ER6 via

{code}
/opt/eap6/bin/wsprovide.sh -e -w -k -c `classpathgen /home/kpiwko/devel/wfk/wfk-qa/spring/demo/target/sportsclub/spring-3.1/sportsclub-invoicing-webmvc/target/sportsclub-invoicing-webmvc /home/kpiwko/devel/wfk/maven-local-repository/org/springframework/spring-web/3.1.1.RELEASE/ /home/kpiwko/devel/wfk/maven-local-repository/org/springframework/spring-beans/3.1.1.RELEASE/ /home/kpiwko/devel/wfk/maven-local-repository/javax/servlet/servlet-api/2.5/` -o jaxws-target -r jaxws-resources -s jaxws-sources org.jboss.snowdrop.samples.sportsclub.ws.PaymentNotificationService

{code}

Comment 14 Karel Piwko 2012-04-18 14:16:36 UTC
Verified in WFK ER4 and EAP ER5. Also, technical_note? flag flag was removed.

Comment 16 Rebecca Newton 2012-06-19 05:57:23 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1,2 +1 @@
-The Snowdrop module, which provides Spring for other modules, and its dependencies are not made available by default to other modules. This means some modules such as WSProvide cannot access them when needed. To workaround this issue, modify the Apache CXF module to access Snowdrop and its dependencies and make them part of the classpath for other modules that depend on it. To do this, add <module name="org.springframework.spring" slot="snowdrop" export="true"
+The Snowdrop module, which provides Spring for other modules, and its dependencies are not made available by default to other modules. This means some modules such as WSProvide cannot access them when needed. This issue is now fixed with the JBoss Web Framework Kit 2 GA release.-optional="true" /> to $JBOSS_HOME/modules/org/apache/cxf/main/module.xml.

Comment 18 Rebecca Newton 2012-06-19 07:12:49 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-The Snowdrop module, which provides Spring for other modules, and its dependencies are not made available by default to other modules. This means some modules such as WSProvide cannot access them when needed. This issue is now fixed with the JBoss Web Framework Kit 2 GA release.+The Snowdrop module, which provides Spring for other modules, and its dependencies are not made available by default to other modules. This means some modules such as WSProvide cannot access them when needed. This issue is now fixed with the JBoss Web Framework Kit 2 GA release, and the Snowdrop dependencies are available by default.

Comment 19 Karel Piwko 2012-09-24 14:56:04 UTC
Fixed in WFK 2.0.0.GA.