I'm still having trouble building a bundle app to work appropriately. When our bundle app runs, following a certain execution branch gets a NoClassDefFoundError for the java class (javax.net.ssl.SSLSocketFactory) (see below). Our bundle app (ENViz) uses ftp4j (a 3rd party library) which uses javax.net.ssl.SSLSocketFactory. To include ftp4j in our app, I made a simple wrapper using mvn install:install-file. To resolve import packages for our bundle, I used the maven-bundle-plugin using:
<Import-Package>*;resolution:=optional</Import-Package>
I'm also using the maven-shade-plugin to package up the extra, non bundle libraries our app uses.
So why is the javax class not available to link to when running? What should I do to fix this and avoid it in the future? Thanks!
Error
java.lang.NoClassDefFoundError: javax/net/ssl/SSLSocketFactory
at it.sauronsoftware.ftp4j.FTPClient.<init>(FTPClient.java:178)
at com.agilent.labs.enviz.utils.InternetDataDownloader.configFTP(InternetDataDownloader.java:349)
at com.agilent.labs.enviz.utils.InternetDataDownloader.performFTPDownload(InternetDataDownloader.java:201)
at com.agilent.labs.enviz.utils.InternetDataDownloader.downloadURLContent(InternetDataDownloader.java:188)
at com.agilent.labs.enviz.utils.InternetDataDownloader.ensureLocalUpdatedData(InternetDataDownloader.java:115)
at com.agilent.labs.enviz.visualization.go.InternetNCBIGODataDataDownloader.<init>(InternetNCBIGODataDataDownloader.java:41)
at com.agilent.labs.enviz.visualization.go.GeneGOData$Gene2GoDataReader.<init>(GeneGOData.java:276)
at com.agilent.labs.enviz.visualization.go.GeneGOData$Gene2GoDataReader.<init>(GeneGOData.java:243)
at com.agilent.labs.enviz.visualization.go.GeneGOData.basicReadData(GeneGOData.java:126)
at com.agilent.labs.enviz.visualization.go.GeneGOData.readData(GeneGOData.java:97)
at com.agilent.labs.enviz.visualization.go.CreateGOAnnotationsTask.run(CreateGOAnnotationsTask.java:126)
at org.cytoscape.work.internal.task.JDialogTaskManager$TaskRunnable.innerRun(JDialogTaskManager.java:321)
at org.cytoscape.work.internal.task.JDialogTaskManager$TaskRunnable.run(JDialogTaskManager.java:350)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.ClassNotFoundException: javax.net.ssl.SSLSocketFactory not found by com.agilent.labs.enviz.ENViz [170]
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:812)
at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1807)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 18 more
--
You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.
To post to this group, send email to cytoscape...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-helpdesk.
For more options, visit https://groups.google.com/d/optout.
Thanks Tim. We just used mvn install:install-file to put ftp4j in the local repository. That's not a bundle, is it? The other strange thing is that the dependency is just standard java classes which we've never had to specify for other import packages.
We don't use Embed Dependencies. Here's the maven-bundle-plugin and maven-shade-plugin instructions we use:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Bundle-Version>${project.version}</Bundle-Version>
<Private-Package>${bundle.namespace}.*,org.cytoscape.utils</Private-Package>
<Export-Package>!${bundle.namespace}.*,!org.cytoscape.utils</Export-Package>
<Bundle-Activator>${bundle.namespace}.${project.artifactId}</Bundle-Activator>
<Cytoscape-API-Compatibility>${cytoscape.api.version}</Cytoscape-API-Compatibility>
<Import-Package>*;resolution:=optional</Import-Package>
</instructions>
</configuration>
</plugin>
<!-- Build a jar containing all the ENViz dependencies: -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</plugin>
With a dependency on ftp4j of:
<dependency>
<groupId>it.sauronsoftware</groupId>
<artifactId>ftp4j</artifactId>
<version>1.7.2</version>
</dependency>
Is there anything obviously wrong with this?
Tim, you deserve a prize!!
With just a few changes from what you sent me, I got things working!
For your edification, here are the changes I made to get it working:
1) Added ';inline=true' to the Embed-Dependency to directly add the classes versus adding a bunch of jars to the final uber jar file.
2) Removed '!*log4j;' in Embed-Dependency to stop the plugin including every single dependency (it seems to cause <scope>provided</scope> statements to be ignored).
2) Removed <Embed-Transitive>true</Embed-Transitive> to stop strange errors about missing MANIFEST files for dependency packages.
Once again, thanks for saving me Tim!!