java ClassNotFoundException:JUnit 测试中的 com.ibm.ejs.ras.hpel.HpelHelper(使用瘦客户端)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25759045/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
ClassNotFoundException: com.ibm.ejs.ras.hpel.HpelHelper in JUnit test (with thinclient)
提问by Danubian Sailor
I have JUnit test (some would call that 'integration test) that test the REST service for file upload/download. I'm using Apache WINK from standart Websphere 8.5 libraries:
我有 JUnit 测试(有些人称之为“集成测试”)来测试文件上传/下载的 REST 服务。我正在使用标准 Websphere 8.5 库中的 Apache WINK:
ClientConfig config = new ClientConfig();
LtpaAuthSecurityHandler secHandler = new LtpaAuthSecurityHandler();
secHandler.setUserName(user);
secHandler.setPassword(password);
secHandler.setSSLRequired(false);
config.handlers(secHandler);
RestClient client = new RestClient(config);
But I get the exception:
但我得到了例外:
java.lang.ClassNotFoundException: com.ibm.ejs.ras.hpel.HpelHelper
java.lang.ClassNotFoundException: com.ibm.ejs.ras.hpel.HpelHelper
I'm using the following test dependencies:
我正在使用以下测试依赖项:
<dependency>
<groupId>com.ibm.was</groupId>
<artifactId>com.ibm.ws.jpa.thinclient</artifactId>
<version>8.5.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
What I'm missing here? The tested code works fine when deployed on WebSphere, but doesn't work as stand-alone junit test (or main function) that uses thinclient..
我在这里缺少什么?测试的代码在部署在 WebSphere 上时工作正常,但不能作为使用瘦客户端的独立 junit 测试(或主函数)工作。
回答by Atreides_Arrakis
I encountered the same error. To fix it I added these dependencies:
我遇到了同样的错误。为了修复它,我添加了这些依赖项:
<classpathentry kind="lib" path="lib/com.ibm.jaxws.thinclient_8.5.0.jar"/>
<classpathentry kind="lib" path="lib/com.ibm.ws.admin.client_8.5.0.jar"/>
<classpathentry kind="lib" path="lib/com.ibm.ws.webservices.thinclient_8.5.0.jar"/>
回答by Kishore Tulsiani
I was getting same exception and it got resolved after I have added following.
我遇到了同样的异常,在我添加以下内容后它得到了解决。
<dependency>
<groupId>com.ibm.jaxws</groupId>
<artifactId>thinclient</artifactId>
<version>8.0.0</version>
<scope>provided</scope>
</dependency>