You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by Piotr Jagielski <pj...@o2.pl> on 2009/01/09 20:48:46 UTC

SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Hi all,

I'm trying to migrate existing services from 3.2.1 to 3.3.
While deploying SA on 3.3 NoClassDefFoundError occurs while instantiating
some IBatis references from xbean.xml - which doesn't happen on 3.2.1. I
have ibatis.jar in SU lib directory.

I searched through code and found some changes in AbstractXbeanDeployer in
3.3 :

ClassLoader classLoader = component.getClass().getClassLoader();
Thread.currentThread().setContextClassLoader(classLoader);
...
applicationContext.refresh();
su.setApplicationContext(applicationContext);
// Use SU classloader
Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
initApplicationContext(applicationContext);

So it looks like refresh() method is called with component's class loader
and classes from within SU jars are not loaded - and NoClassDefFound is
raised.
This problem is related to servicemix-jsr181, IBatis classes on
servicemix-camel are loaded without errors.

Any suggestions?

Regards,
Piotr
-- 
View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
If it's possible :
- to know which exact SMX version do you use (3.3 or 3.3.1 or another one) ?
- to have the whole source code

Regards
JB

On Tuesday 13 January 2009 - 13:53, Piotr Jagielski wrote:
> 
> Yes, I confirm both.
> I'll try to prepare tomorrow some test SA which reproduces this issue.
> 
> Regards,
> Piotr
> 
> 
> Jean-Baptiste Onofré wrote:
> > 
> > Hi Piotr,
> > 
> > Do you use standalone SMX (not deployed in a web container) ?
> > Do you confirm that the dependencies set is in the SU pom.xml (not the SA
> > one) ?
> > 
> > Regards
> > JB
> > 
> > 
> > On Tuesday 13 January 2009 - 01:26, Piotr Jagielski wrote:
> >> 
> >> Hello again,
> >> 
> >> I'll try to add some libraries to servicemix-shared as a workaround for
> >> this
> >> problem.
> >> Any other ideas?
> >> Should I raise jira issue for it?
> >> 
> >> Regards,
> >> Piotr
> >> 
> >> 
> >> Piotr Jagielski wrote:
> >> > 
> >> > Problematic fragment of xbean.xml is:
> >> > 
> >> >   <bean id="sqlMapClient"
> >> > class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
> >> >     <property name="configLocation"
> >> > value="classpath:ibatis/sqlmap-config.xml"/>
> >> >     <property name="dataSource" ref="dataSource"/>
> >> >   </bean>
> >> > 
> >> > And here are dependencies from pom.xml:
> >> > 
> >> >   <dependencies>
> >> >     <dependency>
> >> >       <groupId>org.springframework</groupId>
> >> >       <artifactId>spring-jdbc</artifactId>
> >> >     </dependency>    
> >> >     <dependency>
> >> >       <groupId>org.springframework</groupId>
> >> >       <artifactId>spring-orm</artifactId>
> >> >       <exclusions>
> >> >           <exclusion>
> >> >             <groupId>com.ibatis</groupId>
> >> >             <artifactId>ibatis2</artifactId>
> >> >           </exclusion>
> >> >       </exclusions>
> >> >     </dependency>
> >> >     <dependency>
> >> >         <groupId>org.apache.ibatis</groupId>
> >> >         <artifactId>ibatis-sqlmap</artifactId>
> >> >     </dependency>
> >> >     <dependency>
> >> >         <groupId>org.apache.cxf</groupId>
> >> >         <artifactId>cxf-rt-frontend-jaxws</artifactId>
> >> >         <scope>provided</scope>
> >> >     </dependency>
> >> >     <dependency>
> >> >         <groupId>org.apache.cxf</groupId>
> >> >         <artifactId>cxf-rt-transports-http</artifactId>
> >> >         <scope>provided</scope>
> >> >     </dependency>
> >> >     <dependency>
> >> >         <groupId>javax.xml.bind</groupId>
> >> >         <artifactId>jaxb-api</artifactId>
> >> >     </dependency>
> >> >     <dependency>
> >> >         <groupId>javax.xml.ws</groupId>
> >> >         <artifactId>jaxws-api</artifactId>
> >> >         <scope>provided</scope>
> >> >     </dependency>
> >> >     <!-- test dependencies -->
> >> >     <dependency>
> >> >         <groupId>junit</groupId>
> >> >         <artifactId>junit</artifactId>
> >> >         <version>4.4</version>
> >> >         <scope>test</scope>
> >> >     </dependency>
> >> >     <dependency>
> >> >         <groupId>ojdbc</groupId>
> >> >         <artifactId>ojdbc</artifactId>
> >> >         <version>14</version>
> >> >         <scope>test</scope>
> >> >     </dependency>
> >> >   </dependencies>
> >> > 
> >> > Regards
> >> > 
> >> > 
> >> > Jean-Baptiste Onofré wrote:
> >> >> 
> >> >> Can I have your SU's xbean.xml and pom.xml ?
> >> >> 
> >> >> Regards
> >> >> JB
> >> >> 
> >> >> On Friday 09 January 2009 - 13:04, Piotr Jagielski wrote:
> >> >>> 
> >> >>> Here is the stacktrace:
> >> >>> 
> >> >>> <loc-message>Unexpected exception parsing XML document from file
> >> >>>
> >> [/usr/local/java/apache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/ve
> >> >>>
> >> rsion_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
> >> >>> nested exception is java.lang.NoClassDefFoundError:
> >> >>> com/ibatis/sqlmap/client/SqlMapClient</loc-message>
> >> >>>                                        
> >> >>>
> >> <stack-trace><![CDATA[org.springframework.beans.factory.BeanDefinitionStoreException:
> >> >>> Unexpected exception parsing XML document from file
> >> [/usr/local/java/ap
> >> >>>
> >> ache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/version_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
> >> >>> nested exception is java.lang.NoClassDefFoundErr
> >> >>> or: com/ibatis/sqlmap/client/SqlMapClient
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.importBeanDefinitionResource(XBeanBeanDefinitionDocumentReader.java:129)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:95)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
> >> >>>         at
> >> >>>
> >> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.loadBeanDefinitions(FileSystemXmlApplicationContext.java:168)
> >> >>>         at
> >> >>>
> >> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
> >> >>>         at
> >> >>>
> >> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
> >> >>>         at
> >> >>>
> >> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:86)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:508)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:482)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateComponent(AutoDeploymentService.java:293)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:252)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:667)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:62)
> >> >>>         at
> >> >>>
> >> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:631)
> >> >>>         at java.util.TimerThread.mainLoop(Timer.java:512)
> >> >>>         at java.util.TimerThread.run(Timer.java:462)
> >> >>> Caused by: java.lang.NoClassDefFoundError:
> >> >>> com/ibatis/sqlmap/client/SqlMapClient
> >> >>>         at java.lang.Class.getDeclaredMethods0(Native Method)
> >> >>>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
> >> >>>         at java.lang.Class.getDeclaredMethods(Class.java:1791)
> >> >>>         at java.beans.Introspector$1.run(Introspector.java:1272)
> >> >>>         at java.security.AccessController.doPrivileged(Native Method)
> >> >>>         at
> >> >>>
> >> java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
> >> >>>         at
> >> >>> java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
> >> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:387)
> >> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
> >> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:220)
> >> >>>         at java.beans.Introspector.<init>(Introspector.java:368)
> >> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.getBeanInfo(XBeanQNameHelper.java:78)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.coerceNamespaceAwarePropertyValues(XBeanQNameHelper.java:54)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:59)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.processBeanDefinition(XBeanBeanDefinitionDocumentReader.java:174)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:101)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
> >> >>>         at
> >> >>>
> >> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
> >> >>>         at
> >> >>>
> >> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
> >> >>>         ... 32 more
> >> >>> Caused by: java.lang.ClassNotFoundException:
> >> >>> com.ibatis.sqlmap.client.SqlMapClient in classloader
> >> >>> com.ibatis.sqlmap.client.SqlMapClient
> >> >>>         at
> >> >>>
> >> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
> >> >>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> >> >>> 
> >> >>> As you can see the exception is java.lang.NoClassDefFoundError and it
> >> is
> >> >>> raised from ApplicationContext.refresh().
> >> >>> I have ibatis-sqlmap in my dependencies and it is included in SU's
> >> lib
> >> >>> derectory.
> >> >>> 
> >> >>> Regard
> >> >>> 
> >> >>> 
> >> >>> Jean-Baptiste Onofré wrote:
> >> >>> > 
> >> >>> > I understand Piotr.
> >> >>> > 
> >> >>> > Anyway, by default, if you have the dependency in the SU's pom.xml,
> >> >>> the
> >> >>> > jar is present
> >> >>> > in the SU classloader.
> >> >>> > For exemple, I have heavily used this behavior with CXF-SE to proxy
> >> >>> EJB
> >> >>> > and include 
> >> >>> > the EJB's stub in the SU.
> >> >>> > 
> >> >>> > Please, could you attach the raised exception (NoClassDefFound or
> >> >>> > ClassNotFound) ?
> >> >>> > 
> >> >>> > Thanks
> >> >>> > Regards
> >> >>> > JB
> >> >>> > 
> >> >>> > On Friday 09 January 2009 - 12:09, Piotr Jagielski wrote:
> >> >>> >> 
> >> >>> >> Hi Jean,
> >> >>> >> 
> >> >>> >> I tried adding classpath entry but it doesn't help. I also read in
> >> >>> >> http://servicemix.apache.org/classloaders.html that lib/*.jar are
> >> >>> added
> >> >>> >> to
> >> >>> >> SU'a classpath by default - is this correct?
> >> >>> >> 
> >> >>> >> Adding ibatis.jar to SMX lib directory of course helps, but I'd
> >> >>> prefer to
> >> >>> >> find some better solution. On 3.2.1 it was not necessary to do it.
> >> >>> >> 
> >> >>> >> Regards
> >> >>> >> 
> >> >>> >> 
> >> >>> >> Jean-Baptiste Onofré wrote:
> >> >>> >> > 
> >> >>> >> > Hi Piotr
> >> >>> >> > 
> >> >>> >> > Do you have ibatis dependency in the SU's pom.xml ?
> >> >>> >> > 
> >> >>> >> > Overwise, you can put :
> >> >>> >> > - ibatis.jar in the SMX lib directory (loaded by classworlds)
> >> >>> >> > - add a <classpath/> entry in the xbean.xml
> >> >>> >> > 
> >> >>> >> > Regards
> >> >>> >> > JB
> >> >>> >> > 
> >> >>> >> > 
> >> >>> >> > On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
> >> >>> >> >> 
> >> >>> >> >> Hi all,
> >> >>> >> >> 
> >> >>> >> >> I'm trying to migrate existing services from 3.2.1 to 3.3.
> >> >>> >> >> While deploying SA on 3.3 NoClassDefFoundError occurs while
> >> >>> >> instantiating
> >> >>> >> >> some IBatis references from xbean.xml - which doesn't happen on
> >> >>> 3.2.1.
> >> >>> >> I
> >> >>> >> >> have ibatis.jar in SU lib directory.
> >> >>> >> >> 
> >> >>> >> >> I searched through code and found some changes in
> >> >>> >> AbstractXbeanDeployer
> >> >>> >> >> in
> >> >>> >> >> 3.3 :
> >> >>> >> >> 
> >> >>> >> >> ClassLoader classLoader =
> >> component.getClass().getClassLoader();
> >> >>> >> >> Thread.currentThread().setContextClassLoader(classLoader);
> >> >>> >> >> ...
> >> >>> >> >> applicationContext.refresh();
> >> >>> >> >> su.setApplicationContext(applicationContext);
> >> >>> >> >> // Use SU classloader
> >> >>> >> >>
> >> >>> >>
> >> >>>
> >> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
> >> >>> >> >> initApplicationContext(applicationContext);
> >> >>> >> >> 
> >> >>> >> >> So it looks like refresh() method is called with component's
> >> class
> >> >>> >> loader
> >> >>> >> >> and classes from within SU jars are not loaded - and
> >> >>> NoClassDefFound
> >> >>> >> is
> >> >>> >> >> raised.
> >> >>> >> >> This problem is related to servicemix-jsr181, IBatis classes on
> >> >>> >> >> servicemix-camel are loaded without errors.
> >> >>> >> >> 
> >> >>> >> >> Any suggestions?
> >> >>> >> >> 
> >> >>> >> >> Regards,
> >> >>> >> >> Piotr
> >> >>> >> >> -- 
> >> >>> >> >> View this message in context:
> >> >>> >> >>
> >> >>> >>
> >> >>>
> >> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
> >> >>> >> >> Sent from the ServiceMix - User mailing list archive at
> >> >>> Nabble.com.
> >> >>> >> >> 
> >> >>> >> > 
> >> >>> >> > -- 
> >> >>> >> > Jean-Baptiste Onofré (Nanthrax)
> >> >>> >> > BuildProcess/AutoDeploy Project Leader
> >> >>> >> > http://buildprocess.sourceforge.net
> >> >>> >> > jb@nanthrax.net
> >> >>> >> > PGP : 17D4F086
> >> >>> >> > 
> >> >>> >> > 
> >> >>> >> 
> >> >>> >> -- 
> >> >>> >> View this message in context:
> >> >>> >>
> >> >>>
> >> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
> >> >>> >> Sent from the ServiceMix - User mailing list archive at
> >> Nabble.com.
> >> >>> >> 
> >> >>> > 
> >> >>> > -- 
> >> >>> > Jean-Baptiste Onofré (Nanthrax)
> >> >>> > BuildProcess/AutoDeploy Project Leader
> >> >>> > http://buildprocess.sourceforge.net
> >> >>> > jb@nanthrax.net
> >> >>> > PGP : 17D4F086
> >> >>> > 
> >> >>> > 
> >> >>> 
> >> >>> -- 
> >> >>> View this message in context:
> >> >>>
> >> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21380549.html
> >> >>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >>> 
> >> >> 
> >> >> -- 
> >> >> Jean-Baptiste Onofré (Nanthrax)
> >> >> BuildProcess/AutoDeploy Project Leader
> >> >> http://buildprocess.sourceforge.net
> >> >> jb@nanthrax.net
> >> >> PGP : 17D4F086
> >> >> 
> >> >> 
> >> > 
> >> > 
> >> 
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21432003.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> 
> > 
> > -- 
> > Jean-Baptiste Onofré (Nanthrax)
> > BuildProcess/AutoDeploy Project Leader
> > http://buildprocess.sourceforge.net
> > jb@nanthrax.net
> > PGP : 17D4F086
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21445306.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Piotr Jagielski <pj...@o2.pl>.
Yes, I confirm both.
I'll try to prepare tomorrow some test SA which reproduces this issue.

Regards,
Piotr


Jean-Baptiste Onofré wrote:
> 
> Hi Piotr,
> 
> Do you use standalone SMX (not deployed in a web container) ?
> Do you confirm that the dependencies set is in the SU pom.xml (not the SA
> one) ?
> 
> Regards
> JB
> 
> 
> On Tuesday 13 January 2009 - 01:26, Piotr Jagielski wrote:
>> 
>> Hello again,
>> 
>> I'll try to add some libraries to servicemix-shared as a workaround for
>> this
>> problem.
>> Any other ideas?
>> Should I raise jira issue for it?
>> 
>> Regards,
>> Piotr
>> 
>> 
>> Piotr Jagielski wrote:
>> > 
>> > Problematic fragment of xbean.xml is:
>> > 
>> >   <bean id="sqlMapClient"
>> > class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
>> >     <property name="configLocation"
>> > value="classpath:ibatis/sqlmap-config.xml"/>
>> >     <property name="dataSource" ref="dataSource"/>
>> >   </bean>
>> > 
>> > And here are dependencies from pom.xml:
>> > 
>> >   <dependencies>
>> >     <dependency>
>> >       <groupId>org.springframework</groupId>
>> >       <artifactId>spring-jdbc</artifactId>
>> >     </dependency>    
>> >     <dependency>
>> >       <groupId>org.springframework</groupId>
>> >       <artifactId>spring-orm</artifactId>
>> >       <exclusions>
>> >           <exclusion>
>> >             <groupId>com.ibatis</groupId>
>> >             <artifactId>ibatis2</artifactId>
>> >           </exclusion>
>> >       </exclusions>
>> >     </dependency>
>> >     <dependency>
>> >         <groupId>org.apache.ibatis</groupId>
>> >         <artifactId>ibatis-sqlmap</artifactId>
>> >     </dependency>
>> >     <dependency>
>> >         <groupId>org.apache.cxf</groupId>
>> >         <artifactId>cxf-rt-frontend-jaxws</artifactId>
>> >         <scope>provided</scope>
>> >     </dependency>
>> >     <dependency>
>> >         <groupId>org.apache.cxf</groupId>
>> >         <artifactId>cxf-rt-transports-http</artifactId>
>> >         <scope>provided</scope>
>> >     </dependency>
>> >     <dependency>
>> >         <groupId>javax.xml.bind</groupId>
>> >         <artifactId>jaxb-api</artifactId>
>> >     </dependency>
>> >     <dependency>
>> >         <groupId>javax.xml.ws</groupId>
>> >         <artifactId>jaxws-api</artifactId>
>> >         <scope>provided</scope>
>> >     </dependency>
>> >     <!-- test dependencies -->
>> >     <dependency>
>> >         <groupId>junit</groupId>
>> >         <artifactId>junit</artifactId>
>> >         <version>4.4</version>
>> >         <scope>test</scope>
>> >     </dependency>
>> >     <dependency>
>> >         <groupId>ojdbc</groupId>
>> >         <artifactId>ojdbc</artifactId>
>> >         <version>14</version>
>> >         <scope>test</scope>
>> >     </dependency>
>> >   </dependencies>
>> > 
>> > Regards
>> > 
>> > 
>> > Jean-Baptiste Onofré wrote:
>> >> 
>> >> Can I have your SU's xbean.xml and pom.xml ?
>> >> 
>> >> Regards
>> >> JB
>> >> 
>> >> On Friday 09 January 2009 - 13:04, Piotr Jagielski wrote:
>> >>> 
>> >>> Here is the stacktrace:
>> >>> 
>> >>> <loc-message>Unexpected exception parsing XML document from file
>> >>>
>> [/usr/local/java/apache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/ve
>> >>>
>> rsion_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
>> >>> nested exception is java.lang.NoClassDefFoundError:
>> >>> com/ibatis/sqlmap/client/SqlMapClient</loc-message>
>> >>>                                        
>> >>>
>> <stack-trace><![CDATA[org.springframework.beans.factory.BeanDefinitionStoreException:
>> >>> Unexpected exception parsing XML document from file
>> [/usr/local/java/ap
>> >>>
>> ache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/version_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
>> >>> nested exception is java.lang.NoClassDefFoundErr
>> >>> or: com/ibatis/sqlmap/client/SqlMapClient
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.importBeanDefinitionResource(XBeanBeanDefinitionDocumentReader.java:129)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:95)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
>> >>>         at
>> >>>
>> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.loadBeanDefinitions(FileSystemXmlApplicationContext.java:168)
>> >>>         at
>> >>>
>> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
>> >>>         at
>> >>>
>> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
>> >>>         at
>> >>>
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
>> >>>         at
>> >>>
>> org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:86)
>> >>>         at
>> >>>
>> org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
>> >>>         at
>> >>>
>> org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
>> >>>         at
>> >>>
>> org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:508)
>> >>>         at
>> >>>
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:482)
>> >>>         at
>> >>>
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateComponent(AutoDeploymentService.java:293)
>> >>>         at
>> >>>
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:252)
>> >>>         at
>> >>>
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:667)
>> >>>         at
>> >>>
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:62)
>> >>>         at
>> >>>
>> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:631)
>> >>>         at java.util.TimerThread.mainLoop(Timer.java:512)
>> >>>         at java.util.TimerThread.run(Timer.java:462)
>> >>> Caused by: java.lang.NoClassDefFoundError:
>> >>> com/ibatis/sqlmap/client/SqlMapClient
>> >>>         at java.lang.Class.getDeclaredMethods0(Native Method)
>> >>>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
>> >>>         at java.lang.Class.getDeclaredMethods(Class.java:1791)
>> >>>         at java.beans.Introspector$1.run(Introspector.java:1272)
>> >>>         at java.security.AccessController.doPrivileged(Native Method)
>> >>>         at
>> >>>
>> java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
>> >>>         at
>> >>> java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
>> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:387)
>> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
>> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:220)
>> >>>         at java.beans.Introspector.<init>(Introspector.java:368)
>> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.getBeanInfo(XBeanQNameHelper.java:78)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.coerceNamespaceAwarePropertyValues(XBeanQNameHelper.java:54)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:59)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.processBeanDefinition(XBeanBeanDefinitionDocumentReader.java:174)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:101)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>> >>>         at
>> >>>
>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
>> >>>         at
>> >>>
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>> >>>         ... 32 more
>> >>> Caused by: java.lang.ClassNotFoundException:
>> >>> com.ibatis.sqlmap.client.SqlMapClient in classloader
>> >>> com.ibatis.sqlmap.client.SqlMapClient
>> >>>         at
>> >>>
>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>> >>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>> >>> 
>> >>> As you can see the exception is java.lang.NoClassDefFoundError and it
>> is
>> >>> raised from ApplicationContext.refresh().
>> >>> I have ibatis-sqlmap in my dependencies and it is included in SU's
>> lib
>> >>> derectory.
>> >>> 
>> >>> Regard
>> >>> 
>> >>> 
>> >>> Jean-Baptiste Onofré wrote:
>> >>> > 
>> >>> > I understand Piotr.
>> >>> > 
>> >>> > Anyway, by default, if you have the dependency in the SU's pom.xml,
>> >>> the
>> >>> > jar is present
>> >>> > in the SU classloader.
>> >>> > For exemple, I have heavily used this behavior with CXF-SE to proxy
>> >>> EJB
>> >>> > and include 
>> >>> > the EJB's stub in the SU.
>> >>> > 
>> >>> > Please, could you attach the raised exception (NoClassDefFound or
>> >>> > ClassNotFound) ?
>> >>> > 
>> >>> > Thanks
>> >>> > Regards
>> >>> > JB
>> >>> > 
>> >>> > On Friday 09 January 2009 - 12:09, Piotr Jagielski wrote:
>> >>> >> 
>> >>> >> Hi Jean,
>> >>> >> 
>> >>> >> I tried adding classpath entry but it doesn't help. I also read in
>> >>> >> http://servicemix.apache.org/classloaders.html that lib/*.jar are
>> >>> added
>> >>> >> to
>> >>> >> SU'a classpath by default - is this correct?
>> >>> >> 
>> >>> >> Adding ibatis.jar to SMX lib directory of course helps, but I'd
>> >>> prefer to
>> >>> >> find some better solution. On 3.2.1 it was not necessary to do it.
>> >>> >> 
>> >>> >> Regards
>> >>> >> 
>> >>> >> 
>> >>> >> Jean-Baptiste Onofré wrote:
>> >>> >> > 
>> >>> >> > Hi Piotr
>> >>> >> > 
>> >>> >> > Do you have ibatis dependency in the SU's pom.xml ?
>> >>> >> > 
>> >>> >> > Overwise, you can put :
>> >>> >> > - ibatis.jar in the SMX lib directory (loaded by classworlds)
>> >>> >> > - add a <classpath/> entry in the xbean.xml
>> >>> >> > 
>> >>> >> > Regards
>> >>> >> > JB
>> >>> >> > 
>> >>> >> > 
>> >>> >> > On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
>> >>> >> >> 
>> >>> >> >> Hi all,
>> >>> >> >> 
>> >>> >> >> I'm trying to migrate existing services from 3.2.1 to 3.3.
>> >>> >> >> While deploying SA on 3.3 NoClassDefFoundError occurs while
>> >>> >> instantiating
>> >>> >> >> some IBatis references from xbean.xml - which doesn't happen on
>> >>> 3.2.1.
>> >>> >> I
>> >>> >> >> have ibatis.jar in SU lib directory.
>> >>> >> >> 
>> >>> >> >> I searched through code and found some changes in
>> >>> >> AbstractXbeanDeployer
>> >>> >> >> in
>> >>> >> >> 3.3 :
>> >>> >> >> 
>> >>> >> >> ClassLoader classLoader =
>> component.getClass().getClassLoader();
>> >>> >> >> Thread.currentThread().setContextClassLoader(classLoader);
>> >>> >> >> ...
>> >>> >> >> applicationContext.refresh();
>> >>> >> >> su.setApplicationContext(applicationContext);
>> >>> >> >> // Use SU classloader
>> >>> >> >>
>> >>> >>
>> >>>
>> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
>> >>> >> >> initApplicationContext(applicationContext);
>> >>> >> >> 
>> >>> >> >> So it looks like refresh() method is called with component's
>> class
>> >>> >> loader
>> >>> >> >> and classes from within SU jars are not loaded - and
>> >>> NoClassDefFound
>> >>> >> is
>> >>> >> >> raised.
>> >>> >> >> This problem is related to servicemix-jsr181, IBatis classes on
>> >>> >> >> servicemix-camel are loaded without errors.
>> >>> >> >> 
>> >>> >> >> Any suggestions?
>> >>> >> >> 
>> >>> >> >> Regards,
>> >>> >> >> Piotr
>> >>> >> >> -- 
>> >>> >> >> View this message in context:
>> >>> >> >>
>> >>> >>
>> >>>
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
>> >>> >> >> Sent from the ServiceMix - User mailing list archive at
>> >>> Nabble.com.
>> >>> >> >> 
>> >>> >> > 
>> >>> >> > -- 
>> >>> >> > Jean-Baptiste Onofré (Nanthrax)
>> >>> >> > BuildProcess/AutoDeploy Project Leader
>> >>> >> > http://buildprocess.sourceforge.net
>> >>> >> > jb@nanthrax.net
>> >>> >> > PGP : 17D4F086
>> >>> >> > 
>> >>> >> > 
>> >>> >> 
>> >>> >> -- 
>> >>> >> View this message in context:
>> >>> >>
>> >>>
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
>> >>> >> Sent from the ServiceMix - User mailing list archive at
>> Nabble.com.
>> >>> >> 
>> >>> > 
>> >>> > -- 
>> >>> > Jean-Baptiste Onofré (Nanthrax)
>> >>> > BuildProcess/AutoDeploy Project Leader
>> >>> > http://buildprocess.sourceforge.net
>> >>> > jb@nanthrax.net
>> >>> > PGP : 17D4F086
>> >>> > 
>> >>> > 
>> >>> 
>> >>> -- 
>> >>> View this message in context:
>> >>>
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21380549.html
>> >>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >>> 
>> >> 
>> >> -- 
>> >> Jean-Baptiste Onofré (Nanthrax)
>> >> BuildProcess/AutoDeploy Project Leader
>> >> http://buildprocess.sourceforge.net
>> >> jb@nanthrax.net
>> >> PGP : 17D4F086
>> >> 
>> >> 
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21432003.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
> 
> -- 
> Jean-Baptiste Onofré (Nanthrax)
> BuildProcess/AutoDeploy Project Leader
> http://buildprocess.sourceforge.net
> jb@nanthrax.net
> PGP : 17D4F086
> 
> 

-- 
View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21445306.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Piotr,

Do you use standalone SMX (not deployed in a web container) ?
Do you confirm that the dependencies set is in the SU pom.xml (not the SA one) ?

Regards
JB


On Tuesday 13 January 2009 - 01:26, Piotr Jagielski wrote:
> 
> Hello again,
> 
> I'll try to add some libraries to servicemix-shared as a workaround for this
> problem.
> Any other ideas?
> Should I raise jira issue for it?
> 
> Regards,
> Piotr
> 
> 
> Piotr Jagielski wrote:
> > 
> > Problematic fragment of xbean.xml is:
> > 
> >   <bean id="sqlMapClient"
> > class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
> >     <property name="configLocation"
> > value="classpath:ibatis/sqlmap-config.xml"/>
> >     <property name="dataSource" ref="dataSource"/>
> >   </bean>
> > 
> > And here are dependencies from pom.xml:
> > 
> >   <dependencies>
> >     <dependency>
> >       <groupId>org.springframework</groupId>
> >       <artifactId>spring-jdbc</artifactId>
> >     </dependency>    
> >     <dependency>
> >       <groupId>org.springframework</groupId>
> >       <artifactId>spring-orm</artifactId>
> >       <exclusions>
> >           <exclusion>
> >             <groupId>com.ibatis</groupId>
> >             <artifactId>ibatis2</artifactId>
> >           </exclusion>
> >       </exclusions>
> >     </dependency>
> >     <dependency>
> >         <groupId>org.apache.ibatis</groupId>
> >         <artifactId>ibatis-sqlmap</artifactId>
> >     </dependency>
> >     <dependency>
> >         <groupId>org.apache.cxf</groupId>
> >         <artifactId>cxf-rt-frontend-jaxws</artifactId>
> >         <scope>provided</scope>
> >     </dependency>
> >     <dependency>
> >         <groupId>org.apache.cxf</groupId>
> >         <artifactId>cxf-rt-transports-http</artifactId>
> >         <scope>provided</scope>
> >     </dependency>
> >     <dependency>
> >         <groupId>javax.xml.bind</groupId>
> >         <artifactId>jaxb-api</artifactId>
> >     </dependency>
> >     <dependency>
> >         <groupId>javax.xml.ws</groupId>
> >         <artifactId>jaxws-api</artifactId>
> >         <scope>provided</scope>
> >     </dependency>
> >     <!-- test dependencies -->
> >     <dependency>
> >         <groupId>junit</groupId>
> >         <artifactId>junit</artifactId>
> >         <version>4.4</version>
> >         <scope>test</scope>
> >     </dependency>
> >     <dependency>
> >         <groupId>ojdbc</groupId>
> >         <artifactId>ojdbc</artifactId>
> >         <version>14</version>
> >         <scope>test</scope>
> >     </dependency>
> >   </dependencies>
> > 
> > Regards
> > 
> > 
> > Jean-Baptiste Onofré wrote:
> >> 
> >> Can I have your SU's xbean.xml and pom.xml ?
> >> 
> >> Regards
> >> JB
> >> 
> >> On Friday 09 January 2009 - 13:04, Piotr Jagielski wrote:
> >>> 
> >>> Here is the stacktrace:
> >>> 
> >>> <loc-message>Unexpected exception parsing XML document from file
> >>> [/usr/local/java/apache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/ve
> >>> rsion_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
> >>> nested exception is java.lang.NoClassDefFoundError:
> >>> com/ibatis/sqlmap/client/SqlMapClient</loc-message>
> >>>                                        
> >>> <stack-trace><![CDATA[org.springframework.beans.factory.BeanDefinitionStoreException:
> >>> Unexpected exception parsing XML document from file [/usr/local/java/ap
> >>> ache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/version_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
> >>> nested exception is java.lang.NoClassDefFoundErr
> >>> or: com/ibatis/sqlmap/client/SqlMapClient
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
> >>>         at
> >>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.importBeanDefinitionResource(XBeanBeanDefinitionDocumentReader.java:129)
> >>>         at
> >>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:95)
> >>>         at
> >>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
> >>>         at
> >>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
> >>>         at
> >>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
> >>>         at
> >>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
> >>>         at
> >>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
> >>>         at
> >>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
> >>>         at
> >>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
> >>>         at
> >>> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
> >>>         at
> >>> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.loadBeanDefinitions(FileSystemXmlApplicationContext.java:168)
> >>>         at
> >>> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
> >>>         at
> >>> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
> >>>         at
> >>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
> >>>         at
> >>> org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:86)
> >>>         at
> >>> org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
> >>>         at
> >>> org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
> >>>         at
> >>> org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:508)
> >>>         at
> >>> org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:482)
> >>>         at
> >>> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateComponent(AutoDeploymentService.java:293)
> >>>         at
> >>> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:252)
> >>>         at
> >>> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:667)
> >>>         at
> >>> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:62)
> >>>         at
> >>> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:631)
> >>>         at java.util.TimerThread.mainLoop(Timer.java:512)
> >>>         at java.util.TimerThread.run(Timer.java:462)
> >>> Caused by: java.lang.NoClassDefFoundError:
> >>> com/ibatis/sqlmap/client/SqlMapClient
> >>>         at java.lang.Class.getDeclaredMethods0(Native Method)
> >>>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
> >>>         at java.lang.Class.getDeclaredMethods(Class.java:1791)
> >>>         at java.beans.Introspector$1.run(Introspector.java:1272)
> >>>         at java.security.AccessController.doPrivileged(Native Method)
> >>>         at
> >>> java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
> >>>         at
> >>> java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:387)
> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:220)
> >>>         at java.beans.Introspector.<init>(Introspector.java:368)
> >>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
> >>>         at
> >>> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.getBeanInfo(XBeanQNameHelper.java:78)
> >>>         at
> >>> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.coerceNamespaceAwarePropertyValues(XBeanQNameHelper.java:54)
> >>>         at
> >>> org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:59)
> >>>         at
> >>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)
> >>>         at
> >>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)
> >>>         at
> >>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.processBeanDefinition(XBeanBeanDefinitionDocumentReader.java:174)
> >>>         at
> >>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:101)
> >>>         at
> >>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
> >>>         at
> >>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
> >>>         at
> >>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
> >>>         at
> >>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
> >>>         ... 32 more
> >>> Caused by: java.lang.ClassNotFoundException:
> >>> com.ibatis.sqlmap.client.SqlMapClient in classloader
> >>> com.ibatis.sqlmap.client.SqlMapClient
> >>>         at
> >>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
> >>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> >>> 
> >>> As you can see the exception is java.lang.NoClassDefFoundError and it is
> >>> raised from ApplicationContext.refresh().
> >>> I have ibatis-sqlmap in my dependencies and it is included in SU's lib
> >>> derectory.
> >>> 
> >>> Regard
> >>> 
> >>> 
> >>> Jean-Baptiste Onofré wrote:
> >>> > 
> >>> > I understand Piotr.
> >>> > 
> >>> > Anyway, by default, if you have the dependency in the SU's pom.xml,
> >>> the
> >>> > jar is present
> >>> > in the SU classloader.
> >>> > For exemple, I have heavily used this behavior with CXF-SE to proxy
> >>> EJB
> >>> > and include 
> >>> > the EJB's stub in the SU.
> >>> > 
> >>> > Please, could you attach the raised exception (NoClassDefFound or
> >>> > ClassNotFound) ?
> >>> > 
> >>> > Thanks
> >>> > Regards
> >>> > JB
> >>> > 
> >>> > On Friday 09 January 2009 - 12:09, Piotr Jagielski wrote:
> >>> >> 
> >>> >> Hi Jean,
> >>> >> 
> >>> >> I tried adding classpath entry but it doesn't help. I also read in
> >>> >> http://servicemix.apache.org/classloaders.html that lib/*.jar are
> >>> added
> >>> >> to
> >>> >> SU'a classpath by default - is this correct?
> >>> >> 
> >>> >> Adding ibatis.jar to SMX lib directory of course helps, but I'd
> >>> prefer to
> >>> >> find some better solution. On 3.2.1 it was not necessary to do it.
> >>> >> 
> >>> >> Regards
> >>> >> 
> >>> >> 
> >>> >> Jean-Baptiste Onofré wrote:
> >>> >> > 
> >>> >> > Hi Piotr
> >>> >> > 
> >>> >> > Do you have ibatis dependency in the SU's pom.xml ?
> >>> >> > 
> >>> >> > Overwise, you can put :
> >>> >> > - ibatis.jar in the SMX lib directory (loaded by classworlds)
> >>> >> > - add a <classpath/> entry in the xbean.xml
> >>> >> > 
> >>> >> > Regards
> >>> >> > JB
> >>> >> > 
> >>> >> > 
> >>> >> > On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
> >>> >> >> 
> >>> >> >> Hi all,
> >>> >> >> 
> >>> >> >> I'm trying to migrate existing services from 3.2.1 to 3.3.
> >>> >> >> While deploying SA on 3.3 NoClassDefFoundError occurs while
> >>> >> instantiating
> >>> >> >> some IBatis references from xbean.xml - which doesn't happen on
> >>> 3.2.1.
> >>> >> I
> >>> >> >> have ibatis.jar in SU lib directory.
> >>> >> >> 
> >>> >> >> I searched through code and found some changes in
> >>> >> AbstractXbeanDeployer
> >>> >> >> in
> >>> >> >> 3.3 :
> >>> >> >> 
> >>> >> >> ClassLoader classLoader = component.getClass().getClassLoader();
> >>> >> >> Thread.currentThread().setContextClassLoader(classLoader);
> >>> >> >> ...
> >>> >> >> applicationContext.refresh();
> >>> >> >> su.setApplicationContext(applicationContext);
> >>> >> >> // Use SU classloader
> >>> >> >>
> >>> >>
> >>> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
> >>> >> >> initApplicationContext(applicationContext);
> >>> >> >> 
> >>> >> >> So it looks like refresh() method is called with component's class
> >>> >> loader
> >>> >> >> and classes from within SU jars are not loaded - and
> >>> NoClassDefFound
> >>> >> is
> >>> >> >> raised.
> >>> >> >> This problem is related to servicemix-jsr181, IBatis classes on
> >>> >> >> servicemix-camel are loaded without errors.
> >>> >> >> 
> >>> >> >> Any suggestions?
> >>> >> >> 
> >>> >> >> Regards,
> >>> >> >> Piotr
> >>> >> >> -- 
> >>> >> >> View this message in context:
> >>> >> >>
> >>> >>
> >>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
> >>> >> >> Sent from the ServiceMix - User mailing list archive at
> >>> Nabble.com.
> >>> >> >> 
> >>> >> > 
> >>> >> > -- 
> >>> >> > Jean-Baptiste Onofré (Nanthrax)
> >>> >> > BuildProcess/AutoDeploy Project Leader
> >>> >> > http://buildprocess.sourceforge.net
> >>> >> > jb@nanthrax.net
> >>> >> > PGP : 17D4F086
> >>> >> > 
> >>> >> > 
> >>> >> 
> >>> >> -- 
> >>> >> View this message in context:
> >>> >>
> >>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
> >>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>> >> 
> >>> > 
> >>> > -- 
> >>> > Jean-Baptiste Onofré (Nanthrax)
> >>> > BuildProcess/AutoDeploy Project Leader
> >>> > http://buildprocess.sourceforge.net
> >>> > jb@nanthrax.net
> >>> > PGP : 17D4F086
> >>> > 
> >>> > 
> >>> 
> >>> -- 
> >>> View this message in context:
> >>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21380549.html
> >>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >>> 
> >> 
> >> -- 
> >> Jean-Baptiste Onofré (Nanthrax)
> >> BuildProcess/AutoDeploy Project Leader
> >> http://buildprocess.sourceforge.net
> >> jb@nanthrax.net
> >> PGP : 17D4F086
> >> 
> >> 
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21432003.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Piotr Jagielski <pj...@o2.pl>.
Hello again,

I'll try to add some libraries to servicemix-shared as a workaround for this
problem.
Any other ideas?
Should I raise jira issue for it?

Regards,
Piotr


Piotr Jagielski wrote:
> 
> Problematic fragment of xbean.xml is:
> 
>   <bean id="sqlMapClient"
> class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
>     <property name="configLocation"
> value="classpath:ibatis/sqlmap-config.xml"/>
>     <property name="dataSource" ref="dataSource"/>
>   </bean>
> 
> And here are dependencies from pom.xml:
> 
>   <dependencies>
>     <dependency>
>       <groupId>org.springframework</groupId>
>       <artifactId>spring-jdbc</artifactId>
>     </dependency>    
>     <dependency>
>       <groupId>org.springframework</groupId>
>       <artifactId>spring-orm</artifactId>
>       <exclusions>
>           <exclusion>
>             <groupId>com.ibatis</groupId>
>             <artifactId>ibatis2</artifactId>
>           </exclusion>
>       </exclusions>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.ibatis</groupId>
>         <artifactId>ibatis-sqlmap</artifactId>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.cxf</groupId>
>         <artifactId>cxf-rt-frontend-jaxws</artifactId>
>         <scope>provided</scope>
>     </dependency>
>     <dependency>
>         <groupId>org.apache.cxf</groupId>
>         <artifactId>cxf-rt-transports-http</artifactId>
>         <scope>provided</scope>
>     </dependency>
>     <dependency>
>         <groupId>javax.xml.bind</groupId>
>         <artifactId>jaxb-api</artifactId>
>     </dependency>
>     <dependency>
>         <groupId>javax.xml.ws</groupId>
>         <artifactId>jaxws-api</artifactId>
>         <scope>provided</scope>
>     </dependency>
>     <!-- test dependencies -->
>     <dependency>
>         <groupId>junit</groupId>
>         <artifactId>junit</artifactId>
>         <version>4.4</version>
>         <scope>test</scope>
>     </dependency>
>     <dependency>
>         <groupId>ojdbc</groupId>
>         <artifactId>ojdbc</artifactId>
>         <version>14</version>
>         <scope>test</scope>
>     </dependency>
>   </dependencies>
> 
> Regards
> 
> 
> Jean-Baptiste Onofré wrote:
>> 
>> Can I have your SU's xbean.xml and pom.xml ?
>> 
>> Regards
>> JB
>> 
>> On Friday 09 January 2009 - 13:04, Piotr Jagielski wrote:
>>> 
>>> Here is the stacktrace:
>>> 
>>> <loc-message>Unexpected exception parsing XML document from file
>>> [/usr/local/java/apache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/ve
>>> rsion_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
>>> nested exception is java.lang.NoClassDefFoundError:
>>> com/ibatis/sqlmap/client/SqlMapClient</loc-message>
>>>                                        
>>> <stack-trace><![CDATA[org.springframework.beans.factory.BeanDefinitionStoreException:
>>> Unexpected exception parsing XML document from file [/usr/local/java/ap
>>> ache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/version_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
>>> nested exception is java.lang.NoClassDefFoundErr
>>> or: com/ibatis/sqlmap/client/SqlMapClient
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>>>         at
>>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.importBeanDefinitionResource(XBeanBeanDefinitionDocumentReader.java:129)
>>>         at
>>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:95)
>>>         at
>>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
>>>         at
>>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>>>         at
>>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>>>         at
>>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
>>>         at
>>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
>>>         at
>>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
>>>         at
>>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
>>>         at
>>> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
>>>         at
>>> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.loadBeanDefinitions(FileSystemXmlApplicationContext.java:168)
>>>         at
>>> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
>>>         at
>>> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
>>>         at
>>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
>>>         at
>>> org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:86)
>>>         at
>>> org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
>>>         at
>>> org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
>>>         at
>>> org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:508)
>>>         at
>>> org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:482)
>>>         at
>>> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateComponent(AutoDeploymentService.java:293)
>>>         at
>>> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:252)
>>>         at
>>> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:667)
>>>         at
>>> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:62)
>>>         at
>>> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:631)
>>>         at java.util.TimerThread.mainLoop(Timer.java:512)
>>>         at java.util.TimerThread.run(Timer.java:462)
>>> Caused by: java.lang.NoClassDefFoundError:
>>> com/ibatis/sqlmap/client/SqlMapClient
>>>         at java.lang.Class.getDeclaredMethods0(Native Method)
>>>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
>>>         at java.lang.Class.getDeclaredMethods(Class.java:1791)
>>>         at java.beans.Introspector$1.run(Introspector.java:1272)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at
>>> java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
>>>         at
>>> java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
>>>         at java.beans.Introspector.getBeanInfo(Introspector.java:387)
>>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
>>>         at java.beans.Introspector.getBeanInfo(Introspector.java:220)
>>>         at java.beans.Introspector.<init>(Introspector.java:368)
>>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
>>>         at
>>> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.getBeanInfo(XBeanQNameHelper.java:78)
>>>         at
>>> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.coerceNamespaceAwarePropertyValues(XBeanQNameHelper.java:54)
>>>         at
>>> org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:59)
>>>         at
>>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)
>>>         at
>>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)
>>>         at
>>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.processBeanDefinition(XBeanBeanDefinitionDocumentReader.java:174)
>>>         at
>>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:101)
>>>         at
>>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
>>>         at
>>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>>>         at
>>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
>>>         at
>>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>>>         ... 32 more
>>> Caused by: java.lang.ClassNotFoundException:
>>> com.ibatis.sqlmap.client.SqlMapClient in classloader
>>> com.ibatis.sqlmap.client.SqlMapClient
>>>         at
>>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>>> 
>>> As you can see the exception is java.lang.NoClassDefFoundError and it is
>>> raised from ApplicationContext.refresh().
>>> I have ibatis-sqlmap in my dependencies and it is included in SU's lib
>>> derectory.
>>> 
>>> Regard
>>> 
>>> 
>>> Jean-Baptiste Onofré wrote:
>>> > 
>>> > I understand Piotr.
>>> > 
>>> > Anyway, by default, if you have the dependency in the SU's pom.xml,
>>> the
>>> > jar is present
>>> > in the SU classloader.
>>> > For exemple, I have heavily used this behavior with CXF-SE to proxy
>>> EJB
>>> > and include 
>>> > the EJB's stub in the SU.
>>> > 
>>> > Please, could you attach the raised exception (NoClassDefFound or
>>> > ClassNotFound) ?
>>> > 
>>> > Thanks
>>> > Regards
>>> > JB
>>> > 
>>> > On Friday 09 January 2009 - 12:09, Piotr Jagielski wrote:
>>> >> 
>>> >> Hi Jean,
>>> >> 
>>> >> I tried adding classpath entry but it doesn't help. I also read in
>>> >> http://servicemix.apache.org/classloaders.html that lib/*.jar are
>>> added
>>> >> to
>>> >> SU'a classpath by default - is this correct?
>>> >> 
>>> >> Adding ibatis.jar to SMX lib directory of course helps, but I'd
>>> prefer to
>>> >> find some better solution. On 3.2.1 it was not necessary to do it.
>>> >> 
>>> >> Regards
>>> >> 
>>> >> 
>>> >> Jean-Baptiste Onofré wrote:
>>> >> > 
>>> >> > Hi Piotr
>>> >> > 
>>> >> > Do you have ibatis dependency in the SU's pom.xml ?
>>> >> > 
>>> >> > Overwise, you can put :
>>> >> > - ibatis.jar in the SMX lib directory (loaded by classworlds)
>>> >> > - add a <classpath/> entry in the xbean.xml
>>> >> > 
>>> >> > Regards
>>> >> > JB
>>> >> > 
>>> >> > 
>>> >> > On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
>>> >> >> 
>>> >> >> Hi all,
>>> >> >> 
>>> >> >> I'm trying to migrate existing services from 3.2.1 to 3.3.
>>> >> >> While deploying SA on 3.3 NoClassDefFoundError occurs while
>>> >> instantiating
>>> >> >> some IBatis references from xbean.xml - which doesn't happen on
>>> 3.2.1.
>>> >> I
>>> >> >> have ibatis.jar in SU lib directory.
>>> >> >> 
>>> >> >> I searched through code and found some changes in
>>> >> AbstractXbeanDeployer
>>> >> >> in
>>> >> >> 3.3 :
>>> >> >> 
>>> >> >> ClassLoader classLoader = component.getClass().getClassLoader();
>>> >> >> Thread.currentThread().setContextClassLoader(classLoader);
>>> >> >> ...
>>> >> >> applicationContext.refresh();
>>> >> >> su.setApplicationContext(applicationContext);
>>> >> >> // Use SU classloader
>>> >> >>
>>> >>
>>> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
>>> >> >> initApplicationContext(applicationContext);
>>> >> >> 
>>> >> >> So it looks like refresh() method is called with component's class
>>> >> loader
>>> >> >> and classes from within SU jars are not loaded - and
>>> NoClassDefFound
>>> >> is
>>> >> >> raised.
>>> >> >> This problem is related to servicemix-jsr181, IBatis classes on
>>> >> >> servicemix-camel are loaded without errors.
>>> >> >> 
>>> >> >> Any suggestions?
>>> >> >> 
>>> >> >> Regards,
>>> >> >> Piotr
>>> >> >> -- 
>>> >> >> View this message in context:
>>> >> >>
>>> >>
>>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
>>> >> >> Sent from the ServiceMix - User mailing list archive at
>>> Nabble.com.
>>> >> >> 
>>> >> > 
>>> >> > -- 
>>> >> > Jean-Baptiste Onofré (Nanthrax)
>>> >> > BuildProcess/AutoDeploy Project Leader
>>> >> > http://buildprocess.sourceforge.net
>>> >> > jb@nanthrax.net
>>> >> > PGP : 17D4F086
>>> >> > 
>>> >> > 
>>> >> 
>>> >> -- 
>>> >> View this message in context:
>>> >>
>>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
>>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>> >> 
>>> > 
>>> > -- 
>>> > Jean-Baptiste Onofré (Nanthrax)
>>> > BuildProcess/AutoDeploy Project Leader
>>> > http://buildprocess.sourceforge.net
>>> > jb@nanthrax.net
>>> > PGP : 17D4F086
>>> > 
>>> > 
>>> 
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21380549.html
>>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>>> 
>> 
>> -- 
>> Jean-Baptiste Onofré (Nanthrax)
>> BuildProcess/AutoDeploy Project Leader
>> http://buildprocess.sourceforge.net
>> jb@nanthrax.net
>> PGP : 17D4F086
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21432003.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Piotr Jagielski <pj...@o2.pl>.
Problematic fragment of xbean.xml is:

  <bean id="sqlMapClient"
class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
    <property name="configLocation"
value="classpath:ibatis/sqlmap-config.xml"/>
    <property name="dataSource" ref="dataSource"/>
  </bean>

And here are dependencies from pom.xml:

  <dependencies>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
    </dependency>    
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-orm</artifactId>
      <exclusions>
          <exclusion>
            <groupId>com.ibatis</groupId>
            <artifactId>ibatis2</artifactId>
          </exclusion>
      </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.ibatis</groupId>
        <artifactId>ibatis-sqlmap</artifactId>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.xml.bind</groupId>
        <artifactId>jaxb-api</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.xml.ws</groupId>
        <artifactId>jaxws-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <!-- test dependencies -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>ojdbc</groupId>
        <artifactId>ojdbc</artifactId>
        <version>14</version>
        <scope>test</scope>
    </dependency>
  </dependencies>

Regards


Jean-Baptiste Onofré wrote:
> 
> Can I have your SU's xbean.xml and pom.xml ?
> 
> Regards
> JB
> 
> On Friday 09 January 2009 - 13:04, Piotr Jagielski wrote:
>> 
>> Here is the stacktrace:
>> 
>> <loc-message>Unexpected exception parsing XML document from file
>> [/usr/local/java/apache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/ve
>> rsion_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
>> nested exception is java.lang.NoClassDefFoundError:
>> com/ibatis/sqlmap/client/SqlMapClient</loc-message>
>>                                        
>> <stack-trace><![CDATA[org.springframework.beans.factory.BeanDefinitionStoreException:
>> Unexpected exception parsing XML document from file [/usr/local/java/ap
>> ache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/version_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
>> nested exception is java.lang.NoClassDefFoundErr
>> or: com/ibatis/sqlmap/client/SqlMapClient
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>>         at
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.importBeanDefinitionResource(XBeanBeanDefinitionDocumentReader.java:129)
>>         at
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:95)
>>         at
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
>>         at
>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>>         at
>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
>>         at
>> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
>>         at
>> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
>>         at
>> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.loadBeanDefinitions(FileSystemXmlApplicationContext.java:168)
>>         at
>> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
>>         at
>> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
>>         at
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
>>         at
>> org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:86)
>>         at
>> org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
>>         at
>> org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
>>         at
>> org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:508)
>>         at
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:482)
>>         at
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateComponent(AutoDeploymentService.java:293)
>>         at
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:252)
>>         at
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:667)
>>         at
>> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:62)
>>         at
>> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:631)
>>         at java.util.TimerThread.mainLoop(Timer.java:512)
>>         at java.util.TimerThread.run(Timer.java:462)
>> Caused by: java.lang.NoClassDefFoundError:
>> com/ibatis/sqlmap/client/SqlMapClient
>>         at java.lang.Class.getDeclaredMethods0(Native Method)
>>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
>>         at java.lang.Class.getDeclaredMethods(Class.java:1791)
>>         at java.beans.Introspector$1.run(Introspector.java:1272)
>>         at java.security.AccessController.doPrivileged(Native Method)
>>         at
>> java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
>>         at
>> java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
>>         at java.beans.Introspector.getBeanInfo(Introspector.java:387)
>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
>>         at java.beans.Introspector.getBeanInfo(Introspector.java:220)
>>         at java.beans.Introspector.<init>(Introspector.java:368)
>>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
>>         at
>> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.getBeanInfo(XBeanQNameHelper.java:78)
>>         at
>> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.coerceNamespaceAwarePropertyValues(XBeanQNameHelper.java:54)
>>         at
>> org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:59)
>>         at
>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)
>>         at
>> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)
>>         at
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.processBeanDefinition(XBeanBeanDefinitionDocumentReader.java:174)
>>         at
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:101)
>>         at
>> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
>>         at
>> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>>         at
>> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
>>         at
>> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>>         ... 32 more
>> Caused by: java.lang.ClassNotFoundException:
>> com.ibatis.sqlmap.client.SqlMapClient in classloader
>> com.ibatis.sqlmap.client.SqlMapClient
>>         at
>> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
>> 
>> As you can see the exception is java.lang.NoClassDefFoundError and it is
>> raised from ApplicationContext.refresh().
>> I have ibatis-sqlmap in my dependencies and it is included in SU's lib
>> derectory.
>> 
>> Regard
>> 
>> 
>> Jean-Baptiste Onofré wrote:
>> > 
>> > I understand Piotr.
>> > 
>> > Anyway, by default, if you have the dependency in the SU's pom.xml, the
>> > jar is present
>> > in the SU classloader.
>> > For exemple, I have heavily used this behavior with CXF-SE to proxy EJB
>> > and include 
>> > the EJB's stub in the SU.
>> > 
>> > Please, could you attach the raised exception (NoClassDefFound or
>> > ClassNotFound) ?
>> > 
>> > Thanks
>> > Regards
>> > JB
>> > 
>> > On Friday 09 January 2009 - 12:09, Piotr Jagielski wrote:
>> >> 
>> >> Hi Jean,
>> >> 
>> >> I tried adding classpath entry but it doesn't help. I also read in
>> >> http://servicemix.apache.org/classloaders.html that lib/*.jar are
>> added
>> >> to
>> >> SU'a classpath by default - is this correct?
>> >> 
>> >> Adding ibatis.jar to SMX lib directory of course helps, but I'd prefer
>> to
>> >> find some better solution. On 3.2.1 it was not necessary to do it.
>> >> 
>> >> Regards
>> >> 
>> >> 
>> >> Jean-Baptiste Onofré wrote:
>> >> > 
>> >> > Hi Piotr
>> >> > 
>> >> > Do you have ibatis dependency in the SU's pom.xml ?
>> >> > 
>> >> > Overwise, you can put :
>> >> > - ibatis.jar in the SMX lib directory (loaded by classworlds)
>> >> > - add a <classpath/> entry in the xbean.xml
>> >> > 
>> >> > Regards
>> >> > JB
>> >> > 
>> >> > 
>> >> > On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
>> >> >> 
>> >> >> Hi all,
>> >> >> 
>> >> >> I'm trying to migrate existing services from 3.2.1 to 3.3.
>> >> >> While deploying SA on 3.3 NoClassDefFoundError occurs while
>> >> instantiating
>> >> >> some IBatis references from xbean.xml - which doesn't happen on
>> 3.2.1.
>> >> I
>> >> >> have ibatis.jar in SU lib directory.
>> >> >> 
>> >> >> I searched through code and found some changes in
>> >> AbstractXbeanDeployer
>> >> >> in
>> >> >> 3.3 :
>> >> >> 
>> >> >> ClassLoader classLoader = component.getClass().getClassLoader();
>> >> >> Thread.currentThread().setContextClassLoader(classLoader);
>> >> >> ...
>> >> >> applicationContext.refresh();
>> >> >> su.setApplicationContext(applicationContext);
>> >> >> // Use SU classloader
>> >> >>
>> >>
>> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
>> >> >> initApplicationContext(applicationContext);
>> >> >> 
>> >> >> So it looks like refresh() method is called with component's class
>> >> loader
>> >> >> and classes from within SU jars are not loaded - and
>> NoClassDefFound
>> >> is
>> >> >> raised.
>> >> >> This problem is related to servicemix-jsr181, IBatis classes on
>> >> >> servicemix-camel are loaded without errors.
>> >> >> 
>> >> >> Any suggestions?
>> >> >> 
>> >> >> Regards,
>> >> >> Piotr
>> >> >> -- 
>> >> >> View this message in context:
>> >> >>
>> >>
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
>> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> >> 
>> >> > 
>> >> > -- 
>> >> > Jean-Baptiste Onofré (Nanthrax)
>> >> > BuildProcess/AutoDeploy Project Leader
>> >> > http://buildprocess.sourceforge.net
>> >> > jb@nanthrax.net
>> >> > PGP : 17D4F086
>> >> > 
>> >> > 
>> >> 
>> >> -- 
>> >> View this message in context:
>> >>
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> 
>> > 
>> > -- 
>> > Jean-Baptiste Onofré (Nanthrax)
>> > BuildProcess/AutoDeploy Project Leader
>> > http://buildprocess.sourceforge.net
>> > jb@nanthrax.net
>> > PGP : 17D4F086
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21380549.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
> 
> -- 
> Jean-Baptiste Onofré (Nanthrax)
> BuildProcess/AutoDeploy Project Leader
> http://buildprocess.sourceforge.net
> jb@nanthrax.net
> PGP : 17D4F086
> 
> 

-- 
View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21387980.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Can I have your SU's xbean.xml and pom.xml ?

Regards
JB

On Friday 09 January 2009 - 13:04, Piotr Jagielski wrote:
> 
> Here is the stacktrace:
> 
> <loc-message>Unexpected exception parsing XML document from file
> [/usr/local/java/apache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/ve
> rsion_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
> nested exception is java.lang.NoClassDefFoundError:
> com/ibatis/sqlmap/client/SqlMapClient</loc-message>
>                                        
> <stack-trace><![CDATA[org.springframework.beans.factory.BeanDefinitionStoreException:
> Unexpected exception parsing XML document from file [/usr/local/java/ap
> ache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/version_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
> nested exception is java.lang.NoClassDefFoundErr
> or: com/ibatis/sqlmap/client/SqlMapClient
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>         at
> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.importBeanDefinitionResource(XBeanBeanDefinitionDocumentReader.java:129)
>         at
> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:95)
>         at
> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
>         at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>         at
> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
>         at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
>         at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
>         at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
>         at
> org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
>         at
> org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
>         at
> org.apache.xbean.spring.context.FileSystemXmlApplicationContext.loadBeanDefinitions(FileSystemXmlApplicationContext.java:168)
>         at
> org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
>         at
> org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
>         at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
>         at
> org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:86)
>         at
> org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
>         at
> org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
>         at
> org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:508)
>         at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:482)
>         at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateComponent(AutoDeploymentService.java:293)
>         at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:252)
>         at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:667)
>         at
> org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:62)
>         at
> org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:631)
>         at java.util.TimerThread.mainLoop(Timer.java:512)
>         at java.util.TimerThread.run(Timer.java:462)
> Caused by: java.lang.NoClassDefFoundError:
> com/ibatis/sqlmap/client/SqlMapClient
>         at java.lang.Class.getDeclaredMethods0(Native Method)
>         at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
>         at java.lang.Class.getDeclaredMethods(Class.java:1791)
>         at java.beans.Introspector$1.run(Introspector.java:1272)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
> java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
>         at
> java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
>         at java.beans.Introspector.getBeanInfo(Introspector.java:387)
>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
>         at java.beans.Introspector.getBeanInfo(Introspector.java:220)
>         at java.beans.Introspector.<init>(Introspector.java:368)
>         at java.beans.Introspector.getBeanInfo(Introspector.java:159)
>         at
> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.getBeanInfo(XBeanQNameHelper.java:78)
>         at
> org.apache.xbean.spring.context.v2c.XBeanQNameHelper.coerceNamespaceAwarePropertyValues(XBeanQNameHelper.java:54)
>         at
> org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:59)
>         at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)
>         at
> org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)
>         at
> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.processBeanDefinition(XBeanBeanDefinitionDocumentReader.java:174)
>         at
> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:101)
>         at
> org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
>         at
> org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
>         at
> org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
>         at
> org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
>         ... 32 more
> Caused by: java.lang.ClassNotFoundException:
> com.ibatis.sqlmap.client.SqlMapClient in classloader
> com.ibatis.sqlmap.client.SqlMapClient
>         at
> org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> 
> As you can see the exception is java.lang.NoClassDefFoundError and it is
> raised from ApplicationContext.refresh().
> I have ibatis-sqlmap in my dependencies and it is included in SU's lib
> derectory.
> 
> Regard
> 
> 
> Jean-Baptiste Onofré wrote:
> > 
> > I understand Piotr.
> > 
> > Anyway, by default, if you have the dependency in the SU's pom.xml, the
> > jar is present
> > in the SU classloader.
> > For exemple, I have heavily used this behavior with CXF-SE to proxy EJB
> > and include 
> > the EJB's stub in the SU.
> > 
> > Please, could you attach the raised exception (NoClassDefFound or
> > ClassNotFound) ?
> > 
> > Thanks
> > Regards
> > JB
> > 
> > On Friday 09 January 2009 - 12:09, Piotr Jagielski wrote:
> >> 
> >> Hi Jean,
> >> 
> >> I tried adding classpath entry but it doesn't help. I also read in
> >> http://servicemix.apache.org/classloaders.html that lib/*.jar are added
> >> to
> >> SU'a classpath by default - is this correct?
> >> 
> >> Adding ibatis.jar to SMX lib directory of course helps, but I'd prefer to
> >> find some better solution. On 3.2.1 it was not necessary to do it.
> >> 
> >> Regards
> >> 
> >> 
> >> Jean-Baptiste Onofré wrote:
> >> > 
> >> > Hi Piotr
> >> > 
> >> > Do you have ibatis dependency in the SU's pom.xml ?
> >> > 
> >> > Overwise, you can put :
> >> > - ibatis.jar in the SMX lib directory (loaded by classworlds)
> >> > - add a <classpath/> entry in the xbean.xml
> >> > 
> >> > Regards
> >> > JB
> >> > 
> >> > 
> >> > On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
> >> >> 
> >> >> Hi all,
> >> >> 
> >> >> I'm trying to migrate existing services from 3.2.1 to 3.3.
> >> >> While deploying SA on 3.3 NoClassDefFoundError occurs while
> >> instantiating
> >> >> some IBatis references from xbean.xml - which doesn't happen on 3.2.1.
> >> I
> >> >> have ibatis.jar in SU lib directory.
> >> >> 
> >> >> I searched through code and found some changes in
> >> AbstractXbeanDeployer
> >> >> in
> >> >> 3.3 :
> >> >> 
> >> >> ClassLoader classLoader = component.getClass().getClassLoader();
> >> >> Thread.currentThread().setContextClassLoader(classLoader);
> >> >> ...
> >> >> applicationContext.refresh();
> >> >> su.setApplicationContext(applicationContext);
> >> >> // Use SU classloader
> >> >>
> >> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
> >> >> initApplicationContext(applicationContext);
> >> >> 
> >> >> So it looks like refresh() method is called with component's class
> >> loader
> >> >> and classes from within SU jars are not loaded - and NoClassDefFound
> >> is
> >> >> raised.
> >> >> This problem is related to servicemix-jsr181, IBatis classes on
> >> >> servicemix-camel are loaded without errors.
> >> >> 
> >> >> Any suggestions?
> >> >> 
> >> >> Regards,
> >> >> Piotr
> >> >> -- 
> >> >> View this message in context:
> >> >>
> >> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
> >> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> >> 
> >> > 
> >> > -- 
> >> > Jean-Baptiste Onofré (Nanthrax)
> >> > BuildProcess/AutoDeploy Project Leader
> >> > http://buildprocess.sourceforge.net
> >> > jb@nanthrax.net
> >> > PGP : 17D4F086
> >> > 
> >> > 
> >> 
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> 
> > 
> > -- 
> > Jean-Baptiste Onofré (Nanthrax)
> > BuildProcess/AutoDeploy Project Leader
> > http://buildprocess.sourceforge.net
> > jb@nanthrax.net
> > PGP : 17D4F086
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21380549.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Piotr Jagielski <pj...@o2.pl>.
Here is the stacktrace:

<loc-message>Unexpected exception parsing XML document from file
[/usr/local/java/apache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/ve
rsion_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
nested exception is java.lang.NoClassDefFoundError:
com/ibatis/sqlmap/client/SqlMapClient</loc-message>
                                       
<stack-trace><![CDATA[org.springframework.beans.factory.BeanDefinitionStoreException:
Unexpected exception parsing XML document from file [/usr/local/java/ap
ache-servicemix-3.3/data/smx/service-assemblies/adapter-pc-PCService-1/version_1/sus/servicemix-jsr181/adapter-pc-jsr181-su/applicationContext.xml];
nested exception is java.lang.NoClassDefFoundErr
or: com/ibatis/sqlmap/client/SqlMapClient
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
        at
org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.importBeanDefinitionResource(XBeanBeanDefinitionDocumentReader.java:129)
        at
org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:95)
        at
org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
        at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
        at
org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
        at
org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
        at
org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
        at
org.apache.xbean.spring.context.FileSystemXmlApplicationContext.loadBeanDefinitions(FileSystemXmlApplicationContext.java:168)
        at
org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
        at
org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)
        at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)
        at
org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:86)
        at
org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)
        at
org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)
        at
org.apache.servicemix.jbi.framework.DeploymentService.deployServiceAssembly(DeploymentService.java:508)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.checkPendingSAs(AutoDeploymentService.java:482)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateComponent(AutoDeploymentService.java:293)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.updateArchive(AutoDeploymentService.java:252)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.monitorDirectory(AutoDeploymentService.java:667)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService.access$800(AutoDeploymentService.java:62)
        at
org.apache.servicemix.jbi.framework.AutoDeploymentService$1.run(AutoDeploymentService.java:631)
        at java.util.TimerThread.mainLoop(Timer.java:512)
        at java.util.TimerThread.run(Timer.java:462)
Caused by: java.lang.NoClassDefFoundError:
com/ibatis/sqlmap/client/SqlMapClient
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
        at java.lang.Class.getDeclaredMethods(Class.java:1791)
        at java.beans.Introspector$1.run(Introspector.java:1272)
        at java.security.AccessController.doPrivileged(Native Method)
        at
java.beans.Introspector.getPublicDeclaredMethods(Introspector.java:1270)
        at
java.beans.Introspector.getTargetMethodInfo(Introspector.java:1136)
        at java.beans.Introspector.getBeanInfo(Introspector.java:387)
        at java.beans.Introspector.getBeanInfo(Introspector.java:159)
        at java.beans.Introspector.getBeanInfo(Introspector.java:220)
        at java.beans.Introspector.<init>(Introspector.java:368)
        at java.beans.Introspector.getBeanInfo(Introspector.java:159)
        at
org.apache.xbean.spring.context.v2c.XBeanQNameHelper.getBeanInfo(XBeanQNameHelper.java:78)
        at
org.apache.xbean.spring.context.v2c.XBeanQNameHelper.coerceNamespaceAwarePropertyValues(XBeanQNameHelper.java:54)
        at
org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:59)
        at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)
        at
org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)
        at
org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.processBeanDefinition(XBeanBeanDefinitionDocumentReader.java:174)
        at
org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:101)
        at
org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)
        at
org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
        at
org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)
        at
org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
        ... 32 more
Caused by: java.lang.ClassNotFoundException:
com.ibatis.sqlmap.client.SqlMapClient in classloader
com.ibatis.sqlmap.client.SqlMapClient
        at
org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)

As you can see the exception is java.lang.NoClassDefFoundError and it is
raised from ApplicationContext.refresh().
I have ibatis-sqlmap in my dependencies and it is included in SU's lib
derectory.

Regard


Jean-Baptiste Onofré wrote:
> 
> I understand Piotr.
> 
> Anyway, by default, if you have the dependency in the SU's pom.xml, the
> jar is present
> in the SU classloader.
> For exemple, I have heavily used this behavior with CXF-SE to proxy EJB
> and include 
> the EJB's stub in the SU.
> 
> Please, could you attach the raised exception (NoClassDefFound or
> ClassNotFound) ?
> 
> Thanks
> Regards
> JB
> 
> On Friday 09 January 2009 - 12:09, Piotr Jagielski wrote:
>> 
>> Hi Jean,
>> 
>> I tried adding classpath entry but it doesn't help. I also read in
>> http://servicemix.apache.org/classloaders.html that lib/*.jar are added
>> to
>> SU'a classpath by default - is this correct?
>> 
>> Adding ibatis.jar to SMX lib directory of course helps, but I'd prefer to
>> find some better solution. On 3.2.1 it was not necessary to do it.
>> 
>> Regards
>> 
>> 
>> Jean-Baptiste Onofré wrote:
>> > 
>> > Hi Piotr
>> > 
>> > Do you have ibatis dependency in the SU's pom.xml ?
>> > 
>> > Overwise, you can put :
>> > - ibatis.jar in the SMX lib directory (loaded by classworlds)
>> > - add a <classpath/> entry in the xbean.xml
>> > 
>> > Regards
>> > JB
>> > 
>> > 
>> > On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
>> >> 
>> >> Hi all,
>> >> 
>> >> I'm trying to migrate existing services from 3.2.1 to 3.3.
>> >> While deploying SA on 3.3 NoClassDefFoundError occurs while
>> instantiating
>> >> some IBatis references from xbean.xml - which doesn't happen on 3.2.1.
>> I
>> >> have ibatis.jar in SU lib directory.
>> >> 
>> >> I searched through code and found some changes in
>> AbstractXbeanDeployer
>> >> in
>> >> 3.3 :
>> >> 
>> >> ClassLoader classLoader = component.getClass().getClassLoader();
>> >> Thread.currentThread().setContextClassLoader(classLoader);
>> >> ...
>> >> applicationContext.refresh();
>> >> su.setApplicationContext(applicationContext);
>> >> // Use SU classloader
>> >>
>> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
>> >> initApplicationContext(applicationContext);
>> >> 
>> >> So it looks like refresh() method is called with component's class
>> loader
>> >> and classes from within SU jars are not loaded - and NoClassDefFound
>> is
>> >> raised.
>> >> This problem is related to servicemix-jsr181, IBatis classes on
>> >> servicemix-camel are loaded without errors.
>> >> 
>> >> Any suggestions?
>> >> 
>> >> Regards,
>> >> Piotr
>> >> -- 
>> >> View this message in context:
>> >>
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
>> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> >> 
>> > 
>> > -- 
>> > Jean-Baptiste Onofré (Nanthrax)
>> > BuildProcess/AutoDeploy Project Leader
>> > http://buildprocess.sourceforge.net
>> > jb@nanthrax.net
>> > PGP : 17D4F086
>> > 
>> > 
>> 
>> -- 
>> View this message in context:
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
> 
> -- 
> Jean-Baptiste Onofré (Nanthrax)
> BuildProcess/AutoDeploy Project Leader
> http://buildprocess.sourceforge.net
> jb@nanthrax.net
> PGP : 17D4F086
> 
> 

-- 
View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21380549.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
I understand Piotr.

Anyway, by default, if you have the dependency in the SU's pom.xml, the jar is present
in the SU classloader.
For exemple, I have heavily used this behavior with CXF-SE to proxy EJB and include 
the EJB's stub in the SU.

Please, could you attach the raised exception (NoClassDefFound or ClassNotFound) ?

Thanks
Regards
JB

On Friday 09 January 2009 - 12:09, Piotr Jagielski wrote:
> 
> Hi Jean,
> 
> I tried adding classpath entry but it doesn't help. I also read in
> http://servicemix.apache.org/classloaders.html that lib/*.jar are added to
> SU'a classpath by default - is this correct?
> 
> Adding ibatis.jar to SMX lib directory of course helps, but I'd prefer to
> find some better solution. On 3.2.1 it was not necessary to do it.
> 
> Regards
> 
> 
> Jean-Baptiste Onofré wrote:
> > 
> > Hi Piotr
> > 
> > Do you have ibatis dependency in the SU's pom.xml ?
> > 
> > Overwise, you can put :
> > - ibatis.jar in the SMX lib directory (loaded by classworlds)
> > - add a <classpath/> entry in the xbean.xml
> > 
> > Regards
> > JB
> > 
> > 
> > On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
> >> 
> >> Hi all,
> >> 
> >> I'm trying to migrate existing services from 3.2.1 to 3.3.
> >> While deploying SA on 3.3 NoClassDefFoundError occurs while instantiating
> >> some IBatis references from xbean.xml - which doesn't happen on 3.2.1. I
> >> have ibatis.jar in SU lib directory.
> >> 
> >> I searched through code and found some changes in AbstractXbeanDeployer
> >> in
> >> 3.3 :
> >> 
> >> ClassLoader classLoader = component.getClass().getClassLoader();
> >> Thread.currentThread().setContextClassLoader(classLoader);
> >> ...
> >> applicationContext.refresh();
> >> su.setApplicationContext(applicationContext);
> >> // Use SU classloader
> >> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
> >> initApplicationContext(applicationContext);
> >> 
> >> So it looks like refresh() method is called with component's class loader
> >> and classes from within SU jars are not loaded - and NoClassDefFound is
> >> raised.
> >> This problem is related to servicemix-jsr181, IBatis classes on
> >> servicemix-camel are loaded without errors.
> >> 
> >> Any suggestions?
> >> 
> >> Regards,
> >> Piotr
> >> -- 
> >> View this message in context:
> >> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
> >> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> >> 
> > 
> > -- 
> > Jean-Baptiste Onofré (Nanthrax)
> > BuildProcess/AutoDeploy Project Leader
> > http://buildprocess.sourceforge.net
> > jb@nanthrax.net
> > PGP : 17D4F086
> > 
> > 
> 
> -- 
> View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086

Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Piotr Jagielski <pj...@o2.pl>.
Hi Jean,

I tried adding classpath entry but it doesn't help. I also read in
http://servicemix.apache.org/classloaders.html that lib/*.jar are added to
SU'a classpath by default - is this correct?

Adding ibatis.jar to SMX lib directory of course helps, but I'd prefer to
find some better solution. On 3.2.1 it was not necessary to do it.

Regards


Jean-Baptiste Onofré wrote:
> 
> Hi Piotr
> 
> Do you have ibatis dependency in the SU's pom.xml ?
> 
> Overwise, you can put :
> - ibatis.jar in the SMX lib directory (loaded by classworlds)
> - add a <classpath/> entry in the xbean.xml
> 
> Regards
> JB
> 
> 
> On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
>> 
>> Hi all,
>> 
>> I'm trying to migrate existing services from 3.2.1 to 3.3.
>> While deploying SA on 3.3 NoClassDefFoundError occurs while instantiating
>> some IBatis references from xbean.xml - which doesn't happen on 3.2.1. I
>> have ibatis.jar in SU lib directory.
>> 
>> I searched through code and found some changes in AbstractXbeanDeployer
>> in
>> 3.3 :
>> 
>> ClassLoader classLoader = component.getClass().getClassLoader();
>> Thread.currentThread().setContextClassLoader(classLoader);
>> ...
>> applicationContext.refresh();
>> su.setApplicationContext(applicationContext);
>> // Use SU classloader
>> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
>> initApplicationContext(applicationContext);
>> 
>> So it looks like refresh() method is called with component's class loader
>> and classes from within SU jars are not loaded - and NoClassDefFound is
>> raised.
>> This problem is related to servicemix-jsr181, IBatis classes on
>> servicemix-camel are loaded without errors.
>> 
>> Any suggestions?
>> 
>> Regards,
>> Piotr
>> -- 
>> View this message in context:
>> http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
>> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>> 
> 
> -- 
> Jean-Baptiste Onofré (Nanthrax)
> BuildProcess/AutoDeploy Project Leader
> http://buildprocess.sourceforge.net
> jb@nanthrax.net
> PGP : 17D4F086
> 
> 

-- 
View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379692.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: SU deployed on servicemix-jsr181-2008.01 couldn't find classes from jars included in SU lib directory

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Piotr

Do you have ibatis dependency in the SU's pom.xml ?

Overwise, you can put :
- ibatis.jar in the SMX lib directory (loaded by classworlds)
- add a <classpath/> entry in the xbean.xml

Regards
JB


On Friday 09 January 2009 - 11:48, Piotr Jagielski wrote:
> 
> Hi all,
> 
> I'm trying to migrate existing services from 3.2.1 to 3.3.
> While deploying SA on 3.3 NoClassDefFoundError occurs while instantiating
> some IBatis references from xbean.xml - which doesn't happen on 3.2.1. I
> have ibatis.jar in SU lib directory.
> 
> I searched through code and found some changes in AbstractXbeanDeployer in
> 3.3 :
> 
> ClassLoader classLoader = component.getClass().getClassLoader();
> Thread.currentThread().setContextClassLoader(classLoader);
> ...
> applicationContext.refresh();
> su.setApplicationContext(applicationContext);
> // Use SU classloader
> Thread.currentThread().setContextClassLoader(su.getConfigurationClassLoader());
> initApplicationContext(applicationContext);
> 
> So it looks like refresh() method is called with component's class loader
> and classes from within SU jars are not loaded - and NoClassDefFound is
> raised.
> This problem is related to servicemix-jsr181, IBatis classes on
> servicemix-camel are loaded without errors.
> 
> Any suggestions?
> 
> Regards,
> Piotr
> -- 
> View this message in context: http://www.nabble.com/SU-deployed-on-servicemix-jsr181-2008.01-couldn%27t-find-classes-from-jars-included-in-SU-lib-directory-tp21379285p21379285.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
> 

-- 
Jean-Baptiste Onofré (Nanthrax)
BuildProcess/AutoDeploy Project Leader
http://buildprocess.sourceforge.net
jb@nanthrax.net
PGP : 17D4F086