A migrating problem for JBoss 6 server / client application from ant to maven
guclu Nov 12, 2013 10:07 AMHello All,
This is the first time, I type a question. If this is the wrong place, sorry for it. I can carry whereever it is required.
We have a running server / client application which is based on JBoss AS 6.0.0. A few weeks ago I start to migrate from ant scripts to maven. Actually this process was successful upto some point. In our client application pom.xml , I tried to put jboss-as-client as it is given in the guides. But when I do that NameNotFoundException is thrown during the lookup for java:/ConnectionFactory . It is interesting to me because project is running without any problem when I use client jars in JBoss 6. In order to have a different check, I combined a jar file for jboss-allclient (which is the "client" directory coming with jboss as 6 distribution) and installed it in my maven repo. When I put it to my client application's pom.xml, no exception is thrown and client application is starting without any problem.
Environment:
In a windows server, JBOSS 6.0.0 AS EJB server application + in a windows computer, client application communicating with JMS,RMI
Here is the exception:
Caused by: aaa.MyException: RESOURCE:java:/ConnectionFactory not found/registered on Server JNDI!
at aaa.MyException.JndiResourceLookupHelper.lookup(JndiResourceLookupHelper.java:53)
at aaa.AbstractCommunicationManager.initializeJmsResources(AbstractCommunicationManager.java:60)
... 4 more
Caused by: javax.naming.NameNotFoundException: ConnectionFactory not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
at org.jnp.server.NamingServer.lookup(NamingServer.java:443)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:688)
at javax.naming.InitialContext.lookup(InitialContext.java:411)
at aaaaaaaaaaaaa.JndiResourceLookupHelper.lookup(JndiResourceLookupHelper.java:49)
... 5 more
Here is the pom.xml part for my client application:
<!-- Below is My combined jar from jboss as 6 distribution and necessary additional jars for compilation-->
<dependency>
<groupId>org.jboss.client</groupId>
<artifactId>jbossall-client</artifactId>
<version>6.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.jms</groupId>
<artifactId>jboss-jms-api_1.1_spec</artifactId>
<scope>compile</scope>
<version>1.0.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.0.Final</version>
</dependency>
<!-- Below is my try to replace my combined jar -->
<!-- <dependency>
<groupId>org.jboss.jbossas</groupId>
<artifactId>jboss-as-client</artifactId>
<version>6.0.0.Final</version>
<type>pom</type>
</dependency>
-->
My java code: P.S. I changed some parts as "aaa" and "My"
public final class JndiResourceLookupHelper {
private static InitialContext initialContext;
private static synchronized InitialContext getJNDIContext() {
if (initialContext==null) {
try {
initialContext = new InitialContext();
} catch (NoInitialContextException ex) {
throw new MyException("Naming Context not available or missing library in client applciation!", ex);
} catch (NamingException e) {
throw new MyException("Naming(JNDI) Context not available or missing library in client applciation!", e);
}
}
return initialContext;
}
/**
* Looks up the specified JNDI name.<br> Throws <class><b>MyException</b></class> if a problem is encountered during lookup.
* @param jndiResourceName
* @return Object
* @throws MyException
*/
public static Object lookup(String jndiResourceName) {
Object lookupResult = null;
try {
lookupResult = getJNDIContext().lookup(jndiResourceName);
} catch (CommunicationException ex) {
throw new MyException("Communication can not be established to Server! Check network and Server availability.", ex);
} catch (NameNotFoundException ex) {
throw new MyException("RESOURCE:"+jndiResourceName + " not found/registered on Server JNDI!", ex);
} catch (ServiceUnavailableException ex) {
throw new MyException("JNDI service not available on Server!", ex);
} catch (NamingException ex) {
throw new MyException("Error looking up RESOURCE:"+jndiResourceName, ex);
}
return lookupResult;
}
Question:
Am I missing any dependency?
Are all RMI and JMS related jars present in jboss-as-client dependency?
Is there any one else comfront such a problem before?
Any help is appreciated.
Thx for your time.
Guclu