[JBossWS] - JBoss & JAX-WS. Beginners Guide
by JGF1
Hi folks.
I've recently been finished reading a book called Beginning Java EE 5 Platform from Novice to Professional.
It contained an example using JAX-WS.
When I tried to locate one of the jars, I couldn't find it:
ie:jbossws.jar. According to book it's in jbossws.sar folder..
Tried compiling code without this but came across two errors based on jars in my classpath:
warning: [path] bad path element "c:\apps\jboss-4.2.2.ga\client\jsr173_1.0_api.jar": no such file or directory
warning: [path] bad path element "c:\apps\jboss-4.2.2.ga\client\jaxb1-impl.jar": no such file or directory
1) Wondered if someone could shed some light on this for me?
(The authors do state the JAX-WS was incomplete at the time the book was being written. I have downloaded jboss-4.2.2ga,
- Says no full implementations of JSR-181 WS meta-data for J EE 5/JAX-WS 2.0 formerly JAX-RPC. Book was published in 2006...)
These are the jars in my classpath:
c:\apps\jboss-4.2.2.ga\server\all\lib\servlet-api.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jsp-api.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\jbossws.sar\wsdl4j.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-jaxrpc.jar;
c:\apps\jboss-4.2.2.ga\lib\concurrent.jar;
c:\apps\jboss-4.2.2.ga\lib\jboss-common.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-j2ee.jar;
c:\apps\jboss-4.2.2.ga\lib\commons-httpclient.jar;
c:\apps\jboss-4.2.2.ga\client\jbossall-client.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-remoting.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-transaction.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jnpserver.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\ejb3.deployer\jboss-ejb3.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-ejb3x.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\jboss-aop-jdk50.deployer\jboss-aop-jdk50.jar;
c:\apps\jboss-4.2.2.ga\server\all\deploy\jboss-aop-jdk50.deployer\jboss-aspect-library-jdk50.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-common-client.jar;c:\apps\jboss-4.2.2.ga\client\jbosssx-client.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\ejb3-persistence.jar;C:\apps\apache-tomcat-6.0.16\lib\jsf-api.jar;
(The ones in bold I have just added. The ejb3 ones are the others they say are required as well as the missing jbossws.jar)
This was the example
| package webservices;
|
| import java.rmi.Remote;
|
| public interface SimpleService extends Remote
| {
| String echo(String input);
| }
|
| package webservices;
|
| import org.jboss.annotation.ejb.RemoteBinding;
| import org.jboss.ws.annotation.PortComponent;
|
| import javax.jws.WebMethod;
| import javax.jws.WebService;
| import javax.ejb.Remote;
| import javax.ejb.Stateless;
|
| @WebService(name = "EndpointInterface", targetNamespace = "http://localhost",
| serviceName = "SimpleService")
| @PortComponent(contextRoot="/jbosswsest", urlPattern="/*")
| @Remote(SimpleService.class)
| @Stateless
| public class SimpleServiceImpl implements SimpleService
| {
| @WebMethod
| public String echo(String input)
| {
| return input;
| }
| }
|
| package client;
|
| import webservices.SimpleService;
| import javax.xml.rpc.ServiceFactory;
| import javax.xml.rpc.Service;
| import javax.xml.namespace.QName;
| import java.net.URL;
|
| public class SimpleServiceClient {
| private static final String _namespace = "http://localhost";
| private static final String _service = "SimpleService";
| private static final String _wsdl = "http://localhost:8080/jbosswstest?wsdl";
|
| public static void main(String[] args) {
| try {
| URL defUrl = new URL(_wsdl);
| // Create the Service Factory
| ServiceFactory serviceFactory = ServiceFactory.newInstance();
| // Load the service implementation class
| Service remoteService = serviceFactory.createService(defUrl,
| new QName(_namespace, _service));
| // Load a proxy for our class
| SimpleService invoker =
| (SimpleService) remoteService.getPort(SimpleService.class);
| // Invoke our interface for each argument
| for (int i = 0; i < args.length; i++) {
| String returnedString = invoker.echo(args);
| System.out.println("sent string: " + args
| + ", received string: " + returnedString);
| }
| } catch (Exception e) {
| e.printStackTrace();
| }
| }
| }
|
My compile fails with the following:
| warning: [path] bad path element "c:\apps\jboss-4.2.2.ga\client\jsr173_1.0_api.jar": no such file or directory
| warning: [path] bad path element "c:\apps\jboss-4.2.2.ga\client\jaxb1-impl.jar": no such file or directory
| webservices\SimpleServiceImpl.java:3: package org.jboss.annotation.ejb does not exist
| import org.jboss.annotation.ejb.RemoteBinding;
| ^
| webservices\SimpleServiceImpl.java:4: package org.jboss.ws.annotation does not exist
| import org.jboss.ws.annotation.PortComponent;
| ^
| webservices\SimpleServiceImpl.java:13: cannot find symbol
| symbol: class PortComponent
| @PortComponent(contextRoot="/jbosswsest", urlPattern="/*")
| ^
| 3 errors
| 2 warnings
|
The book says you need the following to run client app:
c:\apps\jboss-4.2.2.ga\client\jboss-jaxrpc.jar;
c:\apps\jboss-4.2.2.ga\client\log4j.jar;
c:\apps\jboss-4.2.2.ga\client\logkit.jar;
c:\apps\jboss-4.2.2.ga\client\jbossws-client.jar;
c:\apps\jboss-4.2.2.ga\client\activation.jar;
c:\apps\jboss-4.2.2.ga\client\jboss-saaj.jar;
c:\apps\jboss-4.2.2.ga\client\mail.jar;
c:\apps\jboss-4.2.2.ga\client\wsdl4j.jar;
c:\apps\jboss-4.2.2.ga\lib\endorsed\xercesImpl.jar;
c:\apps\jboss-4.2.2.ga\client\jbossall-client.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\jboss-remoting.jar;
c:\apps\jboss-4.2.2.ga\server\all\lib\javax.servlet.jar
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135754#4135754
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135754
18 years, 1 month
[Beginners Corner] - Seam Integration Test failing new FacesRequest(){}
by leowenttechie
i am trying to use SeamTest for integration testing. what I am able to run Unit test cases. When I am trying to run Integration test cases then I am ending up in problem. This is the code snippet which I am trying to run in my test case :
@Test( alwaysRun=true )
public void testLoginPage() throws Exception
{
new FacesRequest("/security/login.xhtml")
{
@Override
protected void updateModelValues() throws Exception
{
System.out.println("helkjfskljdfsafdasfkhkajsfd");
assert "helo".equals( "helo" );
}
}.run();
}
When I am running this test case then this is the exception I am getting. I am not able to understand why is that :
[testng] FAILED: testLoginPage
[testng] javax.servlet.ServletException: ServletContext not allow to getResourceAsStream for /WEB-INF/web.xml
[testng] at org.ajax4jsf.framework.util.config.WebXml.(WebXml.java:104)
[testng] at org.ajax4jsf.framework.resource.ResourceBuilderImpl.init(ResourceBuilderImpl.java:183)
[testng] at org.ajax4jsf.framework.resource.InternetResourceService.init(InternetResourceService.java:96)
[testng] at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.getResourceService(BaseFilter.java:278)
[testng] at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:207)
[testng] at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
[testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
[testng] at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
[testng] at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
[testng] at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
[testng] at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:514)
[testng] at com.subexazure.spark.web.app.model.security.LoginTest.testLoginPage(LoginTest.java:11)
[testng] ... Removed 22 stack frames
What can I do to avoid this.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4135742#4135742
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4135742
18 years, 1 month