Exception thrown due missing class though jar is in classpath, REST - JERSEY - java

I'm using Jersey for REST apps, i'm getting this NoClassDefException for the class AbstractRuntimeDelegate
though i have the following Jars in my classpath....
commons-httpclient-3.1.jar
List item
javax.ws.rs.jar
jersey-core-1.9.1-sources.jar
jersey-server-1.1.2-ea.jar
That class is in the jersey-core-1.9.1-sources.jar as i can see from here
http://www.jarvana.com/jarvana/inspect/com/sun/jersey/jersey-core/1.9.1/jersey-core-1.9.1-sources.jar?folder=com/sun/jersey/core/spi/factory/
Have you ever had this kind of issue?
Any advice?
Thank you
Piece of exception:
Exception in thread "bq-main" java.lang.NoClassDefFoundError: com/sun/jersey/core/spi/factory/AbstractRuntimeDelegate
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)

I think you should use jersey-core-1.9.1.jar instead of its source jar.

Related

Using JDBC Meta Data Processor of StreamSets 3.8 in StreamSets Version 2.5

There's a need for my team to use old version of StreamSet, version 2.5. But there is some important processors in version 3.8 we want to include in the old environment, namely the JDBC Meta Data Processor.
What have been done is below:
Create a sample custom processor project with StreamSets version 2.5.1.1
mvn archetype:generate -DarchetypeGroupId=com.streamsets -DarchetypeArtifactId=streamsets-datacollector-stage-lib-tutorial -DarchetypeVersion=2.5.1.1 -DinteractiveMode=true
Modify the code based on JDBC Meta Data classes in StreamSets 3.8, with reference library in POM to StreamSets 3.8:
2.1 streamsets-datacollector-api
2.2 streamsets-datacollector-jdbc-protolib
Package and upload the customized jar to external library of StreamSets UI.
Upload the dependency jars to StreamSets UI:
4.1 streamsets-datacollector-api-3.8.jar
4.2 streamsets-datacollector-jdbc-protolib-3.8.jar
Everything is find except that once I uploaded
streamsets-datacollector-jdbc-protolib-3.8.jar
and restart StreamSets, there's error in the log:
java.lang.NoClassDefFoundError: com/streamsets/pipeline/api/base/configurablestage/DPushSource
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
at com.streamsets.pipeline.BlackListURLClassLoader.findClass(BlackListURLClassLoader.java:77)
at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:341)
at com.streamsets.pipeline.SDCClassLoader.loadClass(SDCClassLoader.java:323)
at com.streamsets.datacollector.stagelibrary.ClassLoaderStageLibraryTask.loadStages(ClassLoaderStageLibraryTask.java:325)
at com.streamsets.datacollector.stagelibrary.ClassLoaderStageLibraryTask.initTask(ClassLoaderStageLibraryTask.java:192)
at com.streamsets.datacollector.task.AbstractTask.init(AbstractTask.java:66)
at com.streamsets.datacollector.task.CompositeTask.initTask(CompositeTask.java:48)
at com.streamsets.datacollector.task.AbstractTask.init(AbstractTask.java:66)
at com.streamsets.datacollector.task.TaskWrapper.init(TaskWrapper.java:44)
at com.streamsets.datacollector.main.Main$1.run(Main.java:101)
at com.streamsets.datacollector.main.Main$1.run(Main.java:98)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at com.streamsets.datacollector.main.Main.doMain(Main.java:98)
at com.streamsets.datacollector.main.DataCollectorMain.main(DataCollectorMain.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.streamsets.pipeline.BootstrapMain.main(BootstrapMain.java:308)
I noticed this class exists in API-3.8 jar and the class in API-2.5 exists but with a different package path,
API-3.8
com/streamsets/pipeline/api/base/configurablestage/DPushSource
API-2.5
com/streamsets/pipeline/configurablestage/DPushSource
Any hints I am missing to make it work? Thanks.
Needless to say, there are many fixes and enhancements since StreamSets Data Collector 2.5.0, and I would strongly recommend you upgrade.
Having said that, since DPushSource is specific to the origin, and you're focused on a processor, the easiest way forward is to simply remove the JDBC origin. Delete everything under jdbc-protolib/src/main/java/com/streamsets/pipeline/stage/origin/jdbc and try again.

Spring java.lang.NoClassDefFoundError

I'm totally a newbie in springs so I wanted to try a helloworld program in springs. I came across this tutorial.
I downloaded the source code with library provided on this site, I have the latest Spring STS installed on my Eclipse Kepler. I got this error :
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.context.support.AbstractApplicationContext.(AbstractApplicationContext.java:153)
at org.springframework.context.support.AbstractApplicationContext.(AbstractApplicationContext.java:217)
at org.springframework.context.support.AbstractRefreshableApplicationContext.(AbstractRefreshableApplicationContext.java:88)
at org.springframework.context.support.AbstractRefreshableConfigApplicationContext.(AbstractRefreshableConfigApplicationContext.java:58)
at org.springframework.context.support.AbstractXmlApplicationContext.(AbstractXmlApplicationContext.java:61)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:136)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)
at com.vaannila.HelloWorldApp.main(HelloWorldApp.java:9)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 8 more
I also tried manually doing the entire program with a different class name and It throws the same error.
Things I have tried:
built path and included the springframework jars
also included commons-logging-1.1.1.jar
I got past this exception by adding commons-logging-1.1.1.jar to the classpath of my project. I had it in my maven repository from other projects.
Plus, to make the example work, the file name for the instantiation of ClassPathXmlApplicationContext needs to be qualified with the package path. If you are following the example exactly, you need to instantiate your context like this:
ApplicationContext context = new ClassPathXmlApplicationContext("com/vaannila/beans.xml");

NoClassDefFoundError in Osgi w/ Felix, ant

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.

org/dom4j/DocumentException

Good morning every body ,
I have java code that alllows me to create an excel file from xml flie.. But it can not create correctly the file, i have this exception that I do not inderstand its meaning :
Exception in thread "main" java.lang.NoClassDefFoundError: org/dom4j/DocumentException
at org.apache.poi.openxml4j.opc.Package.init(Package.java:145)
at org.apache.poi.openxml4j.opc.Package.<init>(Package.java:132)
at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:67)
at org.apache.poi.openxml4j.opc.Package.create(Package.java:271)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.newPackage(XSSFWorkbook.java:245)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:145)
at escel1.Escel1.main(Escel1.java:104)
Caused by: java.lang.ClassNotFoundException: org.dom4j.DocumentException
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
If someone knows what that means , it will be very helpfull for me :)
I have found the key about your problem. you shouldn't add the jar file of dom4j-1.6.1-sources.jar but dom4j-1.x.jar into the project library. Because the jar file's name with sources is pure java file(xx.java), that means it's not compiled at all.
then rebuild your project, it'll work fine.
Hope to help you :)
Apache POI have a handy page listing all the components and their dependencies, you should start by reading that!
Secondly, if you downloaded the binary zip/tarball of Apache POI, then it comes with all of the dependencies you need in the /lib/ and /ooxml-lib/ directories. Make sure you include all the dependencies required from there on your classpath! (You've missed some out, hence the error)

Getting HtmlUnitDriver Exception NoClassDefFoundError for FindsByCssSelector

Hi I am working on Java & am using HtmlUnitDriver.I have created the object
`WebDriver webDriver = new HtmlUnitDriver(true);`
I am using selenium-htmlunit-driver-2.24.1.jar & selenium-java-2.24.1.jar.
When I run my code I am getting following exception.
Exception in thread "Thread-5" java.lang.NoClassDefFoundError: org/openqa/selenium/internal/FindsByCssSelector
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Please guide me how to solve this issue.If there is jar for this Exception then which Jar should I use?
Make sure that all the relevant jars (such as package and library jars) are in the class path. Always make sure to clean and recompile the project once you copied jars.
[You can use a jar search engine to find jars of missing classes.][1]
[http://www.jarvana.com/jarvana/search?search_type=class&java_class=org.openqa.selenium.internal.FindsByCssSelector][1]
Note : It is always advisable to use jars from official release, because of possible compatibility issues due to version difference.

Categories

Resources