log4j error when uninstalling weblogic - java

When I'm trying to uninstall weblogic in console mod (failure at uninstallation with GUI mode before !) with this command
sh uninstall.sh -mode=console
Below is the exception that I got:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Layout
at com.bea.plateng.common.util.logging.LogFactory.newLogInstance(LogFactory.java:102)
at com.bea.plateng.common.util.logging.LogFactory.getLog(LogFactory.java:87)
at com.bea.plateng.wizard.WizardController.setupWizardLog(WizardController.java:325)
at com.bea.plateng.wizard.WizardController.<init>(WizardController.java:168)
at com.bea.plateng.wizard.WizardHelper.invokeWizard(WizardHelper.java:161)
at com.bea.plateng.wizard.WizardHelper.invokeWizardAndWait(WizardHelper.java:42)
at com.bea.plateng.wizard.WizardController.main(WizardController.java:933)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Layout
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)
I took google search many times but no luck.
Many thanks for helping me solve this issue.

If your end target is to just uninstall weblogic, you may opt to just manually delete relevant directories. If you wish to stick to script or GUI , you might try to solve log4j issue logically,
Place log4j jar in $DOMAIN_NAME/lib
If uninstall script is looking for log4j that means a java process might be getting called from some other nested script and that is trying to use log4j to write logs. Try to provide log4j jar via -cp command to that process
Do your startWeblogic & stopWeblogic scripts able to use log4j successfully? if yes, try to provide log4j path to uninstall in same way as done in those scripts
You have to mainly figure out as why your uninstall.sh is looking for log4j.
Its hard to answer precisely since these issues are very much machine specific. If you are going with manual delete option, google for steps specific to your OS.

Related

GATE Java error

I know almost nothing about Java so please take it easy on me. I'm using this plugin, which I've had working nicely for a few days on my Mac (following the repo's very simple instructions below), but when I took it to an Ubuntu instance I got the following error:
ResumeParser/ResumeTransducer$ java -cp 'bin/*:../GATEFiles/lib/*:../GATEFILES/bin/gate.jar:lib/*' code4goal.antony.resumeparser.ResumeParserProgram somefile.pdf somefile.json
Exception in thread "main" java.lang.NoClassDefFoundError: gate/SimpleAnnotation
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
at java.lang.Class.getMethod0(Class.java:2866)
at java.lang.Class.getMethod(Class.java:1676)
at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
Caused by: java.lang.ClassNotFoundException: gate.SimpleAnnotation
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)
... 6 more
Anyone have thoughts on what is going wrong?
Installation and usage instructions:
1. git clone https://github.com/antonydeepak/ResumeParser.git
2. cd ResumeParser/ResumeTransducer
3. export GATE_HOME="..\GATEFiles"
Paths are case sensitive in Ubuntu, GATEFiles is different from GATEFILES. Since gate.SimpleAnnotation is in gate.jar, I bet that your classpath should be:
-cp 'bin/:../GATEFiles/lib/:../GATEFiles/bin/gate.jar:lib/*'
Disclaimer: I haven't used this plugin, I don't know if the other parts of the classpath are correct.
In general, you can "debug" by trying
ls ../GATEFiles/bin/
to see if there is a gate.jar file.
It's hard to know, but most likely the class it cannot find is in the gate.jar file, and it is either not on the new machine, or is not in the correct place on the new machine.
To expand slightly: Classes are found in a couple of places, but you specify a gate.jar on the classpath of the command line (that's what the -cp designates), so I'm guessing it's there. Since java can't find it, I'm guessing further that the necessary jar file is not where it needs to be for the Java runtime to find it.
For Linux and OSX use '/' and ':' , try this call .. it worked for me
java -cp './bin/*:../GATEFiles/lib/*:../GATEFiles/bin/gate.jar:./lib/*' code4goal.antony.resumeparser.ResumeParserProgram cv.pdf cv.json

No class def found java

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/protocol/HttpContext
at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:119)
at com.amazonaws.AmazonWebServiceClient.<init>(AmazonWebServiceClient.java:103)
at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:362)
at com.amazonaws.services.s3.AmazonS3Client.<init>(AmazonS3Client.java:344)
at Gethtml_fromS3.main(Gethtml_fromS3.java:16)
Caused by: java.lang.ClassNotFoundException: org.apache.http.protocol.HttpContext
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)
... 5 more
Can any one give me a solution for the above error?
Please check if you have httpcore jar. I got rid of this error, after adding httpcore-4.2.jar to my lib.
It's difficult to pinpoint the exact reason why your application raises this exception, but a few common pointers that might help you.
The exception is raised when you are using a class in your code that isn't available when it runs. In this case, it seems you are unable to use org.apache.http.protocol.HttpContext. Most likely, you created an application that does include the Amazon AWS jar, but lacks the Apache HTTPClient jar.
If you used gradle/maven to create your application, include it in your dependencies. It it's a plain Java program, ensure the required JARs are available in your classpath (e.g. the same place as you currently have the Amazon jar located).

Java RMI ClassNotFoundException on stub occurs in Linux but not Windows

I'm getting the following exception when attempting to use Naming.lookup() to create an RMI object:
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: project.server.data.RmiMainObjImpl_Stub
at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
at java.rmi.Naming.lookup(Naming.java:101)
... 2 more
Caused by: java.lang.ClassNotFoundException: project.server.data.RmiMainObjImpl_Stub
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.rmi.server.LoaderHandler$Loader.loadClass(LoaderHandler.java:1206)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:270)
at sun.rmi.server.LoaderHandler.loadClassForName(LoaderHandler.java:1219)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:452)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:185)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:637)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:264)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:214)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1612)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1517)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1771)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1350)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:370)
... 4 more
Curiously, this error only happens under Linux and AIX, but never under Windows. The error happens consistently, but seemingly works under some versions of Java:
The original jar was built with 1.6.0u30 on a Windows machine
The original jar will not work under Linux using 1.7.0u60, but will work with 1.6.0u24
The original jar will not work under AIX using 1.6 64-bit, but will work with 32-bit
Building the jar on a Linux machine using 1.7.0u60 will actually not work with the same runtime on that machine
My policy file seems to be set up correctly and is being recognized (though, I'm guessing I'd have a different error if it was not):
grant {
permission java.security.AllPermission "", "";
};
I'm executing java with a command line similar to this:
java -cp ./.:./JProjApi.jar:./MyRMI.jar -Djava.security.policy=./policy.all com/project/rmi/Main
And the code looks like this:
System.setSecurityManager(new RMISecurityManager());
rmiObj = (project.server.data.RmiMainObj_1_0) Naming.lookup("rmi://172.17.44.45/RMIMain");
I do not have access to the server-side (and I'm consuming a jar that has the necessary client-side interfaces as well).
Any ideas on what might be going wrong?
the stub class [is] not in the client-side jar.
The stub class must be in the client JAR file, unless you're using the codebase feature.
why does the Windows version work?
If it's working on one platform and not others, the stub class is clearly in the CLASSPATH on the platforms where it works, and not in the platforms where it doesn't. Or, if you're using the codebase feature, which you haven't said anything about, the codebase URL isn't accessible from all the platforms.
Figuring this out became a much lower priority, but it came back.
Network scanning showed nothing unusual.
It turned out that it did, in fact, have at least something to do with the Java version or new settings on newer Java versions.
This:
-Djava.rmi.server.useCodebaseOnly=false
Had to be added to the command line and it now works for those machines it didn't previously work on.

What would cause java.lang.ClassNotFoundException: [B?

I'm rewriting a client/server application using Akka 2.2.0, Java 1.7.0_25 and Eclipse Juno.
I had a sample client and server working with Akka 2.0.2.
I updated to the old stable release 2.1.4 and got everything working once again.
I've just moved to the latest stable release 2.2.0.
I created a new package to add some new functionality, leaving the existing code untouched.
Something changed and now I can't launch my test cases.
Here is the stacktrace I see when I try to create an ActorSystem:
Exception in thread "main" java.lang.ClassNotFoundException: [B
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)
at akka.actor.ReflectiveDynamicAccess.getClassFor(DynamicAccess.scala:94)
at akka.serialization.Serialization$$anonfun$4.apply(Serialization.scala:154)
at akka.serialization.Serialization$$anonfun$4.apply(Serialization.scala:153)
at scala.collection.TraversableLike$WithFilter$$anonfun$map$2.apply(TraversableLike.scala:697)
at scala.collection.immutable.HashMap$HashMap1.foreach(HashMap.scala:178)
at scala.collection.immutable.HashMap$HashTrieMap.foreach(HashMap.scala:347)
at scala.collection.TraversableLike$WithFilter.map(TraversableLike.scala:696)
at akka.serialization.Serialization.<init>(Serialization.scala:153)
at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:15)
at akka.serialization.SerializationExtension$.createExtension(SerializationExtension.scala:12)
at akka.actor.ActorSystemImpl.registerExtension(ActorSystem.scala:644)
at akka.actor.ExtensionId$class.apply(Extension.scala:34)
at akka.serialization.SerializationExtension$.apply(SerializationExtension.scala:12)
at akka.remote.RemoteActorRefProvider.init(RemoteActorRefProvider.scala:77)
at akka.actor.ActorSystemImpl._start(ActorSystem.scala:568)
at akka.actor.ActorSystemImpl.start(ActorSystem.scala:575)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:103)
at akka.actor.ActorSystem$.apply(ActorSystem.scala:98)
at akka.actor.ActorSystem$.create(ActorSystem.scala:64)
at akka.actor.ActorSystem.create(ActorSystem.scala)
Its complaining that it can't class load a byte array via the method descriptor style string "[B".
#som-snytt pointed out two bug reports that exactly describe the error I'm seeing.
#paul-vargas called out -Dsun.lang.ClassLoader.allowArraySyntax=true which re-enables the old loadClass behavior.
The allowArraySyntax flag does make the ClassNotFoundException go away but other errors popped up. The errors lead me to believe that something has gone wrong with my Eclipse/m2e/Scala-ide/Akka setup.
I imported the project into Netbeans 7.3 and did a clean and build and it worked on the first try. I didn't even need to set allowArraySyntax.
May you need add the argument to VM:
-Dsun.lang.ClassLoader.allowArraySyntax=true
This won't be news to everyone:
http://bugs.sun.com/view_bug.do?bug_id=6500212
http://bugs.sun.com/view_bug.do?bug_id=6434149
I only looked that up due to #paul-vargas.
I observe that in trunk, ReflectiveDynamicAccess uses Class.forName as the bug report says is recommended. See the code on master.
Possibly, you'll want to upgrade your Akka together with your Java version.
Or, perhaps your production runtime is stuck on 1.5 but you develop on 1.7.
Old akka and scala jars were on the classpath along with the updated versions. Not sure why it caused the above exception but the problem became obvious once Paul pointed out the allowArraySyntax flag.

Jsoup error at run time: Exception in thread "main" java.lang.NoClassDefFoundError

I am getting the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/jsoup/Jsoup
at Main.main(Main.java:42)
Caused by: java.lang.ClassNotFoundException: org.jsoup.Jsoup
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)
... 1 more
Now what I have done so far:
I created a libs folder in my project folder and added the Jsoup.jar there. Then in eclipse I click properties, add external Jar and added it. I see the referenced library.
But the issue still persist. I dont get compilation errors. So this is a runtime issue. Appreciate the help.
Edit:
I have found the following
If I compile using
javac -classpath /path/to/jsoup.jar myclass.java
and then
java -classpath /path/to/jsoup.jar myclass
It runs perfect.
Now. This is not working for me because I am going to use my application on a computer that does not have Jsoup. So how to I resolve this runtime issue?
Go to Run configurations... menu and check classpath for Run task. It looks like you add library for Compilation step, but it doesn't set at Run step.
Edit (after comment)
I dove into the issue and found that this dependency is needed for application container. So you just need to add this library to classpath of your app server. If you use Tomcat, just put the library to the %CATALINA_HOME%\lib directory.

Categories