org.apache.thrift7.TBase vs org.apache.thrift.TBase - java

I am not being able to find any jar which contain this kind of package. Can, anyone tell me in which libthrift Link jar i can find this class and package. I couldn't find any jar containing this package. Everytime i execute my java file it throw following expection:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/thrift7/TBase
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at backtype.storm.topology.TopologyBuilder.initCommon(TopologyBuilder.java:215)
at backtype.storm.topology.TopologyBuilder.setSpout(TopologyBuilder.java:178)
at backtype.storm.topology.TopologyBuilder.setSpout(TopologyBuilder.java:164)
at com.test.newpackage.TopologyMain.main(TopologyMain.java:12)
Caused by: java.lang.ClassNotFoundException: org.apache.thrift7.TBase
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 16 more

Try searching Central when you're looking for a class. fc:"org.apache.thrift.TBase" suggests org.apache.thrift:libthrift:0.9.0.
For libthrift7, see the instructions on the Storm wiki: use the http://clojars.org/repo repository and depend directly on storm:storm. storm:libthrift7 will be brought in transitively.

Did you include org.apache.thrift in the maven dependencies.? If not please include:
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.0</version>
</dependency>

please include following:
<!-- https://mvnrepository.com/artifact/storm/libthrift7 -->
<dependency>
<groupId>storm</groupId>
<artifactId>libthrift7</artifactId>
<version>0.7.0-2</version>
</dependency>

Related

Type [unknown] not present Caused by: java.lang.NoClassDefFoundError: org/junit/internal/runners/TestClassRunner

We are upgrading from junit-4.2 to junit-4.10. But with that, I am getting initializationError when launching firefox with below error stack. There is absolutely no reference to TestClassRunner (a class from junit-4.2) but not sure why we get it?
Type [unknown] not present
java.lang.TypeNotPresentException: Type [unknown] not present
at com.sun.proxy.$Proxy2.value(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
Caused by: java.lang.NoClassDefFoundError: org/junit/internal/runners/TestClassRunner
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:278)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3281)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3288)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3288)
at java.lang.Class.initAnnotationsIfNecessary(Class.java:3288)
at java.lang.Class.getAnnotation(Class.java:3229)
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)
Right click your project in Package Explorer > click Properties.
Go to Java Build Path > Libraries tab.
Click on 'Add Library' button.
Select JUnit.
Click Next.
OR
Run mvn clean compile test-compile
Tell me if it doesnt work, but it worked for me.
Well the issue was little difference. There were two classes of same name WebDriverRunner. The one that was getting loaded first (based on classpath entries) was incorrect (rather deprecated) one which had some reference of TestClassRunner class. After putting the other jar (with right WebDriverRunner) before the previous one resolved the issue. Thanks all for your suggestions.
I also faced this issue but not due to any code changes. In my case I was running a simple Robolectric test on the Android SDK 29 (as it was set in the TestConfiguration). I tried restarting Android Studio, cleaning the build and Invalidating cache but in the end this issue was resolved by changing the SDK to 28 in the Edit Configuration. I also don't have any solid reason to why this worked.

NoClassDefFoundError while setting up cucumber tests

I am getting the following error with my cucumber setup. I was following a youtube video (https://www.youtube.com/watch?v=pD4B839qfos&list=PL_noPv5wmuO_t6yYbPfjwhJFOOcio89tI) for this setup but I downloaded all the latest jars. Not sure what went wrong but now I can't figure out what needs to be done. Can anyone help me, please?
Exception in thread "main" java.lang.NoClassDefFoundError: gherkin/formatter/Formatter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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)
at cucumber.runtime.formatter.PluginFactory$1.<init>(PluginFactory.java:53)
at cucumber.runtime.formatter.PluginFactory.<clinit>(PluginFactory.java:52)
at cucumber.runtime.RuntimeOptions.<init>(RuntimeOptions.java:69)
at cucumber.api.cli.Main.run(Main.java:31)
at cucumber.api.cli.Main.main(Main.java:18)
Caused by: java.lang.ClassNotFoundException: gherkin.formatter.Formatter
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)
... 17 more
This means that Gherkin version you are using is not compatible with other Cucumber libraries. I tried using the latest gherkin3-3.0.0 but it did not work for me, so I degraded it to gherkin-2.12.2
I got below versions on Oct’17 for Cucumber
cobertura-2.1.1
cucumber-core-1.2.5
cucumber-java-1.2.5
cucumber-junit-1.2.5 cucumber-jvm-deps-1.0.5
cucumber-reporting-3.10.0 gherkin-2.12.2 junit-4.12
mockito-all-2.0.2-beta
The compatible version with your Cucumber-java can be found here under the Provided Dependencies section
If this does not resolve your issue make sure you remove jars from Project Build Path and add back again. Same if you are using maven then clearing local maven repository may also help.
You can also follow the steps mention in this tutorial

Maven: compiling using jar file from system

I am working on a maven project for which I am using a custom jar file and I included that in pom.xml as
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-migrations</artifactId>
<scope>system</scope>
<version>0.7.0</version>
<systemPath>${basedir}/dropwizard-migrations-0.7.0.jar</systemPath>
</dependency>
but after mvn package and Compiling I am getting the NoClassDefFoundError
Exception in thread "main" java.lang.NoClassDefFoundError: io/dropwizard/migrations/MigrationsBundle
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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)
at in.myGroupID.Artifact.game.myApplication.initialize(myApplication.java:48)
at io.dropwizard.Application.run(Application.java:70)
at in.myGroupID.Artifact.game.myApplication.main(myApplication.java:44)
Caused by: java.lang.ClassNotFoundException: io.dropwizard.migrations.MigrationsBundle
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)
... 15 more
I think everything is all right in your case. But please make sure that the location of your jar is correct. I mean in ${basedir}/dropwizard-migrations-0.7.0.jar ${baseDir} means project home directory and your jar must be in your project home directory . If it is not in project home directory, put it there or change systemPath value to point actual location to the jar file.

Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException

I am building an application using JBoss AS 7.1 and I am writing a test
#Test
public void testGetLoginUser() throws Exception {
final MarketCrudService crudService = new MarketCrudService(jpaRule.getEntityManager());
crudService.create(new Login("user1", "password"));
}
This test depends on #Rule created which instantiates a in-memory derby db for writing test data
When I run this test, I see following error
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2248)
at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:141)
... snipped
This happens at line
emFactory = Persistence.createEntityManagerFactory(persistenceUnitName, persistenceProperties);
I googled and found out the this is because jta.jar is missing, so in my pom.xml I added
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
<version>1.0.1.Final</version>
</dependency>
Running again did not solved the problem, how can I fix it?
Adding this resolved the issue
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.1_spec</artifactId>
</dependency>

Active MQ - HelloWorld example exception

I'm trying to run the hello world example found here
I added activemq-all-5.5.1.jar to the libraries already
It builds successfully with the following warning
warning: [options] bootstrap class path not set in conjunction with -source 1.6
But it doesn't run, I get this exception
Exception in thread "Thread-0" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/jms/JMSException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at hw_testing.HW_testing$HelloWorldProducer.run(HW_testing.java:69)
at java.lang.Thread.run(Thread.java:722)
Exception in thread "Thread-1" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/jms/JMSException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
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:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at hw_testing.HW_testing$HelloWorldProducer.run(HW_testing.java:69)
at java.lang.Thread.run(Thread.java:722)
...
And the same exception for thread 3 and 4
Can anybody help me with that please?
This is a problem with dependencies (javax/jms/JMSException is in multiple jars), which occurs e.g. with javaee-api (5 or 6) - this jar lacks some method bodies for several classes. activemq-all-5.5.1.jar also contains javax.jms.JMSException but these classes are not identical. If javaee-api comes first in classpath, you will get the java.lang.ClassFormatError.
If you use maven, put javaee-api after activemq-all (or remove it). In general, remove unecessary dependencies.

Categories