我创建了一个带有 ejb 和 war 模块的 netbeans 6.7 EnterpriseApplication 项目,并带有一个带有简单 sayHello() 方法的测试无状态会话 ejb。
我还添加了 openEjb 库以便对 ejb 进行单元测试。一切运行良好,除了我不断收到以下错误:
Testsuite: com.myapp.test.NewEmptyJUnitTest
Apache OpenEJB 3.1.1 build: 20090530-06:18
http://openejb.apache.org/
INFO - openejb.home = C:\Users\me\Documents\NetBeansProjects\TestEnterpriseApp\TestEnterpriseApp-ejb
INFO - openejb.base = C:\Users\me\Documents\NetBeansProjects\TestEnterpriseApp\TestEnterpriseApp-ejb
INFO - Configuring Service(id=Default Security Service, type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Found ClientModule in classpath: C:\Program Files\NetBeans 6.7.1\java2\ant\lib\ant.jar
INFO - Found ClientModule in classpath: C:\Program Files\NetBeans 6.7.1\java2\ant\lib\ant-launcher.jar
INFO - Found EjbModule in classpath: C:\Users\me\Documents\NetBeansProjects\TestEnterpriseApp\TestEnterpriseApp-ejb\build\jar
INFO - Found ClientModule in classpath: C:\Users\me\Documents\NetBeansProjects\TestEnterpriseApp\lib\OpenEJB\xml-resolver-1.2.jar
INFO - Found ClientModule in classpath: C:\Users\me\Documents\Downloads\glassfish\lib\webservices-tools.jar
INFO - Beginning load: C:\Program Files\NetBeans 6.7.1\java2\ant\lib\ant.jar
INFO - Beginning load: C:\Program Files\NetBeans 6.7.1\java2\ant\lib\ant-launcher.jar
INFO - Beginning load: C:\Users\me\Documents\NetBeansProjects\TestEnterpriseApp\TestEnterpriseApp-ejb\build\jar
INFO - Beginning load: C:\Users\me\Documents\NetBeansProjects\TestEnterpriseApp\lib\OpenEJB\xml-resolver-1.2.jar
INFO - Beginning load: C:\Users\me\Documents\Downloads\glassfish\lib\webservices-tools.jar
INFO - Configuring enterprise application: classpath.ear
WARN - No application-client.xml found assuming annotations present: classpath.ear, module: ant.jar
WARN - No application-client.xml found assuming annotations present: classpath.ear, module: ant-launcher.jar
WARN - No application-client.xml found assuming annotations present: classpath.ear, module: xml-resolver-1.2.jar
WARN - No application-client.xml found assuming annotations present: classpath.ear, module: webservices-tools.jar
java.lang.Exception: Could not load 1/0/com/sun/codemodel/CodeWriter.class
at org.apache.xbean.finder.ClassFinder.readClassDef(ClassFinder.java:730)
....
事实证明,我以某种方式从某个地方获取了 glassfish 库 webservices-tools.jar,但我不知道如何摆脱它,这样每当我尝试运行任何 junit 测试时,我就不会得到一堆异常。
有没有人遇到过这个问题?你能帮我解决吗?
谢谢。