java.lang.ClassFormatError:在类文件javax / jms / JMSException中非本机或抽象的方法中的Absent Code属性

时间:2017-05-04 15:13:50

标签: java maven junit jms mockito

我在运行junit测试用例时遇到以下问题,该类如下:;

public class RoeSubmissionBeanTest {

RoeSubmissionBean roeSubmissionBean;
ServiceActivation serviceAct = new ServiceActivation();
UpdateTimeResponse updateTimeResponse = new UpdateTimeResponse();
RoEUpdateSuccessfulDT roeUpdateSucces;
MessageIdentification msgID;
ExchangeFaultData faultMessage;
@Before
public void setUp() throws Exception  {

//它在这一行上失败

    roeSubmissionBean = Mockito.mock(RoeSubmissionBean.class);
    serviceAct = Mockito.mock(ServiceActivation.class);
    updateTimeResponse =  Mockito.mock(UpdateTimeResponse.class);
    roeUpdateSucces =  Mockito.mock(RoEUpdateSuccessfulDT.class);
    doCallRealMethod().when(roeSubmissionBean).sendMessage(roeUpdateSucces, msgID, faultMessage);
}

主要方法是

public class RoeSubmissionBean {

private Logger logger = LoggerFactory.getLogger(RoeSubmissionBean.class);
private JMSSender sender = new JMSSender(RoeSubmissionBean.class);

}

我在这里尝试了一些问题,我必须将依赖放在POM中,但仍然会得到相同的错误

错误: java.lang.ClassFormatError:在类文件javax / jms / JMSException中非本机或抽象方法中的Absent Code属性

    {  at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at org.mockito.cglib.core.ReflectUtils.addAllMethods(ReflectUtils.java:349)
    at org.mockito.cglib.proxy.Enhancer.getMethods(Enhancer.java:422)
    at org.mockito.cglib.proxy.Enhancer.generateClass(Enhancer.java:457)

}

0 个答案:

没有答案