I am trying to setup OFBiz in my computer. So far, I have followed the step by step procedure on installing the software. The problem is when I try to run the server by executing the command java -jar ofbiz.jar I always encounter a startup exception. Even if I execute the startofbiz.bat it will display the same error:
org.ofbiz.base.start.StartupException: Cannot locate container class (org.ofbiz.service.rmi.RmiServiceContainer)
at org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.java:164)
at org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
at org.ofbiz.base.start.Start.initStartLoaders(Start.java:259)
at org.ofbiz.base.start.Start.init(Start.java:96)
at org.ofbiz.base.start.Start.main(Start.java:410)
java.lang.ClassNotFoundException: org.ofbiz.service.rmi.RmiServiceContainer
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 org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:196)
at org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:169)
at org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.java:162)
at org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
at org.ofbiz.base.start.Start.initStartLoaders(Start.java:259)
at org.ofbiz.base.start.Start.init(Start.java:96)
at org.ofbiz.base.start.Start.main(Start.java:410)
java.lang.ClassNotFoundException: org.ofbiz.service.rmi.RmiServiceContainer
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 org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:196)
at org.ofbiz.base.util.CachedClassLoader.loadClass(CachedClassLoader.java:169)
at org.ofbiz.base.container.ContainerLoader.loadContainer(ContainerLoader.java:162)
at org.ofbiz.base.container.ContainerLoader.load(ContainerLoader.java:65)
at org.ofbiz.base.start.Start.initStartLoaders(Start.java:259)
at org.ofbiz.base.start.Start.init(Start.java:96)
at org.ofbiz.base.start.Start.main(Start.java:410)
Please help!
Assuming you've run the ant run-install step as you have been following step by step instructions you should debug the exception like you would any other java exception.
Firstly in your stack trace the key lines to look at are:
{org.ofbiz.base.start.StartupException: Cannot locate container class
(org.ofbiz.service.rmi.RmiServiceContainer)}
{java.lang.ClassNotFoundException:
org.ofbiz.service.rmi.RmiServiceContainer}
These are telling you that the class, org.ofbiz.service.rmi.RmiServiceContainer, was attempted to be loaded and was not found.
You should check to see whether you have the class file RmiServiceContainer.class. In my installation of OFBiz this class is located under:
/ofbiz/framework/service/build/classes/org/ofbiz/service/rmi/RmiServiceContainer.class
If you find the class file then try rebuilding OFBiz using ant refresh.
If you could not find the class file then search for the java file that is used to create this class RmiServiceContainer.java. The java code that is compiled to created this class is located under:
/ofbiz/framework/service/src/org/ofbiz/service/rmi/RmiServiceContainer.java
If you find the Java file, again, try and rebuild OFBiz using ant refresh and confirm the class file was created. If you cannot find the java file then you should download OFBiz again.
If running ant refresh fails to fix the issue then it's likely something isn't configured correctly in your classpath.
Related
I recently moved a project from one machine to another but I am now given an error when attempting to run java files on the new machine. I'm trying to run a java file from part of an Android project in command prompt but I am given an error. The file compiles okay but fails to run. Here is the error I am given;
Exception in thread "main" java.lang.NoClassDefFoundError: ChatServer (
e: edu/UTEP/android/ChatServer)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Any ideas why I am receiving this error?
Your ChatServer is having a package declaration of edu.UTEP.android in the top. So either you need to remove that package declaration recompile your java file again and run it
(or)
you need to create folder structure like this
CurrentDir/edu/UTEP/android/
Keep your java file in android folder and invoke java ChatServer from CurrentDir. Any of these two will solve the issue :-)
For more info on packages, you can refer to my previous answer on a similar issue here
Make sure that the .jar that provides ChatServer is in your runtime Classpath.
This issue rise when jvm don't file class path.
check where u have placed your jar file or lib folder.
Move to that directory then run javac and then java .
Issue will be resolved.
I write a Java program that read text from excel.So I import some jar like this: poi-3.10-beta2-20130904.jar, poi-ooxml-3.10-beta2-20130904.jar, etc., I can run the program correctly in eclipse.But when I package this program with maven to the directory(C:\workspace2\change\bin),
Then I run this program in command like this :
C:\workspace2\change\bin>java GenerateVar
it occurs this error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell
at GenerateVar.execute(GenerateVar.java:59)
at GenerateVar.main(GenerateVar.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Cell
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)
... 2 more
You need to specify classpath with all other jars/classes you use in your program.
E.g. Setting multiple jars in java classpath
When you run it from eclipse in the console there's a command that could be used to run the project, you could copy/paste it from the console to your command line.
In the command java GenerateVar you didn't set -cp option. With this option the command line will look like
java -cp poi-3.10-beta2-20130904.jar poi-ooxml-3.10-beta2-20130904.jar ... GenerateVar
Assumed the libraries are in the current dir.
How to use maven plugins to add dependency to your project and build jar you can find here.
See also this answer if you want to modify manifest.mf manually.
over, I change the way do what I want to do. I use the fat jar which is the eclipse plugin to package the program
I downloaded luke-1.0.1.jar (Luke 1.0.1 binary without any dependencies) from http://code.google.com/p/luke/downloads/list.
And I have WinXP, with latest Java 6 downloaded from Oracle/Sun web site.
I run the command line: "java -jar luke-1.0.1.jar" and try to launch Luke, but I got following error:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/lucene/analysis/Analyzer
Caused by: java.lang.ClassNotFoundException: org.apache.lucene.analysis.Analyzer
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)
Could not find the main class: org.getopt.luke.Luke. Program will exit.
Any clue, what shall I do? I totally have no knowledge of Java.
Thanks
Hardy
So Java complains that it cant find a dependency. Which is little surprise since you downloaded a binary without dependencies.
Download the binary with all the dependencies (try the "featured" one) and you should be good.
Use luke-all.jar instead,
http://code.google.com/p/luke/downloads/detail?name=lukeall-1.0.1.jar&can=2&q=
Luke is a tool for examining lucene indices. You need to combine it with Lucene. You can either download Lucene and add appropriare JAR files to the classpath, or download a fatter Luke binary that includes Lucene.
I have a webservice client created using cxf. When I run from eclipse I dont get any errors. But when I create a jar out of the files and run it from cmd prompt , I get NoclassDef exception or ClassNot found exception. I have set the classpath, java home correct.
1. Exception
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
2. Exception
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/cxf/databinding/DataBinding
Caused by: java.lang.ClassNotFoundException: org.apache.cxf.databinding.DataBinding
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)
The web service is in C# wcf and the client was created without JAXBinding element.
Anyhelp will be appreciated.
Thanks,
Priya.R
This is a typically and easiy-to-solve classpath problem: The cxf library (-ies) is/are missing on the classpath. Start the application like this:
java -cp <youJar.jar>;<cxf.jar>[;<another-cxf.jar>;...] my.pkg.Application
You'll have to replace the name of the main class and the values of the -cp parameter with the paths and names of your jar and all other libraries that are required to run the application.
Why does it work from eclipse: In eclipse, you've set the build path correctly, but this builds path is not exported or added to the jar.
I am trying to create the java files from a remote webservice. I downloaded axis 1.4, copied the lib folder to c:\data\axis\lib which contains of these files:
axis.jar
axis-ant.jar
commons-discovery-0.2.jar
commons-logging-1.0.4.jar
jaxrpc.jar
log4j.properties
log4j-1.2.8.jar
saaj.jar
wsdl4j-1.5.1.jar
I added the c:\data\axis\lib folder to the %AXISCLASSPATH%. Now I am trying to create the java classes using this cmd:
java -cp %AXISCLASSPATH% org.apache.wsdl.WSDL2JAVA http://myurl.com?wsdl
However I keep getting the following error message:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/axis/wsdl/
WSDL2Java
Caused by: java.lang.ClassNotFoundException: org.apache.axis.wsdl.WSDL2Java
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)
Could not find the main class: org.apache.axis.wsdl.WSDL2Java. Program will exit.
Can someone help me to get this working?
Add the jars to the classpath individually if you're using a Java version before 6. If you're using Java 6, see here if you want to use wildcards.
try
java -cp %AXISCLASSPATH% org.apache.wsdl.WSDL2Java http://myurl.com?wsdl
Class names are case sensitive
Login as eucalyptis and compile and it will find all of the jars - this took me forever to figure out!
package structure is wrong. Please use org.apache.axis.wsdl.WSDL2Java