You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by HART <ha...@live.com> on 2010/12/08 05:21:13 UTC

Shared Library Problems

Hi SMX Users,

I have an issue with shared library at which I am completely lost: I created
a shared lib SU and deployed to SMX 4.2, no problem there. Then I created a
bean SU that uses the SL, so I added the SL to its xbean.xml using
<classpath>, and packed it into a SA. It was deployed without any problem.
However, whenever I send a message which triggers the bean SU, it stops at
the line where SL is referred, and complains about the class not defined. If
I removed the class/jar from the SL, the bean SU will not be deployed at all
(with compile errors).

Does anyone have any idea why the compiling and deploy of the bean SU is
successful, but not the runtime?

Here is the error:

22:44:48,007 | ERROR | ix-bean-thread-3 | BeanComponent                    |
icemix.common.AsyncBaseLifeCycle  480 | Error processing exchange
org.apache.servicemix.jbi.runtime.impl.InOnlyImpl@22d1f4
java.lang.NoClassDefFoundError: com/example/service/DocumentService
	at bmf.snm.beans.su.MyBean.onMessageExchange(MyBean.java:37)
	at
org.apache.servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java:230)
	at org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:217)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java:581)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
	at
org.apache.servicemix.common.AsyncBaseLifeCycle$2.run(AsyncBaseLifeCycle.java:347)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
	at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException:
com.example.service.DocumentService in classloader
org.apache.xbean.spring.context.FileSystemXmlApplicationContext@e543fa
	at
org.apache.xbean.classloader.MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
	... 10 more
-- 
View this message in context: http://servicemix.396122.n5.nabble.com/Shared-Library-Problems-tp3296911p3296911.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Shared Library Problems

Posted by gumba <an...@gmail.com>.
hi I need your help, I have to integrate activiti and servicemix-camel in my
project, I got this example from Servicemix 4.3.0 examples folder, when I
had the camelBehaviour I got the following error:

Caused by: java.lang.ClassNotFoundException:
org.activiti.camel.CamelBehaviour in classloader
org.apache.xbean.spring.context.FileSystemXmlApplicationContext@7b3bf06d

I added the <classpath/> as below then it says:
Caused by: java.lang.IllegalStateException: No such shared library:
osgi:camel-core-1.4.0

My Camel-context.xml file

<bean id="camel" class="org.activiti.camel.CamelBehaviour">
  		<classpath> 
   			<library>osgi:camel-core-2.6.0</library> 
		</classpath>
    	<constructor-arg index="0">
      		<list>
        		<bean class="org.activiti.camel.SimpleContextProvider">
          			<constructor-arg index="0" value="helloCamelProcess" />
          			<constructor-arg index="1" ref="camelProcess" />
        		</bean>
      		</list>
    	</constructor-arg>
  	</bean>

      <camelContext id="camelProcess"
xmlns="http://camel.apache.org/schema/spring">
            <route>
          <from
uri="jbi:endpoint:http://servicemix.apache.org/samples/bridge/pipeline/endpoint"/>
              <to uri="xslt:bridge.xslt"/>
              <to uri="log:org.apache.servicemix.example?level=INFO"/>
              <to
uri="jbi:endpoint:http://servicemix.apache.org/samples/bridge/jms/endpoint"/>
            </route>
      </camelContext>


My Camel-SU pom.xml

  <properties>
        <componentName>servicemix-camel</componentName>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.servicemix.tooling</groupId>
                <artifactId>jbi-maven-plugin</artifactId>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
    
    <repositories>
		<repository>
			<id>nexus</id>
			<url>http://maven.alfresco.com/nexus/content/groups/public</url>
		</repository>
		<repository>
			<id>Activiti</id>
			<url>http://maven.alfresco.com/nexus/content/repositories/activiti</url>
		</repository>
	</repositories>

	<dependencies>
		<dependency>
			<groupId>org.activiti</groupId>
			<artifactId>activiti-camel</artifactId>
			<version>5.9</version>
		</dependency>
		<dependency>
			<groupId>org.apache.servicemix</groupId>
			<artifactId>servicemix-camel</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.camel</groupId>
			<artifactId>camel-core</artifactId>
			<version>1.4.0</version>
		</dependency>
		<dependency>
                <groupId>org.activiti</groupId>
                <artifactId>activiti-osgi</artifactId>
                <version>5.9</version>
            </dependency>

            <dependency>
                <groupId>org.activiti</groupId>
                <artifactId>activiti-engine</artifactId>
                <version>5.9</version>
            </dependency>
	</dependencies>

What am I doing wrong? I am new with maven so please be as clear as possible
with the answers.

-----
Gumba
--
View this message in context: http://servicemix.396122.n5.nabble.com/Shared-Library-Problems-tp3296911p5713857.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Shared Library Problems

Posted by HART <ha...@live.com>.
I was able to resolve this problem by using OSGi when deploying the bundle.
-- 
View this message in context: http://servicemix.396122.n5.nabble.com/Shared-Library-Problems-tp3296911p3346356.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Shared Library Problems

Posted by HART <ha...@live.com>.
Hi Freeman,

Thanks for your reply! Actually I do have this in the xbean.xml, otherwise,
deployment will give me a compile error.

Here is my SL pom file:
<?xml version="1.0" encoding="UTF-8"?><project>
  <parent>
    <artifactId>bmf.example.parent</artifactId>
    <groupId>com.example</groupId>
    <version>1.0</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>bmf.example.common.libraries</artifactId>
  <packaging>jbi-shared-library</packaging>
  <name>Apache ServiceMix :: Shared Library</name>
  <version>1.0</version>
  <build>
    <defaultGoal>install</defaultGoal>
    <plugins>
      <plugin>
        <groupId>org.apache.servicemix.tooling</groupId>
        <artifactId>jbi-maven-plugin</artifactId>
        <version>4.3</version>
        <extensions>true</extensions>
      </plugin>
      <plugin>
      	<groupId>org.apache.maven.plugins</groupId>
      	<artifactId>maven-install-plugin</artifactId>
      	<version>2.3.1</version>
      	<executions>
      		<execution>
      			<id>IMF</id>
      			<phase>validate</phase>
      			<goals>
      				<goal>install-file</goal>
      			</goals>
      			<configuration>
                    <file>${basedir}/imf.jar</file>
                    <groupId>example</groupId>
                    <artifactId>imf</artifactId>
                    <version>1.0</version>
                    <packaging>jar</packaging>
                 </configuration>
      		</execution>
      		<execution>
      			<id>jacc</id>
      			<phase>validate</phase>
      			<goals>
      				<goal>install-file</goal>
      			</goals>
      			<configuration>
                    <file>${basedir}/jacc-1.0.jar</file>
                    <groupId>javax.security</groupId>
                    <artifactId>jacc</artifactId>
                    <version>1.0</version>
                    <packaging>jar</packaging>
                </configuration>
      		</execution>
      	</executions>
      </plugin>
    </plugins>
  </build>
  <repositories>
  </repositories>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.7</version>
      <scope>test</scope>
    </dependency>
    <dependency>
    	<groupId>example</groupId>
    	<artifactId>imf</artifactId>
    	<version>1.0</version>
    </dependency>
    <dependency>
    	<groupId>hibernate</groupId>
    	<artifactId>hibernate</artifactId>
    	<version>3.0</version>
    	<type>jar</type>
    	<scope>compile</scope>
    </dependency>
    <dependency>
    	<groupId>javax.security</groupId>
    	<artifactId>jacc</artifactId>
    	<version>1.0</version>
    </dependency>
  </dependencies>
</project>

Here is my bean SU pom:

<beans ...>
     <bean:endpoint service="example:MyBeanService1" endpoint="bean"
bean="#myBean1"/>
     ...
     <bean id="myBean1" class="bmf.example.bean.su.MyBean"/>
     <classpath><library>osgi:com.example.service</library></classpath>
</beans>


Anything wrong?

Hart
-- 
View this message in context: http://servicemix.396122.n5.nabble.com/Shared-Library-Problems-tp3296911p3297919.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: Shared Library Problems

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

How about you add like

<classpath>
   <library>osgi:<bundle symbolic name></library>
</classpath>

also in your xbean.xml?

More details take a look at [1], "New in ServiceMix 4.2.0" part
[1]http://servicemix.apache.org/classloaders.html

Freeman
On 2010-12-8, at 下午12:21, HART wrote:

>
> Hi SMX Users,
>
> I have an issue with shared library at which I am completely lost: I  
> created
> a shared lib SU and deployed to SMX 4.2, no problem there. Then I  
> created a
> bean SU that uses the SL, so I added the SL to its xbean.xml using
> <classpath>, and packed it into a SA. It was deployed without any  
> problem.
> However, whenever I send a message which triggers the bean SU, it  
> stops at
> the line where SL is referred, and complains about the class not  
> defined. If
> I removed the class/jar from the SL, the bean SU will not be  
> deployed at all
> (with compile errors).
>
> Does anyone have any idea why the compiling and deploy of the bean  
> SU is
> successful, but not the runtime?
>
> Here is the error:
>
> 22:44:48,007 | ERROR | ix-bean-thread-3 |  
> BeanComponent                    |
> icemix.common.AsyncBaseLifeCycle  480 | Error processing exchange
> org.apache.servicemix.jbi.runtime.impl.InOnlyImpl@22d1f4
> java.lang.NoClassDefFoundError: com/example/service/DocumentService
> 	at bmf.snm.beans.su.MyBean.onMessageExchange(MyBean.java:37)
> 	at
> org 
> .apache 
> .servicemix.bean.BeanEndpoint.onProviderExchange(BeanEndpoint.java: 
> 230)
> 	at  
> org.apache.servicemix.bean.BeanEndpoint.process(BeanEndpoint.java:217)
> 	at
> org 
> .apache 
> .servicemix 
> .common.AsyncBaseLifeCycle.doProcess(AsyncBaseLifeCycle.java:627)
> 	at
> org 
> .apache 
> .servicemix 
> .common.AsyncBaseLifeCycle.processExchange(AsyncBaseLifeCycle.java: 
> 581)
> 	at
> org 
> .apache 
> .servicemix 
> .common 
> .AsyncBaseLifeCycle.processExchangeInTx(AsyncBaseLifeCycle.java:478)
> 	at
> org.apache.servicemix.common.AsyncBaseLifeCycle 
> $2.run(AsyncBaseLifeCycle.java:347)
> 	at
> java.util.concurrent.ThreadPoolExecutor 
> $Worker.runTask(ThreadPoolExecutor.java:886)
> 	at
> java.util.concurrent.ThreadPoolExecutor 
> $Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.ClassNotFoundException:
> com.example.service.DocumentService in classloader
> org.apache.xbean.spring.context.FileSystemXmlApplicationContext@e543fa
> 	at
> org 
> .apache 
> .xbean 
> .classloader 
> .MultiParentClassLoader.loadClass(MultiParentClassLoader.java:206)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
> 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> 	... 10 more
> -- 
> View this message in context: http://servicemix.396122.n5.nabble.com/Shared-Library-Problems-tp3296911p3296911.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


-- 
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org