aspose file tools*
The moose likes JBoss/WildFly and the fly likes javax.naming.CommunicationException:Could not obtain connection to any of these urls:localhost:1099 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "javax.naming.CommunicationException:Could not obtain connection to any of these urls:localhost:1099" Watch "javax.naming.CommunicationException:Could not obtain connection to any of these urls:localhost:1099" New topic
Author

javax.naming.CommunicationException:Could not obtain connection to any of these urls:localhost:1099

Vivek Kumar Rai
Greenhorn

Joined: Mar 21, 2012
Posts: 1
I am trying to deploy my war file in JBoss-as-7.1.1 but after deployment when i send the request from client i am getting some error


My Log file is here:-

13:59:53,725 INFO [stdout] (http--127.0.0.1-8080-1) BusinessClass::sendResponse Starts...
13:59:53,746 INFO [stdout] (http--127.0.0.1-8080-1) Got Initial Context
13:59:58,763 ERROR [stderr] (http--127.0.0.1-8080-1) javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
13:59:58,771 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1452)
13:59:58,805 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:597)
13:59:58,812 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:590)
13:59:58,814 ERROR [stderr] (http--127.0.0.1-8080-1) at javax.naming.InitialContext.lookup(InitialContext.java:392)
13:59:58,849 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.jsp.response_jsp._jspService(response_jsp.java:118)
13:59:58,851 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
13:59:58,852 ERROR [stderr] (http--127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
13:59:58,860 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
13:59:58,862 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
13:59:58,863 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
13:59:58,885 ERROR [stderr] (http--127.0.0.1-8080-1) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
13:59:58,887 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
13:59:58,897 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
13:59:58,899 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
13:59:58,906 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
13:59:58,908 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153)
13:59:58,916 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
13:59:58,918 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
13:59:58,920 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
13:59:58,934 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
13:59:58,942 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
13:59:58,943 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
13:59:58,946 ERROR [stderr] (http--127.0.0.1-8080-1) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
13:59:58,954 ERROR [stderr] (http--127.0.0.1-8080-1) at java.lang.Thread.run(Thread.java:662)
13:59:58,956 ERROR [stderr] (http--127.0.0.1-8080-1) Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
13:59:58,967 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:272)
13:59:58,969 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1423)
13:59:58,970 ERROR [stderr] (http--127.0.0.1-8080-1) ... 23 more
13:59:58,971 ERROR [stderr] (http--127.0.0.1-8080-1) Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
13:59:58,974 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:246)
13:59:58,975 ERROR [stderr] (http--127.0.0.1-8080-1) ... 24 more
13:59:58,985 ERROR [stderr] (http--127.0.0.1-8080-1) Caused by: java.net.ConnectException: Connection refused
13:59:58,986 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.PlainSocketImpl.socketConnect(Native Method)
13:59:58,988 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:351)
13:59:58,989 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:213)
13:59:58,991 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:200)
13:59:58,997 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
13:59:58,998 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.Socket.connect(Socket.java:529)
13:59:59,009 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.Socket.connect(Socket.java:478)
13:59:59,013 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.Socket.<init>(Socket.java:375)
13:59:59,014 ERROR [stderr] (http--127.0.0.1-8080-1) at java.net.Socket.<init>(Socket.java:276)
13:59:59,015 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:84)
13:59:59,021 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:77)
13:59:59,025 ERROR [stderr] (http--127.0.0.1-8080-1) at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:242)
13:59:59,026 ERROR [stderr] (http--127.0.0.1-8080-1) ... 24 more



My code is given below:-

Properties p = new Properties();
System.out.println("BusinessClass::sendResponse Starts...");
HashMap ack_gateway=null;
try {
p.setProperty("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
p.setProperty("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
p.setProperty("java.naming.provider.url", "localhost:1099");
Context ctx = new InitialContext(p);
System.out.println("Got Initial Context");
SPResponseEJBHome home = (SPResponseEJBHome) PortableRemoteObject.narrow(ctx.lookup ("SPConnectorResponseComponent"),SPResponseEJBHome.class);
//SPResponseEJBHome home = (SPResponseEJBHome) ctx.lookup("SPConnectorResponseComponent");
System.out.println("BusinessClass::sendResponse Starts...");

System.out.println("Got Home object");
SPResponseEJBRemote remote = home.create();
System.out.println("Got Remote object");

//process
System.out.println("Hi 1");
String targetEndPoint=(String)request.getParameter("targetEndPoint");

String classid=(String)request.getParameter("classid");

String corelationid=(String)request.getParameter("corelationid");

String transactionID=(String)request.getParameter("TransactionID");

String result=(String)request.getParameter("result");
Object resxml = null;
resxml = XmlObject.Factory.parse(result.toString().trim());
System.out.println("Hi 2");
CommitResponse commitResponse=new CommitResponse();
commitResponse.setTargetEndPointURL(targetEndPoint);
commitResponse.setTransactionId(transactionID);
commitResponse.setCorrelationId(corelationid);
commitResponse.setClassId(classid);
commitResponse.setResponseType(ResponseType.RESPONSE);
commitResponse.setMessageBody(resxml);
System.out.println("calling EJB");
System.out.println("Hi 3");
ReturnResponse returnResponse = new ReturnResponse();
returnResponse=remote.makeSubmitResponse(commitResponse);
System.out.println("Hi 4");
//STATUS=RESUBMIT
if (returnResponse.getStatus().equals(RequestStatus.RESUBMIT))
{
System.out.println("status: "+returnResponse.getStatus());
System.out.println("Reason:"+returnResponse.getReason());
}
//STATUS=FAILED
else if (returnResponse.getStatus().equals(RequestStatus.FAILED))
{
System.out.println("i am end of exec"+ returnResponse.getStatus());
String[] erorResponse= returnResponse.getErrors();
for(int i=0;i<erorResponse.length;i++)
{
System.out.println("printing error :"+erorResponse[i] );
}
}

// Status =SUCESS
else if (returnResponse.getStatus().equals(RequestStatus.SUCCESS))
{
out.println("status :"+ returnResponse.getStatus());
out.println("correlationId :"+ returnResponse.getCorrelationId());
out.println("TransactionID :"+ returnResponse.getTransactionId());
out.println("AuditID :"+ returnResponse.getAuditId());
}


} catch (Exception e) {
e.printStackTrace();
}

Any one have idea please try to help me.
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: javax.naming.CommunicationException:Could not obtain connection to any of these urls:localhost:1099