问题
I have installed Oracle Weblogic 11g on Oracle Linux and I tried to complete one of Oracle's ADF tutorials using jdeveloper 11g. When I run my project it compiles successfully with no errors. It starts deploying the application to the weblogic server and my default internet browser opens. But then an Error "500 Internal server error" appears.
I'm getting the following error:
java.lang.NoClassDefFoundError: Could not initialize class org.apache.myfaces.trinidadinternal.convert.ColorConverter at....
I researched the internet for this problem and I also asked around and the common answer was that there is a problem with the classpath. Probably the libraries that are used in jdeveloper are not the same in weblogic then the project gets deployed.
Can anyone tell if definitely the problem is the classpath?? And how can I setup jdeveloper to deploy the same classpath it used to the weblogic server?
回答1:
java.lang.NoClassDefFoundError
means the runtime version of the class in the classpath is not the same as that at compile time.
Your problem could be multiple versions of the class being found when the server is deploying. I notice the class org.apache.myfaces.trinidadinternal.convert.ColorConverter
is found in trinidad-impl.jar
Can you search for how many such jars are found in the run time server environment plus your own webapp libraries?
On windows, the Jdev inbuilt server runs in this folder
C:\Users\<...>\AppData\Roaming\JDeveloper\system11.1.1.4.37.59.23 or something similar
you need this in your webapp/WEB-INF/lib and not in the other areas.
On my local I find the Jar under C:\Users\<...>\AppData\Roaming\JDeveloper\system11.1.1.4.37.59.23\o.j2ee.wlLibs\jsp\Trinidad-Components1.2.war
I think you could use the weblogic.xml setting to force the WEB-INF/lib class to get loaded in preference to that in server/lib with
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
回答2:
This happens when you try to load a class that is trying to load another class which is not on the classpath. Find out which classes are needed by ColorConverter and make sure you have them in your classpath.
回答3:
First of all: What are you deploying to the server? An ADF jar or a WAR file. In your case - given that you don't have any dependent jars installed on the application server. You should deploy a WAR file.
On your view project - right click and select Project Properties. Then go to Deployment and edit the deployment profile (if none are there create one). Make sure that the checkbox "Include Libraries from other projects" is checked. (IT's in the Library Dependencies tab).
Also: you might find some useful information in here.
Hope this helps. Michael
回答4:
Using StackTrace
you can find out classes
those are missing .I think you are missing some jar and that should be in your classpath.
来源:https://stackoverflow.com/questions/11020569/how-can-i-solve-a-noclassdeffounderror