Okay - i really dont think i understand how the web services bits work.
I have created a test client to see if i can call the webservice previously created - this is still published as a WSDL at
http://127.0.0.1:8080/wstest2-ear-wstest2-ejb/HelloServiceBean?wsdl
I then have a simple ejb project (so i can use dependency injection from a managed class to get my WS - cant get the eclipse WSDL explorer to work - see previous). like this
package test;
import javax.ejb.Stateless;
import javax.xml.ws.WebServiceRef;
//included wstest2-ejb as depdent project to get import
import org.domain.wstest2.webservices.HelloServiceBean;
import org.domain.wstest2.webservices.*;
@Stateless
public class TestHelloBean implements TestHelloService, TestHelloServiceRemote
{
@WebServiceRef (HelloServiceBean.class)
private HelloServiceBean helloService;
public String sayHello()
{
String res = helloService.hello();
return res;
}
}
I set the java build path for the ejb to include the wstest-ejb project (which is part of the wstest2-ejb project) that builds the webservice (that i cant use properly from eclipse wsdl explorer - see earlier errors)
This allows the code to compile (i've tried using an interface defn rather than the private HelloServiceBean attribute with similar failures)
when i deploy the ejb to the server it fails with NoClassDefFOundError see below.
The documentation I see in books or seam ref manual make this sound easy - sadly for mere mortals i dont find it so.
Can some one help me how to overcome this (both from eclipse wsdl viewer, and or test client using @webServiceRef
I really need to get this going as I have to expose some methods to a colleague on a test project - and cant proceed at present
Thanks in advance
22:52:33,362 WARN [ServiceController] Problem starting service jboss.j2ee:service=EJB3,module=wsTestClient.jar
java.lang.NoClassDefFoundError: Lorg/domain/wstest2/webservices/HelloServiceBean;
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Unknown Source)
at java.lang.Class.getDeclaredFields(Unknown Source)
at org.jboss.injection.InjectionUtil.processFieldAnnotations
...
Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: org.domain.wstest2.webservices.HelloServiceBean
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
... 74 more
22:52:33,362 INFO [EJB3Deployer] Deployed: file:/E:/jboss/jboss-4.2.2.GA/server/default/deploy/wsTestClient.jar/
22:52:33,362 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@e2aae4cd { url=file:/E:/jboss/jboss-4.2.2.GA/server/default/deploy/wstest2-ear.ear/ }
deployer: org.jboss.deployment.EARDeployer@523be
status: null
state: FAILED
watch: file:/E:/jboss/jboss-4.2.2.GA/server/default/deploy/wstest2-ear.ear/
altDD: null
lastDeployed: 1206913077322
lastModified: 1206913075720
mbeans:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:service=EJB3,module=wsTestClient.jar
State: FAILED
Reason: java.lang.NoClassDefFoundError: Lorg/domain/wstest2/webservices/HelloServiceBean;
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:service=EJB3,module=wsTestClient.jar
State: FAILED
Reason: java.lang.NoClassDefFoundError: Lorg/domain/wstest2/webservices/HelloServiceBean;
and here is the genderated WSDL from the EAR deploy
- <definitions name="HelloService" targetNamespace="http://webservices.wstest2.domain.org/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservices.wstest2.domain.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <types>
- <xs:schema targetNamespace="http://webservices.wstest2.domain.org/" version="1.0" xmlns:tns="http://webservices.wstest2.domain.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sayHello" type="tns:sayHello" />
<xs:element name="sayHelloResponse" type="tns:sayHelloResponse" />
- <xs:complexType name="sayHello">
<xs:sequence />
</xs:complexType>
- <xs:complexType name="sayHelloResponse">
- <xs:sequence>
<xs:element minOccurs="0" name="helloResult" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</types>
- <message name="HelloServiceWS_sayHelloResponse">
<part element="tns:sayHelloResponse" name="sayHelloResponse" />
</message>
- <message name="HelloServiceWS_sayHello">
<part element="tns:sayHello" name="sayHello" />
</message>
- <portType name="HelloServiceWS">
- <operation name="sayHello" parameterOrder="sayHello">
<input message="tns:HelloServiceWS_sayHello" />
<output message="tns:HelloServiceWS_sayHelloResponse" />
</operation>
</portType>
- <binding name="HelloServiceWSBinding" type="tns:HelloServiceWS">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <operation name="sayHello">
<soap:operation soapAction="" />
- <input>
<soap:body use="literal" />
</input>
- <output>
<soap:body use="literal" />
</output>
</operation>
</binding>
- <service name="HelloService">
- <port binding="tns:HelloServiceWSBinding" name="HelloServiceWSPort">
<soap:address location="http://127.0.0.1:8080/wstest2-ear-wstest2-ejb/HelloService" />
</port>
</service>
</definitions>