Hello I'm trying my first web app with spring jax-ws
I've written this simple code:
web.xml
spring-ws-servlet.xmlCode:<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> <display-name>Archetype Created Web Application</display-name> <servlet> <servlet-name>spring-ws</servlet-name> <servlet-class>org.springframework.ws.transport.http.MessageDispatcherServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>spring-ws</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> </web-app>
EchoServiceEndpoint.javaCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean class="org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter"> <property name="baseAddress" value="http://localhost:8080/"/> </bean> <bean id="echoService" class="it.wingstech.gam3.webserver.EchoServiceImpl"> </bean> <bean id="echoServiceEndpoint" class="it.wingstech.gam3.webserver.EchoServiceEndpoint"> </bean> </beans>
Now my problems are the following:Code:/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package it.wingstech.gam3.webserver; import javax.jws.WebMethod; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import org.springframework.beans.factory.annotation.Autowired; /** * * @author kiuma */ @WebService(serviceName="echoService") @SOAPBinding(parameterStyle=SOAPBinding.ParameterStyle.BARE) public class EchoServiceEndpoint implements EchoService { @Autowired private EchoService echoService; @WebMethod @Override public String echo(String value) { return echoService.echo(value); } }
First it works only with jboss, If I try to run the servlet from Tomcat I have the following exception:
http://localhost:8080/webserver/echoService?wsdl
Why can't I run it in tomcat ?Code:avax.servlet.ServletException: Servlet.init() for servlet spring-ws threw exception org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:619) root cause org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter#0' defined in ServletContext resource [/WEB-INF/spring-ws-servlet.xml]: Invocation of init method failed; nested exception is com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.net.BindException: Address already in use org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) java.security.AccessController.doPrivileged(Native Method) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:402) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:316) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:282) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:126) javax.servlet.GenericServlet.init(GenericServlet.java:212) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) java.lang.Thread.run(Thread.java:619) root cause com.sun.xml.internal.ws.server.ServerRtException: Server Runtime Error: java.net.BindException: Address already in use com.sun.xml.internal.ws.transport.http.server.ServerMgr.createContext(ServerMgr.java:97) com.sun.xml.internal.ws.transport.http.server.HttpEndpoint.publish(HttpEndpoint.java:64) com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish(EndpointImpl.java:139) org.springframework.remoting.jaxws.SimpleJaxWsServiceExporter.publishEndpoint(SimpleJaxWsServiceExporter.java:67)
Then when run the code under jboss the web service wsdl is under this link:
http://localhost:8080/echoService?wsdl
Shouldn't it be
http://localhost:8080/webserver/echoService?wsdl
(being my servlet name webserver.war) ?
then:
I'd like the web service be under the following link:
http://localhost:8080/ws/echoService?wsdl
or
http://localhost:8080/webserver/ws/echoService?wsdl
but if I try to change
<property name="baseAddress" value="http://localhost:8080/"/>
to
<property name="baseAddress" value="http://localhost:8080/ws/"/>
it doesn't work, because I have the echo service wsdl under
http://localhost:8080/ws?wsdl
Please help! I've tried on #spring irc channel, but without any reply.
Thanks in advance,
kiuma


Reply With Quote
