NoClassDefFoundError in Osgi w/ Felix, ant - java

After a lot of work migrating our code to another & fixing all the manifests and the bundles,
when I try to run the applet on the server I get many errors like this one:
java.lang.NoClassDefFoundError: org/jitsi/service/configuration/ConfigurationService
at net.java.sip.communicator.service.resources.AbstractResourcesService.<init>(AbstractResourcesService.java:127)
at net.java.sip.communicator.impl.resources.ResourceManagementServiceImpl.<init>(ResourceManagementServiceImpl.java:48)
at net.java.sip.communicator.impl.resources.ResourceManagementActivator.start(ResourceManagementActivator.java:36)
at org.apache.felix.framework.util.SecureAction$Actions.run(SecureAction.java:1243)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:620)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1904)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1822)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1192)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:266)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.jitsi.service.configuration.ConfigurationService not found by [12515]
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(Unknown Source)
at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:670)
at org.apache.felix.framework.resolver.WireImpl.getClass(WireImpl.java:102)
at org.apache.felix.framework.ModuleImpl.searchImports(ModuleImpl.java:1426)
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:747)
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(Unknown Source)
All the bundles are getting resolved properly, and even when I tried to get some code out of the external jar into our code, it still threw me that error, I know that's a problem in Felix that I need to fix, but I don't know where can I start, all the bundles starting in their proper time...
I'm building the app with ant/Felix.
Maybe it's a problem with the activator?
Thanks for all the help, love to hear some opinions...

Your bundle is using the class org.jitsi.service.configuration.ConfigurationService but it doesn't import the package. Make sure that org.jitsi.service.configuration is listed in the Import-Package header in your bundle's manifest.

Related

Java Class Not Found While Debugging and Running JavaFx Eclipse Project

I have been reading through SO and several pages of google links, tried all of the approaches there but I cannot get my project running any more.
I am developing a small app and i decided to persist some data in JSON. I downloaded javax.json-api-1.1.jar and javax.json-api-1.1-sources.jar. Eclipse finds the jar file, I can import it, intellisense works, etc. Sadly, when running or debugging I get the following error as soon as the first JSON related line is executed:
Caused by: javax.json.JsonException: Provider org.glassfish.json.JsonProviderImpl not found
at javax.json.spi.JsonProvider.provider(JsonProvider.java:99)
at javax.json.Json.createObjectBuilder(Json.java:299)
at tabumaker.view.ChordManagementViewController.handleAddChordSaveBtnOnAction(ChordManagementViewController.java:214)
... 62 more
Caused by: java.lang.ClassNotFoundException: org.glassfish.json.JsonProviderImpl
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.json.spi.JsonProvider.provider(JsonProvider.java:96)
... 64 more
I put both jar files within my workspace and linked them in my eclipse project the following way:
Source attached to jar file:
Source-Lookup-Path set in project:
Source-Lookup-Path:
I really have no idea why it doesn't work. Eclipse has all information to find the API and the corresponding sources within those two jar files.

Create a jar file using jdev that includes weblogic.jar

I've been having troubles lately in creating a jar file that can call a secured web service on Weblogic server using Jdev.
I've created a web service proxy which is handling the situation perfectly. My goal is to deploy this web service as a jar file so that I can use it in my other projects as a simple library.
I was able to deploy the project as a jar file, which in turn allowed me to use it's different methods to connect to the web service.
However, when I run the web service client on eclipse I get an error:
Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/xml/crypto/wss/provider/CredentialProvider
at WebServiceCaller.callGetCardDetailJar(WebServiceCaller.java:55)
at WebServiceCaller.main(WebServiceCaller.java:29)
Caused by: java.lang.ClassNotFoundException: weblogic.xml.crypto.wss.provider.CredentialProvider
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
The problem may be fixed by finding the weblogic.jar file and including it in the eclipse build path, but is there a way to deploy a jar file with all the library dependencies included in it ?
There is a way to create a wlfullclient.jar (see oracle doc http://docs.oracle.com/cd/E13222_01/wls/docs103/client/jarbuilder.html ), but your class is not in it, it's rather in oracle.webservices.standalone.client.jar or in wls-api.jar or in weblogic.jar... it's rather confusing, I think Oracle never managed to simplify this jar dependency problem, actually in earlier versions of WebLogic things were a lot simpler!

BIRT NoClassDefFoundError

I have been searching the web for a while now and no solutions found have been working out for me. So, I turn to you.
I get a java.lang.NoClassDefFoundError when I try to integrate the API of BIRT (an eclipse plugin for reports and documents). I copy paste their code, include ALL of the jar file in the lib folder (birt-runtime-4_2_2\ReportEngine\lib) and still I get the NoClassDefFoundError. What am I doing wrong? I cant find any useful information on their page. Furthermore, I have tried out a couple of other source codes, yet I still get the same problem. So i would argue that the imports of the jar-files might be faulty. But I cannot for the love of God find the fault is.
The code I have copy pasted (just to try out) is found here:
http://wiki.eclipse.org/Java_-_Simple_Design_Engine_API_%28BIRT%29
The complete error message is this:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Platform
at org.eclipse.birt.core.framework.jar.ServicePlatform.getExtensionRegistry(ServicePlatform.java:72)
at org.eclipse.birt.core.framework.jar.ServicePlatform.createFactoryObject(ServicePlatform.java:98)
at org.eclipse.birt.core.framework.Platform$1.run(Platform.java:297)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.birt.core.framework.Platform.createFactoryObject(Platform.java:293)
at org.eclipse.birt.report.model.api.DesignEngine.<init>(DesignEngine.java:90)
at org.eclipse.birt.report.model.api.DesignEngine.newSession(DesignEngine.java:142)
at standard.Main.main(Main.java:36)
Caused by: java.lang.ClassNotFoundException: org.eclipse.core.runtime.Platform
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more
Except from Birt's jar files you will also have to copy some extra jars from Birt Runtime to Tomcat's WEB-INF folder.
Download Birt Runtime from the following link: http://download.eclipse.org/birt/downloads/
In Birt Runtime you will find a folder called ReportEngine. In this folder there is a lib folder. Just copy it to your WEB-INF folder.
I had a similar problem and it worked for me. Take a look at my problem: NoClassDefFoundError for Birt Class EngineException

Java: java.lang.NoClassDefFoundError: org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager

I created a webservice using servlet and Tomcat 6.0.
I created a java project in eclipse to call that webservice using HTTP.
I added the following jar files
1. httpcore-4.0
2. httpclient-4.0
but while running the project im getting the following error.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager.<init>(ThreadSafeClientConnManager.java:75)
at WSCall.HttpUtilities.GetServerResponse(HttpUtilities.java:52)
at WSCall.ServiceCall.main(ServiceCall.java:16)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 3 more
Please help me to find the solution.
You still have to add common-logging dependency under your classpath. However, you may continue encounter other simaliar Exceptions due to lack other dependency. I suggest you use maven to manage the dependency so that you don't have to mannualy add dependencies to your classpath.
It seems your project doesn't contain the Apache Commons Logging library. Adding it to your classpath should do the trick.
This is caused by the missing of commons-logging.jar.To fix it, download the commons logging library and add it to your project.

Java/eclipse/hibernate

I'm a .net dev, usually do this using nhibernate and can work with that fine. I'm doing a project which needs to be written in Java and have the following issue:
All I have so far is a blank java project setup in eclipse. I have C:\work\lib\java\cp\hibernate3.jar in the Referenced Libraries node in the package explorer.
in my code (main) i'm doing this
Configuration config = new Configuration().
setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect").
setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver").
setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:RefenceDb").
setProperty("hibernate.connection.username", "sa").
setProperty("hibernate.connection.password", "").
setProperty("hibernate.connection.pool_size", "1").
setProperty("hibernate.connection.autocommit", "true").
setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider").
setProperty("hibernate.hbm2ddl.auto", "create-drop").
setProperty("hibernate.show_sql", "true").
addClass(Boy.class);
and in the consol i have:
Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at ReferenceApplication.Main.main(Main.java:15)
Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 1 more
any ideas?
the path C:\work\lib\java\cp\ is in the classpath
w://
While the other answers here referencing dom4j are correct, you will soon find there a dozen or so other dependencies.
Starting from total scratch is a noble pursuit, but I would actually recommend giving yourself a head start by installing Maven (for dependency management) and running mvn archetype:generate from the command line. If you're doing a web application (which you may not be based on the question text) selecting "maven-archetype-j2ee-simple" or "maven-archetype-webapp" would be a pretty good kickstart. Doing so will set up a project for you that can then be used in eclipse (you could even use m2eclipse plugin to do dependency management from within eclipse).
It will turn out that Maven has a learning curve of its own, but my opinion is that the benefits outweigh the costs.
Good luck!
Download dom4j and put it on your classpath (in the referenced libraries tab)
From the stack trace, it looks like you're missing dom4j.jar. Hibernate (for Java) has a ton of dependencies. Make sure that you have all of Hibernates required dependencies added to your Eclipse project.
You need to put the dom4j jar on your classpath. You should be able to get it here:
http://www.dom4j.org/download.html
I think that hibernate uses version 1.6.1
To make all this easier, I would quickly learn Maven and then use the m2eclipse plugin.
I know it's a learning curve, but it will make everything massively easier at deploy time.

Categories

Resources