Exception in thread "main" org.apache.velocity.exception.VelocityException - java

Does anyone know how can I solve this problem?
I am trying to make a connection with amazonMechanicalTurk using Java API.
Exception in thread "main"
org.apache.velocity.exception.VelocityException: Error initializing
log: org.apache.log4j.Logger object set as runtime.log.logsystem is
not a valid log implementation.
Caused by: org.apache.velocity.exception.VelocityException:
org.apache.log4j.Logger object set as runtime.log.logsystem is not a
valid log implementation.

Do yourself a favor, working with Velocity I've learned that is better to shut down his damn log:
//disabling Velocity log
Velocity.setProperty("runtime.log.logsystem.class", "org.apache.velocity.runtime.log.NullLogSystem");

I just decided to add some other Velocity libraries to my project.
My project only had the Apache Velocity jar file, then from here, I also added Velocity-Dep to my Maven project and Yesssssssssss! VICTORY!
Still asking why?!! because my project was working well until I decided to update java-aws-mturk library to version 1.7.0; then after I got that error!

Related

Google Protobuf VerifyError

I am using Google Protobuf version 2.6.1 and wanted to use the option
option optimize_for = LITE_RUNTIME;
I am getting the following exception as soon as I do so.
Exception in thread "main" java.lang.VerifyError: class com.pbo.common.network.message.NetworkProtocol$NetworkMessage$HpSyncMessage overrides final method com.google.protobuf.GeneratedMessageLite.isInitialized()Z
As soon as I remove the lite runtime option, the error goes away. Not sure what's causing this. I tried cleaning gradle caches etc to see if that helps but to no avail.

Resources not found after building a project in Netbeans 12

I have a java application that runs correctly when I execute it from Netbeans.
If I execute it as a .jar it does not work. I am getting the error "Caused by: java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException"
The error is ocurring in this command:
Object object = parser.parse(new FileReader("src\\main\\resources\\companies.json"));
I think the problem is that I am not defining the resource paths properly. See screenshot
---------------UPDATE-------------------------
After spending many hours trying to solve this s*** problem, I still can not run the application from a jar. I also try to call the ressources like that:
InputStream inputStream = NewMain.class.getResourceAsStream("/com/companies.json");
but the same problem as before. When I start the applicaion from a batch file I get this message:
I am totally blocked. I would really apreciate if someone could help me
How are you generating the jar? This seems like the json class cannot be found at runtime and you need to add it to the classpath when building.
You can also check the responses at java.lang.NoClassDefFoundError: org/json/simple/parser/ParseException with eclipse and spring.

Build Problem with AnysoftKeyboard (Android)

I am trying to build AnysoftKeyboard in Android studio.
I have java 9(jdk 9) and the appropriate ndk (android-ndk-r14b), as the creator in GitHub says.
I have also changed the local.properties file to shows to the correct paths.
Nevertheless I am still getting some errors.
You can find below those errors.
Run tasks error :
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':base:compileDebugJavaWithJavac
java compiler errors : Caused by: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper
Caused by: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper
Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.util.JavacMessages$ResourceBundleHelper
Here is a screenshot of the error :
AnySoftKeyboard Compile Error , Run Tasks Error
The project uses gradle, in which I am not familiar with, so if I have missed any important step-point, please guide me to solve it.
Is there something that I am missing and getting these errors? What should I do? Thanks in advance.
After following just the official documentation I successfully built a project. I think you just forget with setting JAVA_OPTS with adding java.se.* source as mentioned below. And that is why you have it in stacktrace error above, with missing java.se. resources.
To develop this project, you'll need:
Java 10 - get OpenJDK or AdoptOpenJDK.
Make sure you have the environment variable JAVA_OPTS='-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee'. This is required to ensure the JVM is merciful with libraries that were not designed for Java9+ JVMs.
git
Android Studio
Android SDK API Level 28 installed. Set up local.properties file to point to it (that is, ensure you have sdk.dir=/path/to/android/sdk in it).
Android NDK r14b installed. Set up local.properties file to point to it (that is, ensure you have ndk.dir=/path/to/android/ndk in it).
Caused by: java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: com/sun/tools/javac/util/JavacMessages$ResourceBundleHelper
TO remove this error comment below line prone error.

NoSuchMethodError exception from Java MapReduce pipeline POST /mapreduce/workerCallback?

Do you know of a workaround for this uncaught exception from the Java mapreduce pipeline on Google App Engine?
Is it simply a failure in GcsServiceFactory that created GCS_SERVICE in this line?
https://code.google.com/p/appengine-mapreduce/source/browse/trunk/java/src/com/google/appengine/tools/mapreduce/inputs/GoogleCloudStorageLineInputReader.java?r=462#80
Any ideas on how to fix?
We are seeing this frequently:
2013-09-24 18:18:17.819 Uncaught exception from servlet
java.lang.NoSuchMethodError:
com.google.appengine.tools.cloudstorage.GcsService.openPrefetchingReadChannel(Lcom/google/appengine/tools/cloudstorage/GcsFilename;JI)Ljava/nio/channels/ReadableByteChannel;
at com.google.appengine.tools.mapreduce.inputs.GoogleCloudStorageLineInputReader.beginSlice(GoogleCloudStorageLineInputReader.java:79)
at com.google.appengine.tools.mapreduce.impl.WorkerShardTask.run(WorkerShardTask.java:84)
at com.google.appengine.tools.mapreduce.impl.shardedjob.ShardedJobRunner.runTask(ShardedJobRunner.java:265)
at com.google.appengine.tools.mapreduce.impl.shardedjob.ShardedJobServiceImpl.handleWorkerRequest(ShardedJobServiceImpl.java:49)
at com.google.appengine.tools.mapreduce.impl.handlers.MapReduceServletImpl.doPost(MapReduceServletImpl.java:76)
at com.google.appengine.tools.mapreduce.MapReduceServlet.doPost(MapReduceServlet.java:57)
I see any of the below possible reasons :
You did not include all the jars in classpath, they might have
interdependent classes.
You jar is an old version which is not
having that method.
Some dependent jar is missing which not allowing the class constructor to initialize the class object.

Where do I get the missing resources?

I am still unable to get the box-api hello world program to work. I was getting this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/lang/NotImplementedException
at TestProgram.getAuthenticatedClient(TestProgram.java:47)
at TestProgram.main(TestProgram.java:35)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.NotImplementedException
...
I then went to the Apache Commons Lang Home and downloaded and set up their thing.
Now I get
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
at com.box.boxjavalibv2.jacksonparser.BoxResourceHub.<init>(BoxResourceHub.java:28)
at com.box.boxjavalibv2.BoxClient.createResourceHub(BoxClient.java:345)
at com.box.boxjavalibv2.BoxClient.<init>(BoxClient.java:65)
...
and I have no idea how to fulfill that dependency. I also suspect that even if I could find this one, there'd just be another one, and another one, and another one. Manually importing them all does not seem to be very realistic.
How am I intended to get the missing dependencies for the box API?
The SDK comes included with all of the dependencies you should need. You can find them all in the libs directory of the SDK..
Add all of those jars to your Eclipse build path and it should work.

Categories

Resources