java EAR库的类为WAR成员抛出ClassNotFoundException
我打包了一个EAR(myear.EAR)文件,并将其部署在JBoss EAP 6(即JBoss 7:)中。 看起来是这样的:
lib/
my-common.jar (Custom library containing common classes used by both the WAR and BIZ)
--- (other libraries used by both WAR and BIZ) ---
META-INF/
jboss-deployment-structure.xml (specifies just <ear-subdeployments-isolated>false</ear-subdeployments-isolated> )
my-biz.jar (EJB Module)
META-INF/
beans.xml
MANIFEST.MF
-- java classes --
my-war.war (WAR Module)
WEB-INF/
beans.xml
lib/ (empty! I made a skinny war)
META-INF/
MANIFEST.MF
resources/
-- java classes --
在my-war.war
中,有一个类从my-common.jar
中的类调用方法。以下是发生的情况:
public class MyWarMember implements Serializable{//my-war.war
public void foo(){
MyCommonMember.deepCopy(this);
}
}
---------------------------------------------------------------------
public class MyCommonMember{//my-common.jar
public static Object deepCopy(Serializable obj){
ObjectOutputStream oos .....
...
oos.writeObject(obj);
....
ObjectInputStream ois ....;
....
ois.readObject();
}
}
对ois.readObject();
的调用将为MyWarmMember抛出ClassNotFoundException:
java.lang.ClassNotFoundException: my.war.MyWarMember from [Module "deployment.myear.ear:main" from Service Module Loader]
你将如何解决这个问题?谢谢
共 (0) 个答案