我该如何解决NoClassDefFoundError? [英] How can i solve a NoClassDefFoundError?

查看:460
本文介绍了我该如何解决NoClassDefFoundError?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Oracle Linux上安装了Oracle Weblogic 11g,并尝试使用jdeveloper 11g完成Oracle的ADF教程之一。当我运行我的项目时,它成功编译没有错误。它开始将应用程序部署到weblogic服务器,并打开我的默认Internet浏览器。但随后出现错误500内部服务器错误。



我收到以下错误:



java.lang.NoClassDefFoundError:无法初始化类org.apache.myfaces.trinidadinternal.convert.ColorConverter ....



我研究了这个问题的互联网,我也问了一下,常见的答案是类路径有问题。可能jdeveloper中使用的库在weblogic中是不同的,然后项目被部署。



任何人都可以判断问题肯定是类路径吗?
我如何设置jdeveloper来部署它用于weblogic服务器的相同类路径?

解决方案

java.lang.NoClassDefFoundError 表示类路径中类的运行时版本与 compile 时的类不同。 / p>

您的问题可能是在部署服务器时找到的类的多个版本。我注意到 org.apache.myfaces.trinidadinternal.convert.ColorConverter 类在 trinidad-impl.jar <中找到/ p>

您可以搜索在运行时服务器环境中找到多少个这样的jar以及您自己的webapp库吗?



在Windows上,Jdev内置服务器在此文件夹中运行



C:\ Users \< ...> \ AppData \Roaming\JDeveloper\system11.1.1.4.37.59.23或类似的东西



您需要在webapp / WEB-INF中使用此功能/ lib而不是其他区域。



在我的本地,我发现了C下的Jar:\ Users \< ...> \ AppData \ Roaming\JDeveloper\system11.1.1.4.37.59.23\o.j2ee.wlLibs\jsp\Trinidad-Components1.2.war



我想你可以使用weblogic.xml设置强制WEB-INF / lib类优先加载到server / lib中的

 < container-descriptor> 
< prefer-web-inf-classes> true< / prefer-web-inf-classes>
< / container-descriptor>


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?

解决方案

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> 

这篇关于我该如何解决NoClassDefFoundError?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆