Kousik Rajendran [
http://community.jboss.org/people/kousikraj] created the discussion
"JNDI Lookup fails in JBoss AS 7 [java.naming.CommunicationException]"
To view the discussion, visit:
http://community.jboss.org/message/637726#637726
--------------------------------------------------------------
Hi,
I have successfully created and deployed a datasource in my jboss as 7. I tested with
jboss CLI and I got the success message like
[standalone@localhost:9999 /]
/subsystem=datasources/data-source=java\:jboss\/datasources\/Test:test-connection-in-pool
{
"outcome" => "success",
"result" => [true]
}
But, when I try to access the same data source using the java code
DataSource ds = null;
Context ctx = null;
String strDSName = "java:jboss/datasources/Test";
try {
Properties env = new Properties();
env.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
env.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
env.setProperty("java.naming.provider.url",
"jnp://localhost:1099");
ctx = new InitialContext(env);
ds = (javax.sql.DataSource) ctx.lookup(strDSName);
} catch (Exception e) {
e.printStackTrace();
}
I am getting this error
javax.naming.CommunicationException: Receive timed out [Root exception is
java.net.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1302)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1382)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at c om.aayuwiz.clinic.tests.KousikTests.main(KousikTests.java:42)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive0(Native Method)
at java.net.PlainDatagramSocketImpl.receive(PlainDatagramSocketImpl.java:136)
at java.net.DatagramSocket.receive(DatagramSocket.java:712)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1272)
... 5 more
I have not done any changes to my *standalone.xml* under
*\JBOSS_HOME\standalone\configuration* directory.
Can someone help me out in this regards please. I have tried many forum threads and lot of
blogs in and out of
jboss.org sites. I am in a very critical situation to fix this issue
ASAP.
Thanks in Advance. Please let me know if you need more information.
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/637726#637726]
Start a new discussion in JNDI and Naming at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]