0

我正在尝试迁移 JBoss 4.2.2 应用程序或 6.1.0.FINAL,但在配置 hornetq 时遇到了一些困难。首先,这是我得到的例外:

12:32:26,133 ERROR [STDERR] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
12:32:26,133 ERROR [STDERR] java.lang.ClassNotFoundException: org.jboss.mq.referenceable.ObjectRefAddr (no security manager: RMI class loader disabled)]]
12:32:26,134 ERROR [STDERR] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1356)
12:32:26,134 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:819)
12:32:26,134 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
12:32:26,134 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:392)
12:32:26,134 ERROR [STDERR] at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
12:32:26,134 ERROR [STDERR] at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
12:32:26,134 ERROR [STDERR] at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
12:32:26,135 ERROR [STDERR] at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
12:32:26,135 ERROR [STDERR] at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
12:32:26,135 ERROR [STDERR] at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
12:32:26,135 ERROR [STDERR] at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:201)
12:32:26,135 ERROR [STDERR] at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:187)
12:32:26,135 ERROR [STDERR] at com.myCompany.util.external.domainObject.patch.JmsTemplateFactory.init(JmsTemplateFactory.java:66)
12:32:26,135 ERROR [STDERR] at com.myCompany.util.external.domainObject.patch.JmsTemplateFactory.<init>(JmsTemplateFactory.java:43)
12:32:26,136 ERROR [STDERR] at com.myCompany.util.external.patch.ObjectMessageReceiver.start(ObjectMessageReceiver.java:53)
12:32:26,136 ERROR [STDERR] at com.myCompany.util.external.patch.ObjectMessageReceiver.run(ObjectMessageReceiver.java:37)
12:32:26,136 ERROR [STDERR] at org.jboss.resource.work.WorkWrapper.run(WorkWrapper.java:172)
12:32:26,136 ERROR [STDERR] at org.jboss.threads.SimpleDirectExecutor.execute(SimpleDirectExecutor.java:33)
12:32:26,136 ERROR [STDERR] at org.jboss.threads.CleanupExecutor.execute(CleanupExecutor.java:38)
12:32:26,136 ERROR [STDERR] at org.jboss.threads.CleanupExecutor.execute(CleanupExecutor.java:38)
12:32:26,137 ERROR [STDERR] at org.jboss.threads.QueuelessExecutor$Worker.run(QueuelessExecutor.java:614)
12:32:26,137 ERROR [STDERR] at java.lang.Thread.run(Thread.java:662)
12:32:26,137 ERROR [STDERR] at org.jboss.threads.JBossThread.run(JBossThread.java:122)
12:32:26,137 ERROR [STDERR] Caused by: javax.naming.CommunicationException [Root exception is java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
12:32:26,137 ERROR [STDERR] java.lang.ClassNotFoundException: org.jboss.mq.referenceable.ObjectRefAddr (no security manager: RMI class loader disabled)]
12:32:26,138 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:841)
12:32:26,138 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
12:32:26,138 ERROR [STDERR] at javax.naming.InitialContext.lookup(InitialContext.java:392)
12:32:26,138 ERROR [STDERR] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:1350)
12:32:26,138 ERROR [STDERR] ... 22 more
12:32:26,139 ERROR [STDERR] Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
12:32:26,139 ERROR [STDERR] java.lang.ClassNotFoundException: org.jboss.mq.referenceable.ObjectRefAddr (no security manager: RMI class loader disabled)
12:32:26,139 ERROR [STDERR] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:178)
12:32:26,139 ERROR [STDERR] at org.jboss.ha.framework.server.HARMIServerImpl_Stub.invoke(Unknown Source)
12:32:26,139 ERROR [STDERR] at org.jboss.ha.framework.interfaces.HARMIClient.invokeRemote(HARMIClient.java:225)
12:32:26,139 ERROR [STDERR] at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:327)
12:32:26,140 ERROR [STDERR] at $Proxy210.lookup(Unknown Source)
12:32:26,140 ERROR [STDERR] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
12:32:26,140 ERROR [STDERR] ... 25 more
12:32:26,140 ERROR [STDERR] Caused by: java.lang.ClassNotFoundException: org.jboss.mq.referenceable.ObjectRefAddr (no security manager: RMI class loader disabled)
12:32:26,141 ERROR [STDERR] at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:373)
12:32:26,141 ERROR [STDERR] at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:163)
12:32:26,141 ERROR [STDERR] at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
12:32:26,141 ERROR [STDERR] at org.jboss.system.JBossRMIClassLoader.loadClass(JBossRMIClassLoader.java:91)
12:32:26,141 ERROR [STDERR] at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
12:32:26,141 ERROR [STDERR] at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
12:32:26,142 ERROR [STDERR] at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
12:32:26,142 ERROR [STDERR] at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
12:32:26,142 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
12:32:26,142 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
12:32:26,142 ERROR [STDERR] at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1666)
12:32:26,142 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1322)
12:32:26,143 ERROR [STDERR] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
12:32:26,143 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
12:32:26,143 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
12:32:26,143 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
12:32:26,143 ERROR [STDERR] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
12:32:26,143 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
12:32:26,144 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
12:32:26,144 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
12:32:26,144 ERROR [STDERR] at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1946)
12:32:26,144 ERROR [STDERR] at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1870)
12:32:26,144 ERROR [STDERR] at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1752)
12:32:26,144 ERROR [STDERR] at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
12:32:26,144 ERROR [STDERR] at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
12:32:26,145 ERROR [STDERR] at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
12:32:26,145 ERROR [STDERR] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155)
12:32:26,145 ERROR [STDERR] ... 30 more 

我的 hornetq-jms.xml 非常标准:

<configuration xmlns="urn:hornetq"  
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
            xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">  
        <connection-factory name="NettyConnectionFactory">  
           <connectors>  
                 <connector-ref connector-name="netty"/>  
           </connectors>  
           <entries>  
                 <entry name="/ConnectionFactory"/>  
                 <entry name="/XAConnectionFactory"/>  
           </entries>  
        </connection-factory>  
<!-- JMS destination definitions updated for JBossAS using HornetQ -->  
    <queue name="myQueuet">  
        <entry name="/queue/myQueue"/>  
    </queue>  
</configuration>  

以下是我的 jmsTemplateFactory 的相关部分:

    public JmsTemplateFactory(String url, String queueName) {  
        this.url = url;  
        this.queueName = queueName;  
        init();  
    }  

    public void init() {  
        logger.info("\nINIT JMS TEMPLATE...url= " + url + ", queueName: " + queueName);  
        // JndiTemplate  
        JndiTemplate jndiTemplate = new JndiTemplate();  
        Properties environment = new Properties();  
        environment.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");  
        environment.put("java.naming.factory.url.pkgs", "org.jnp.interfaces:org.jboss.naming");  
        environment.put("java.naming.provider.url", url);  
        jndiTemplate.setEnvironment(environment);  

        // JMS Queue Connection Factory  
        JndiObjectFactoryBean jndiObjectFactoryBean = new JndiObjectFactoryBean();  
        jndiObjectFactoryBean.setJndiTemplate(jndiTemplate);  
        jndiObjectFactoryBean.setJndiName("UIL2ConnectionFactory");  

        // JMS Destination   
        JndiObjectFactoryBean jndiObjectFactoryBean2 = new JndiObjectFactoryBean();  
        jndiObjectFactoryBean2.setJndiTemplate(jndiTemplate);  
        jndiObjectFactoryBean2.setJndiName(queueName);  
        try {  
            jndiObjectFactoryBean.afterPropertiesSet();  
            jndiObjectFactoryBean2.afterPropertiesSet();  
        } catch (IllegalArgumentException e) {  
            e.printStackTrace();  
        } catch (NamingException e) {  
            e.printStackTrace();  
        }  

        logger.info("Queue name is " + queueName);  

        // JMS Queue Template  
        jmsTemplate = new JmsTemplate102();  
        jmsTemplate.setConnectionFactory((ConnectionFactory) jndiObjectFactoryBean.getObject());  
        jmsTemplate.setDefaultDestination((Destination) jndiObjectFactoryBean2.getObject());  
        jmsTemplate.setReceiveTimeout(30000);         
    }  

    public JmsTemplate102 getJmsTemplate(String url, String queueName) {   
        this.url = url;  
        this.queueName = queueName;  
        init();  
        return jmsTemplate;   
    }  

任何人都知道为什么会产生这个异常?

4

1 回答 1

1

您在配置中引用 JBoss MQ 对象。修复您的配置和服务器的安装,您应该会很好。

于 2012-12-11T20:35:39.413 回答