Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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 ?

 

 

Labels (4)
9 Replies
Anonymous
Not applicable
Author

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 0683p000009MACn.png

Anonymous
Not applicable
Author

Hello,

Have you tried to exclude JAR files from the ClassPath?

 

Best regards

Sabrina

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

Hello,

Are you using talend subscription solution?

Best regards

Sabrina

Anonymous
Not applicable
Author

yes enterprise edition of esb
Anonymous
Not applicable
Author

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

Anonymous
Not applicable
Author

Hi

It is talend ESB  6.2.1 

 

Thanks

Ashish