2017-01-03 2 views
0

J'ai un processus Apache Camel Spring qui se connecte à un serveur d'applications JBoss 4.2.3 pour obtenir des proxies distants EJB. Voici l'extrait de code XML du fichier de configuration:Comment résoudre une erreur avec un processus Spring à la recherche d'un noeud final EJB JNDI?

<?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> 

J'ai un fichier jndi.properties dans le classpath, qui contient les éléments suivants:

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 

Mais je reçois l'erreur suivante lorsque le processus tente de rechercher le point final de 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 

est-ce que quelqu'un a une idée pourquoi il ne ramasse pas l'URL correctement? J'ai défini l'URL dans le fichier de propriétés, mais il analyse l'URL en tant que "http: 1099".

Merci pour votre aide.

+0

si vous essayez java.naming.provider.url = jnp: //10.10. 0.240: 1100 à la place? – hammerfest

Répondre

1

Essayez ces choses:

  • java.naming.provider.url=jnp://10.10.0.240:1100
  • java.naming.provider.url=10.10.0.240:1100

Voir la documentation here

+0

L'utilisation de "jnp: //10.10.0.240: 1100" a fonctionné comme un charme! Si j'ai un environnement en cluster, puis-je faire "jnp: //10.10.0.240: 1100, jnp: //10.10.0.241: 1100"? –

+0

Je ne pense pas ... dans la documentation il y a une section qui en parle – BrunoDM

+0

@JoseChavez, ne pas oublier de marquer la réponse comme acceptée et upvote-le SI cela correspond à votre question! – BrunoDM