Client web-service deployed in jboss ass fails: Can not connect http client invoker. Connection refused:connect
tof-girardin Sep 29, 2010 2:27 AMHi,
I am trying to execute a web-service call within jboss 4.2.3 but i did not succeed.
I used cxf-plugin to generate stubs (maven):
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/target/jaxws</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/topologyDiscovery.wsdl</wsdl>
<extraargs>
<extraarg>-verbose</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
My topologyDiscovery.wsdl file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://disco.lte.spi.cms.ov.hp.com" xmlns:impl="http://disco.lte.spi.cms.ov.hp.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<xsd:schema>
<xsd:import namespace="http://disco.lte.spi.cms.ov.hp.com" schemaLocation="./topologyDiscovery.xsd"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="getTopologyRequest">
<wsdl:part name="param" element="impl:TopologyFilter"/>
</wsdl:message>
<wsdl:message name="getTopologyResponse">
<wsdl:part name="param" element="impl:listTopologyResponse"/>
</wsdl:message>
<wsdl:portType name="TopologyDiscovery">
<wsdl:operation name="GetTopology">
<wsdl:input message="impl:getTopologyRequest"/>
<wsdl:output message="impl:getTopologyResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TopologyDiscoveryServiceSoapBinding" type="impl:TopologyDiscovery">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetTopology">
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TopologyDiscoveryService">
<wsdl:port name="TopologyDiscoveryRequest" binding="impl:TopologyDiscoveryServiceSoapBinding">
<soap:address location="http://16.17.2.133:8092/TopologyDiscoveryService"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
and the schema file looks like:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:tns1="http://disco.lte.spi.cms.ov.hp.com"
targetNamespace="http://disco.lte.spi.cms.ov.hp.com">
<xsd:simpleType name="ComponentType">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="eNB"></xsd:enumeration>
<xsd:enumeration value="SGW"></xsd:enumeration>
<xsd:enumeration value="PGW"></xsd:enumeration>
<xsd:enumeration value="MME"></xsd:enumeration>
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="TopologyElement">
<xsd:sequence>
<xsd:element name="id" nillable="true" type="xsd:string"/>
<xsd:element name="name" nillable="true" type="xsd:string"/>
<xsd:element name="type" nillable="true" type="tns1:ComponentType"/>
<xsd:element name="location" nillable="true" type="xsd:string"/>
<xsd:element name="RANname" nillable="true" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TopologyElementArray">
<xsd:sequence>
<xsd:element maxOccurs="unbounded" name="topologyList" nillable="true" type="tns1:TopologyElement"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="listTopologyResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="list" nillable="true" type="tns1:TopologyElementArray"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="TopologyFilter">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="filter" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
So the following has been generated:
...
ComponentType.java
ListTopologyResponse.java
ObjectFactory.java
TopologyDiscovery.java
TopologyDiscoveryService.java
TopologyElement.java
TopologyElementArray.java
TopologyFilter.java
The class TopologyDiscoveryService.java is well defined based on javax.xml.ws.Service as follows:
import javax.xml.namespace.QName;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.Service;
@WebServiceClient(name = "TopologyDiscoveryService",
wsdlLocation = "file:/C:/telco-spi/hpovcms-lte-spi/trunk/dev/hpovcms-lte-spi-content/src/main/resources/topologyDiscovery.wsdl",
targetNamespace = "http://disco.lte.spi.cms.ov.hp.com")
public class TopologyDiscoveryService extends Service {
My client is a piece of code running in my jboss 4.2.3 and executed on scheduler periodic time:
LteDiscoScheduler.java
public class LteDiscoScheduler implements Schedulable
{
private static final Log log = LogFactory.getLog(LteDiscoScheduler.class);
private static String DISCO_URL = "classpath:/topologyDiscovery.wsdl";
private String name;
private long value;
private String url;
private DiscoveryService service = null;
/**
* Used ctor
*/
public LteDiscoScheduler(String name, long value, String url)
{
log.info("ctor, name: " + name + ", value: " + value);
this.name = name;
this.value = value;
this.url = url;
// Initialize the Service class
service = new DiscoveryService(url);
log.info("creation TopologyDiscoveryService");
}
/**
* Callback method invoked each iteration
*/
public void perform(Date now, long remainingRepetitions)
{
log.info("perform, now: " + now +
", remainingRepetitions: " + remainingRepetitions +
", name: " + name + ", value: " + value);
service.executeCall();
}
DiscoveryService.java
public class DiscoveryService {
private static final Log log = LogFactory.getLog(DiscoveryService.class);
TopologyDiscovery discoService;
String url;
public DiscoveryService(String url) {
log.info("DiscoveryService constructor");
this.url = url;
initializeService(url);
}
// Create the service client with specified wsdlurl
private void initializeService(String url) {
URL wsdlUrl = null;
try {
wsdlUrl = new URL(url);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
TopologyDiscoveryService topoDiscoService = new TopologyDiscoveryService(
wsdlUrl);
discoService = topoDiscoService.getTopologyDiscoveryRequest();
}
public void executeCall() {
log.info("executeCall: endPoint=" + url);
TopologyFilter param = new TopologyFilter();
param.setFilter("*"); // hard-coded for now
log.info("Sending executeCall request");
ListTopologyResponse resp = discoService.getTopology(param); => ERROR GENERATED
log.info("Response received");
TopologyElementArray array = resp.getList();
List<TopologyElement> list = array.getTopologyList();
for (TopologyElement element : list) {
log.info("One Topology object: id=" + element.getId() + "name="
+ element.getName() + "type=" + element.getType()
+ "location=" + element.getLocation() + "RANname="
+ element.getRANname());
// Access to DAO
}
}
I package all this into my ear and deploy it in JBOSS_HOIME/.../deploy
When the service is invoked, following error occurs:
16:37:22,133 INFO [Server] JBoss (MX MicroKernel) [4.3.0.GA_CP08 (build: SVNTag=JBPAPP_4_3_0_GA_CP08 date=201008161022)] Started in 48s:360ms
16:37:26,848 INFO [LteDiscoScheduler] perform, now: Tue Sep 28 16:37:19 CEST 20 10, remainingRepetitions: -1, name: Disco, value: 123456789
16:37:26,848 INFO [DiscoveryService] executeCall: endPoint=http://16.17.2.133:8 092/TopologyDiscoveryService?wsdl
16:37:26,848 INFO [DiscoveryService] Sending executeCall request
16:37:30,032 ERROR [Scheduler$Listener] Handling a Scheduler call failed
javax.xml.ws.WebServiceException: java.io.IOException: Could not transmit messag e
at org.jboss.ws.core.jaxws.client.ClientImpl.handleRemoteException(Clien
tImpl.java:307)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:245)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:16
4)
at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:15
0)
at $Proxy74.getTopology(Unknown Source)
at com.hp.ov.cms.spi.lte.disco.DiscoveryService.executeCall(DiscoverySer
vice.java:44)
at com.hp.ov.cms.spi.lte.disco.LteDiscoScheduler.perform(LteDiscoSchedul
er.java:50)
at org.jboss.varia.scheduler.Scheduler$Listener.handleNotification(Sched
uler.java:1251)
at sun.reflect.GeneratedMethodAccessor81.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.notification.NotificationListenerProxy.invoke(Notificati
onListenerProxy.java:153)
at $Proxy75.handleNotification(Unknown Source)
at javax.management.NotificationBroadcasterSupport.handleNotification(No
tificationBroadcasterSupport.java:257)
at javax.management.NotificationBroadcasterSupport$SendNotifJob.run(Noti
ficationBroadcasterSupport.java:322)
at javax.management.NotificationBroadcasterSupport$1.execute(Notificatio
nBroadcasterSupport.java:307)
at javax.management.NotificationBroadcasterSupport.sendNotification(Noti
ficationBroadcasterSupport.java:229)
at javax.management.timer.Timer.sendNotification(Timer.java:1237)
at javax.management.timer.Timer.notifyAlarmClock(Timer.java:1206)
at javax.management.timer.TimerAlarmClock.run(Timer.java:1289)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.io.IOException: Could not transmit message
at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnec
tionImpl.java:211)
at org.jboss.ws.core.client.SOAPRemotingConnection.invoke(SOAPRemotingCo
nnection.java:77)
at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:337)
at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:233)
... 20 more
Caused by: org.jboss.remoting.CannotConnectException: Can not connect http clien t invoker. Connection refused: connect.
at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnect
ion(HTTPClientInvoker.java:380)
at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPCli
entInvoker.java:149)
at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientI
nvoker.java:141)
at org.jboss.remoting.Client.invoke(Client.java:1935)
at org.jboss.remoting.Client.invoke(Client.java:788)
at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnec
tionImpl.java:190)
... 23 more
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:525)
at sun.net.NetworkClient.doConnect(NetworkClient.java:158)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
at sun.net.www.http.HttpClient.New(HttpClient.java:306)
at sun.net.www.http.HttpClient.New(HttpClient.java:323)
at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLC
onnection.java:860)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:801)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:726)
Additional Info:
I did not add any other libs to my jboss. Do i need to add jboss sw lib ?
I di not specify any config file (xml file) about my code to be able to make ws call where the service is implemented by other web-service ESB based. Do i need to specify any config file ?
Hope someone may help me,
Christophe