java - 如何解决JBoss Remote错误?

标签 java junit jboss compiler-errors

我试图在JUnit中远程运行JBoss,但出现错误:

Caused by: java.lang.VerifyError: Cannot inherit from final class



这是带有Remote的JUnit类的一部分:
import static org.junit.Assert.*;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import com.SessionManager;

public class Test1 {

    private static SessionManager _service;

    @BeforeClass
    public static void doSms() throws Exception {
        String JBOSS_CONTEXT = "org.jboss.naming.remote.client.InitialContextFactory";
        Properties properties = new Properties();
        properties.put(Context.INITIAL_CONTEXT_FACTORY, JBOSS_CONTEXT);
        properties.put(Context.PROVIDER_URL, "remote://localhost:4447");
        properties.put(Context.SECURITY_PRINCIPAL, "testuser");
        properties.put(Context.SECURITY_CREDENTIALS, "testpassword");
        _service = (SessionManager) new InitialContext(properties).lookup("java:global/SessionManager");
    }
}

最佳答案

此错误不属于JUnit 中的 JBoss Remote。

检查放在您的类路径中的所有必需的jar。

避免两个版本相同的jar之间发生冲突(不要添加两个不同版本的jar)。

关于java - 如何解决JBoss Remote错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25606198/

相关文章:

java - 如何在 Eclipse 中安装 Web 平台工具?

eclipse - 安装 Eclipse PDT,我没有 "Run As -> JUnit"

java - 需要有关开始使用 Junit 的建议

java - 为什么 Apache Flink 从数据流中删除事件?

java - Silverlight 与 JBoss WebService 的互操作问题

java - 想要在本地计算机的 JBoss 服务器中分析 Web 应用程序

java - 单元测试正确的数据结构创建

Java 对其他类的独占方法

java - JAX-RS Access-Control-Allow-Origin header 不存在,但已添加到 ResponseFilter 中

jboss - 将 JBoss AS 7 远程处理为 AS 4,反之亦然