cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot access remote service -java.net.ConnectException: Connection refused

Former Member
0 Kudos

Hello,

We have migrated J2EE application originally deployed on tomcat to Netweaver WAS 6.40 sp15. The application includes several open source components including the spring framework, axis(web services) and cocoon. After some minor adjustments concerning reading the spring config files and including the proper saxparser reference everything seems to work under Netweaver except for the following issue:

The application accesses external web services using axis. These web services are configured in spring config files within the application which identify the url to the web services. If I deploy the external web servies on the same physical machine as Netweaver and specify 'localhost:1718' in the configuration file everything works fine. If I specify the machine name or numeric ip address of the server (rather than 'localhost:1718') I receive the error message/stack trace below. I receive the same error message if I specify a remote host name on my network.My server is winXp running with-in dhcp network.

How can my application running in NWWAS get a connection to a hostname:port on my network ?

I have tried configuring resource entries and security entries with no luck.

Any help is greatly appreciated.

Steve Abramson

org.springframework.remoting.RemoteAccessException: Cannot access remote service [securityPort]; nested exception is org.apache.axis.AxisFault: ; nested exception is:

java.net.ConnectException: Connection refused: connect

AxisFault

faultCode: Server.userException

faultSubcode:

faultString: java.net.ConnectException: Connection refused: connect

faultActor:

faultNode:

faultDetail:

stackTrace:java.net.ConnectException: Connection refused: connect

at java.net.PlainSocketImpl.socketConnect(Native Method)

at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)

at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)

at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)

at java.net.Socket.connect(Socket.java:452)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:153)

at org.apache.axis.components.net.DefaultSocketFactory.create(DefaultSocketFactory.java:125)

at org.apache.axis.transport.http.HTTPSender.getSocket(HTTPSender.java:191)

at org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:404)

at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:138)

at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

at org.apache.axis.client.AxisClient.invoke(AxisClient.java:165)

at org.apache.axis.client.Call.invokeEngine(Call.java:2784)

at org.apache.axis.client.Call.invoke(Call.java:2767)

at org.apache.axis.client.Call.invoke(Call.java:2443)

at org.apache.axis.client.Call.invoke(Call.java:2366)

at org.apache.axis.client.Call.invoke(Call.java:1812)

at com.streamserve.web.services.provider.ws.security.SecurityBindingStub.authenticatePrincipal(SecurityBindingStub.java:884)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.springframework.remoting.rmi.RmiClientInterceptorUtils.doInvoke(RmiClientInterceptorUtils.java:103)

at org.springframework.remoting.rmi.RmiClientInterceptorUtils.invoke(RmiClientInterceptorUtils.java:71)

at org.springframework.remoting.jaxrpc.JaxRpcPortClientInterceptor.invoke(JaxRpcPortClientInterceptor.java:442)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)

at $Proxy235.authenticatePrincipal(Unknown Source)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:287)

at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)

at org.springmodules.cache.interceptor.caching.CachingInterceptor.invoke(CachingInterceptor.java:145)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)

at $Proxy236.authenticatePrincipal(Unknown Source)

at com.streamserve.web.services.DefaultDirectoryService.authenticate(DefaultDirectoryService.java:473)

at com.streamserve.web.services.security.DirectoryServiceAuthenticationDao.loadUserByUsernameAndPassword(DirectoryServiceAuthenticationDao.java:52)

at net.sf.acegisecurity.providers.dao.PasswordDaoAuthenticationProvider.getUserFromBackend(PasswordDaoAuthenticationProvider.java:298)

at net.sf.acegisecurity.providers.dao.PasswordDaoAuthenticationProvider.authenticate(PasswordDaoAuthenticationProvider.java:174)

at net.sf.acegisecurity.providers.ProviderManager.doAuthentication(ProviderManager.java:159)

at net.sf.acegisecurity.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:49)

at net.sf.acegisecurity.ui.webapp.AuthenticationProcessingFilter.attemptAuthentication(AuthenticationProcessingFilter.java:90)

at net.sf.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:287)

at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)

at com.streamserve.web.framework.security.servlet.WebServerAuthenticationIntegrationFilter.doFilter(WebServerAuthenticationIntegrationFilter.java:77)

at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)

at net.sf.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:226)

at net.sf.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:303)

at net.sf.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.java:173)

at net.sf.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.java:125)

at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:58)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:373)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Steve,

The exception you have pasted (Connection refused) means normally that you wanted to connect to a server but there was no one listening on the host/port you used.

You may want to double check that there is really someone listening on that server/port and you can connect from your Netweaver engine.

Just put those two lines in a test dummy JSP and from a standalone java client and see if you can connect :

Socket test = new Socket(host, port);

test.getInputStream()

HTH

Peter

Former Member
0 Kudos

Hello Peter,

Thanks for the reply. I have verified that myservice is listening to the server/port. I have an instance of my external services running on the same machine as nw (as well as an instance on another box for testing).

If I specify 'localhost:1718' everything works fine. If I specify 'myservername:1718' or 'my_ip_address:1718'then I receive the error message.

I'm looking for an answer like a security or resource setting my application needs to configure, or a nw service which needs to be configured or is in conflict. As I said I am using web services developed externally to nw. I include Axis jars within my application.

Port monitor and sniffer sees nothing coming out of my machine so I know nw is blocking this communication. I can ping/telnet the destination successfully(whether local or remote).

Any help appreciated.

Steve

Former Member
0 Kudos

Hi Steve,

I believe there is a standard security permission in java whether an application can open a socket, however I think that by default with NW that should be allowed.

You may want to check this by

calling

System.getSecurityManager().checkConnect(host, port)

from a JSP

if it throws a security exception than definetely the NW is guilty and is preventing your application to connect

Here are some links about the security and how you could search for this socket/connection opening right

http://help.sap.com/saphelp_webas630/helpdata/en/1f/c22bf8e11884498acff93c29a39358/content.htm

http://help.sap.com/saphelp_webas630/helpdata/en/40/97ffdb74939747b402b0200780cab5/frameset.htm

HTH

Peter

Former Member
0 Kudos

Did someone solve this issue? Got the same problem on NW 2004s within a SchedulerTask and some third-party webservice that really works for every system except our SAP portal.