Six Stars

Exclude dependent jar from osgi bundle through maven setting in talend 6

Hi 

I have two  jobs with sap component connection and sap input when I am exporting as osgi bundle and putting it in karaf container its giving error with sapjco.dll already loaded in another classloader. java.library.path .

 

I checked the bundles and found that both bundle contains sapjco.jar which is tring load sapjco.dll two times in a container and failing.

 

I removed sapjco.jar manually from both bundle  and placed jar in karaf/lib folder and it was started working

 

we have some automated setup through cmdline for building jobs so i can not do manual removal work

 

I found in project settings we can configure to exclude jar from build but its not happening

 

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>@ItemGroupName@</groupId>
<artifactId>@ItemName@-bundle</artifactId>
<version>@ItemVersion@</version>
<packaging>bundle</packaging>

<properties>
<item.name>@ItemName@</item.name>
<item.project.name>@ItemProjectName@</item.project.name>

<bundle.config.export.package>@BundleConfigExportPackage@</bundle.config.export.package>
<bundle.config.import.package>@BundleConfigImportPackage@</bundle.config.import.package>
<bundle.config.export.service>@BundleConfigExportService@</bundle.config.export.service>
<bundle.config.bundle.classpath>@BundleConfigBundleClasspath@</bundle.config.bundle.classpath>

<resources.path>${basedir}/src/main/resources</resources.path>
<lib.path>${resources.path}/lib</lib.path>
<provided.lib.path>${resources.path}/provided-lib</provided.lib.path>
</properties>

<dependencies>
<!-- Will add some dependencies by API -->
</dependencies>

<build>
<resources>
<resource>
<directory>${resources.path}</directory>
<excludes>
<!-- Exclude the "provided" libs -->
<exclude>lib/sapjco.jar</exclude>
</excludes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
</archive>
<instructions>
<Bundle-SymbolicName>${project.groupId}</Bundle-SymbolicName>
<Bundle-Name>${item.name}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Export-Package>${bundle.config.export.package}</Export-Package>
<Export-Service>${bundle.config.export.service}</Export-Service>
<Import-Package>
${bundle.config.import.package},
*;resolution:=optional
</Import-Package>
<Include-Resource>
{maven-resources}, {maven-dependencies},
</Include-Resource>
<Bundle-ClassPath>
${bundle.config.bundle.classpath}
</Bundle-ClassPath>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>

 

Is I am missing something ?

 

 

9 REPLIES
Six Stars

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

Wasted whole weekend to figure out how i can exclude jar from classpath through modifying projectsetting-->build-->osgi .maven pom settings

 

Now i have a feeling its not using this settings at all.

Also i tried updating pom.xml by adding dependency scope to provided by going workspace-->projectname-->pom.xml and tring to make build through studio again this pom.xml file reverting back to original pom.xml

 

Couldn't find anything on help documentation

 

Is any one has any info or link. I am tired with this Smiley Happy

Moderator

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

Hello,

Have you tried to exclude JAR files from the ClassPath?

 

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

Hi Sabrina,

 

Thanks for reply !

 

My main is goal is to remove jar from class path of bundle and place that jar in karaf/lib so that it can be share by two bundle  and i can avoid class loader error ( I have two different bundles with same jar dependency class loader gives error sapjco3.dll already loaded in another classloader)

 

 I am not aware of how I can remove it from class path.Could you please provide details of that.

 

Thanks
Ashish

Moderator

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

Hello,

We don't do it before. We will make an investigation on your issue and then come back to you as soon as we can.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

Hi Sabrina,

I am blocked in moving my code from dev to qa because of same issue.

Do you have any findings for me .

Thanks
Ashish
Moderator

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

Hello,

Are you using talend subscription solution?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Six Stars

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

yes enterprise edition of esb
Employee

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

Can you confirm which version is that exactly ? and are you using Talend DI or Route for Sap stuff ? 

Six Stars

Re: Exclude dependent jar from osgi bundle through maven setting in talend 6

Hi

It is talend ESB  6.2.1 

 

Thanks

Ashish