有关java.lang.ClassNotFoundException和Class not found的疑问

ThinkCat 2012-05-29 11:53:54
调试一个ERP系统时,进行了一些操作后,点击了按钮,然后整个界面没有动作。查看日志文件,看到了下面一段记录:

Exception in thread "Thread-15" nc.bs.framework.exception.FrameworkConnectorException: Read/Witer object error
at nc.bs.framework.comn.cli.JavaURLCommunicator.request(JavaURLCommunicator.java:73)
at nc.bs.framework.comn.cli.ClientProxyImpl.urlCall(ClientProxyImpl.java:184)
at nc.bs.framework.comn.cli.ClientProxyImpl.invoke(ClientProxyImpl.java:135)
at $Proxy6.showMessageAlertFileNameByLogin(Unknown Source)
at nc.ui.pub.msg.MessageReceiveThread$2.run(MessageReceiveThread.java:222)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: NCClassLoader(Cache), Class not found:javax.ejb.EJBException
at nc.bs.framework.codesync.client.NCClassLoader.loadClass(NCClassLoader.java:60)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at nc.bs.framework.comn.NetObjectInputStream$NCObjectInputStream.resolveClass(NetObjectInputStream.java:57)
at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
at java.io.ObjectInputStream.readClassDesc(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
at java.io.ObjectInputStream.readSerialData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at nc.bs.framework.comn.Result.readExternal(Result.java:40)
at java.io.ObjectInputStream.readExternalData(Unknown Source)
at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
at java.io.ObjectInputStream.readObject0(Unknown Source)
at java.io.ObjectInputStream.readObject(Unknown Source)
at nc.bs.framework.comn.NetObjectInputStream.readObjectOverride(NetObjectInputStream.java:205)
at java.io.ObjectInputStream.readObject(Unknown Source)
at nc.bs.framework.comn.NetObjectInputStream.readObject(NetObjectInputStream.java:271)
at nc.bs.framework.comn.cli.JavaURLCommunicator.request(JavaURLCommunicator.java:64)
... 5 more

java.lang.ClassNotFoundException是加载类时,没有找到相应的类。在这里,就是NCClassLoader这个类没有找到。而NCClassLoader则是在fw.jar这个包中的。

但是我通过websphere(整个系统是跑在was上的)的“类装入器查看器”发现,fw.jar这个包是已经被装入的
file:/ufida/testnchome1218/nchome/external/lib/fw.jar
而且这个jar包中的确有NCClassLoader这个类。

而那个Class not found的javax.ejb.EJBException是在j2ee.jar这个包中的。而这个包被先后装载了三次
file:/opt/IBM/WebSphere/AppServerNew/lib/j2ee.jar
file:/opt/IBM/WebSphere/AppServerNew/lib/j2ee.jar
file:/ufida/testnchome1218/nchome/lib/j2ee.jar
怀疑这里可能是两个jar包冲突了。删了/ufida/testnchome1218/nchome/lib/j2ee.jar(删/opt/IBM/WebSphere/AppServerNew/lib/j2ee.jar后was就启用不起来了),但是重启后,问题依旧。

希望大家帮忙分析一下,谢谢了。
...全文
549 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
古布 2012-06-05
  • 打赏
  • 举报
回复
LZ 强人。。。
ThinkCat 2012-06-05
  • 打赏
  • 举报
回复
问题解决了,并不是之前认为的classpath的问题,而是部署的过程中出错了。

在部署的日志中发现了如下记录:
nc.bs.framework.exception.ComponentCreateException: Component: nc.itf.uap.pa.PreAlertEJB,Detail Message: remove temp ejb Object error …… Caused by: javax.ejb.EJBException: See nested exception; nested exception is: nc.bs.framework.exception.ComponentCreateException: Component: nc.itf.uap.pa.PreAlertEJB,Detail Message: component state is error, state: -2147483626 causes: populate component property: iPreAlertConfigService with reference: IPreAlertConfigService error: Container: uap,Component: IPreAlertConfigService,Detail Message: state: -2147483626 causes: The component can't get the Instantiator correctly ……

更改了有关IPreAlertConfigService的配置,部署后问题解决。
ThinkCat 2012-05-30
  • 打赏
  • 举报
回复
引用包的方式是share lib,这个之前配置过。

我又看了一下日志,是EJB的相关的错误,可能是部署的问题。我再调调看。
[Quote=引用 4 楼 的回复:]

类被加载进去了,却不能被识别。而且被加载好几次。
LZ查一查classpath,path

另外websphere中引用的外部包采用share lib方式。通过WAS后台控制。
[/Quote]
古布 2012-05-30
  • 打赏
  • 举报
回复
类被加载进去了,却不能被识别。而且被加载好几次。
LZ查一查classpath,path

另外websphere中引用的外部包采用share lib方式。通过WAS后台控制。
ThinkCat 2012-05-30
  • 打赏
  • 举报
回复
从后台删除?没怎么明白。
这篇文章原来看过,在IBM DW上。
[Quote=引用 2 楼 的回复:]

从后台删除试试。
http://www.itpub.net/thread-738319-1-1.html
[/Quote]
古布 2012-05-30
  • 打赏
  • 举报
回复
从后台删除试试。
http://www.itpub.net/thread-738319-1-1.html
ThinkCat 2012-05-30
  • 打赏
  • 举报
回复
自己顶一下,好像沉了。

67,515

社区成员

发帖
与我相关
我的任务
社区描述
J2EE只是Java企业应用。我们需要一个跨J2SE/WEB/EJB的微容器,保护我们的业务核心组件(中间件),以延续它的生命力,而不是依赖J2SE/J2EE版本。
社区管理员
  • Java EE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧