You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by shamik <sh...@gmail.com> on 2014/01/17 06:40:58 UTC

Dreaded java.lang.LinkageError

Hi,

  I'm struggling with the dreaded java.lang.LinkageError. Here's what I'm
trying to do. Bundle A consists of a class TestA which is calling a method
in class TestB, hosted in Bundle B. As part of the method call, TestA is
passing a Solrj class (org.apache.solr.common.SolrInputDocument) to TestB.
Here's the pom configuration.

Bundle B pom
==========

<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.0.1</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Export-Package>com.test.solr.api;version=1.1.0,
							org.apache.solr.common.*,
							org.apache.solr.client,
							org.apache.solr.client.solrj;
						</Export-Package>
						<Import-Package>
							com.test.model.*;version="[1.0.0,2.0.0)",
							*;resolution:=optional
						</Import-Package>
					
<Embed-Dependency>solr-solrj,zookeeper,httpcore,httpmime,httpclient,commons-collections,commons-lang,commons-collections,commons-io,commons-logging;scope=compile|runtime</Embed-Dependency>
						<Embed-Transitive>true</Embed-Transitive>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Version>${project.version}</Bundle-Version>
						<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
						<Include-Resource>
							{maven-resources}, {maven-dependencies}
						</Include-Resource>
					</instructions>
				</configuration>
			</plugin>


Bundle A pom
==========

<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.0.1</version>
				<extensions>true</extensions>
				<configuration>
					<instructions>
						<Export-Package>com.test.postprocess.api;version="[1.0.0,2.0.0)",
						</Export-Package>
						<Import-Package>com.test.solr.api;version="[1.0.0,2.0.0)",
							javax.jws,
							javax.wsdl,
							javax.xml.bind,
							javax.xml.bind.annotation,
							javax.xml.namespace,
							javax.xml.ws,
							META-INF.cxf,
							META-INF.cxf.osgi,
							org.apache.cxf.bus,
							org.apache.cxf.bus.spring,
							org.apache.cxf.bus.resource,
							org.apache.cxf.configuration.spring,
							org.apache.cxf.resource,
							org.apache.cxf.jaxws,
							org.apache.cxf.transport.http,
							!org.jvnet.staxex,
							!org.relaxng.datatype,
							!com.sun.javadoc,
							!com.caucho.burlap.*,
							org.apache.solr.*,
							org.w3c.dom,
							org.apache.xpath.jaxp,
							*;resolution:=optional
						</Import-Package>						
					
<Embed-Dependency>commons-codec,xstream,commons-io,httpcore,httpclient,httpmime;scope=compile|runtime</Embed-Dependency>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
						<Bundle-Version>${project.version}</Bundle-Version>
						<Bundle-ClassPath>.,{maven-dependencies}</Bundle-ClassPath>
						<Include-Resource>
							{maven-resources}, {maven-dependencies}
						</Include-Resource>
					</instructions>
				</configuration>
			</plugin>

As you can see, I'm exporting org.apache.solr.common.*,
org.apache.solr.client and 				org.apache.solr.client.solrj package in
bundle B, which is being imported in bundle A.

But I'm getting the following runtime exception.

 java.lang.LinkageError: loader constraint violation: loader (instance of
org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) previously
initiated loading for a different type with name
"org/apache/solr/common/SolrInputDocument"

Not sure what I'm missing. I'm using servicemix 4.4.0.

Any pointer will be highly appreciated.

-Thanks,
Shamik




--
View this message in context: http://servicemix.396122.n5.nabble.com/Dreaded-java-lang-LinkageError-tp5718754.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.