如何解决spring进程查找EJBJNDI端点的错误?

lvjbypge  于 2021-07-12  发布在  Java
关注(0)|答案(1)|浏览(293)

我有一个apachecamel-spring进程,它连接到jboss4.2.3应用服务器以获取ejb远程代理。以下是配置文件的xml片段:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:jee="http://www.springframework.org/schema/jee"
       xmlns:camel="http://camel.apache.org/schema/spring"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/jee
        http://www.springframework.org/schema/jee/spring-jee.xsd
        http://camel.apache.org/schema/spring
        http://camel.apache.org/schema/spring/camel-spring.xsd"
       default-lazy-init="true">

    <!-- ================================ -->
    <!-- EJB Components -->
    <!-- ================================ -->

    <jee:remote-slsb id="brokingReferenceService"
                     jndi-name="BrokingReferenceServiceBean/remote"
                     business-interface="com.company.command.ejb.BrokingReferenceService"/>

    <jee:remote-slsb id="strategyReferenceService"
                     jndi-name="StrategyReferenceServiceBean/remote"
                     business-interface="com.company.command.ejb.StrategyReferenceService"/>

    <jee:remote-slsb id="instantMessageOrderService"
                     jndi-name="InstantMessageOrderServiceBean/remote"
                     business-interface="com.company.command.ejb.InstantMessageOrderService"/>
    ...
</beans>

我在类路径中有一个jndi.properties文件,其中包含以下内容:

java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
java.naming.provider.url=http://10.10.0.240:1100

但当进程尝试查找jndi端点时,我收到以下错误:

2017-01-03 09:15:07.057 DEBUG (org.springframework.jndi.JndiTemplate) Looking up JNDI object with name [java:comp/env/BrokingReferenceServiceBean/remote]
2017-01-03 09:15:09.322 DEBUG (org.jnp.interfaces.NamingContext) Failed to connect to http:1099
javax.naming.CommunicationException: Failed to connect to server http:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.UnknownHostException: http]]
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:274)
        at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1533)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:634)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
        at javax.naming.InitialContext.lookup(InitialContext.java:417)
        at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:154)
        at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152)
        at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:178)
        at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95)
        at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
        at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.lookup(AbstractRemoteSlsbInvokerInterceptor.java:100)
        at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.refreshHome(AbstractSlsbInvokerInterceptor.java:122)
        at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.refreshHome(SimpleRemoteSlsbInvokerInterceptor.java:163)
        at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.afterPropertiesSet(AbstractSlsbInvokerInterceptor.java:109)
        ...
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server http:1099 [Root exception is java.net.U
nknownHostException: http]
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:248)
        ... 48 more
Caused by: java.net.UnknownHostException: http
        at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
        at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
        at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
        at java.net.InetAddress.getAllByName0(InetAddress.java:1276)
        at java.net.InetAddress.getAllByName(InetAddress.java:1192)
        at java.net.InetAddress.getAllByName(InetAddress.java:1126)
        at java.net.InetAddress.getByName(InetAddress.java:1076)
        at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:76)
        at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:244)
        ... 48 more

有人知道为什么它没有正确地获取url吗?我已在属性文件中定义了url,但它正在将url解析为“http:1099".
谢谢你的帮助。

yqyhoc1h

yqyhoc1h1#

试试这些:
java.naming.provider.url=jnp://10.10.0.240:1100 java.naming.provider.url=10.10.0.240:1100 请参阅此处的文档

相关问题