2012-09-21 24 views
0

我想公開與Sun地鐵的服務,並且此服務將使用SSL使用第三方服務。 這些是我所遵循的步驟。JAX-WS與彈簧集成Jetty服務器

1)創建服務這是下面的代碼。

@WebService 
public class WMAssetAllocMSServiceImpl implements IWMAssetAllocMSService 
{ 
    Log log = LogFactory.getLog(getClass()); 

    @WebMethod 
    public MSGeographicAllocationResponse MSGetGeographicAllocation(
      MSAssetAllocRequest msAssetAllocRequest){ 

//user method implementation 
} 

2)的配置文件看起來如下

<beans xmlns="http://www.springframework.org/schema/beans" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns:context="http://www.springframework.org/schema/context" 

     xmlns:ws="http://jax-ws.dev.java.net/spring/core" 
     xmlns:wss="http://jax-ws.dev.java.net/spring/servlet" 
     xsi:schemaLocation="http://www.springframework.org/schema/beans 
     http://www.springframework.org/schema/beans/spring-beans-2.5.xsd 
     http://www.springframework.org/schema/aop 
     http://www.springframework.org/schema/aop/spring-aop-2.5.xsd 
     http://www.springframework.org/schema/tx 
     http://www.springframework.org/schema/tx/spring-tx-2.5.xsd 
     http://jax-ws.dev.java.net/spring/core 
     http://jax-ws.dev.java.net/spring/core.xsd 
     http://jax-ws.dev.java.net/spring/servlet 
     http://jax-ws.dev.java.net/spring/servlet.xsd 
     http://www.springframework.org/schema/context 
     http://www.springframework.org/schema/context/spring-context.xsd "> 

     <import resource="classpath:asset-alloc-svc-context.xml" /> 
    <import resource="classpath:wmAssetAllocServiceContext.xml" /> 
     <wss:binding url="/EtradeMS"> 
     <wss:service> 
     <ws:service bean="#wmAssetAllocMSService"/> 
     </wss:service> 
    </wss:binding> 
<context:annotation-config /> 

</beans> 
and the wmAssetAllocServiceContext.xml looks like the following 
<?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.5.xsd"> 


    <bean id="wmAssetAllocMSService" class="com.etrade.jws.wm.services.WMAssetAllocMSServiceImpl"/> 

</beans> 

3)POM文件看起來像

<dependency> 
     <groupId>com.sun.xml.ws</groupId> 
      <artifactId>jaxws-rt</artifactId> 
      <version>2.2.3</version> 
    </dependency> 
     <dependency> 
      <groupId>org.jvnet.jax-ws-commons.spring</groupId> 
      <artifactId>jaxws-spring</artifactId> 
      <version>1.8</version> 
      <exclusions> 
      <exclusion> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-core</artifactId> 
       </exclusion> 
       <exclusion> 
       <groupId>org.springframework</groupId> 
       <artifactId>spring-context</artifactId> 
       </exclusion> 
       <exclusion> 
       <groupId>com.sun.xml.stream.buffer</groupId> 
       <artifactId>streambuffer</artifactId> 
       </exclusion> 
       <exclusion> 
       <groupId>org.jvnet.staxex</groupId> 
       <artifactId>stax-ex</artifactId> 
       </exclusion> 
     </exclusions> 
     </dependency> 

與一些其它的依賴關係,但我假定上述依賴關係是用於與彈簧結合的下巴-WS

4)web.xml文件如下所示

<?xml version="1.0" encoding="UTF-8"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
    id="etrade-website" version="2.5"> 
    <display-name>JWS Asset Allocation Webservices</display-name> 
    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/applicationContext.xml</param-value> 
    </context-param> 
    <context-param> 
     <param-name>log4jConfigLocation</param-name> 
     <param-value>/WEB-INF/log4j.xml</param-value> 
    </context-param> 


    <servlet> 
     <servlet-name>jaxws-servlet</servlet-name> 
     <servlet-class>com.sun.xml.ws.transport.http.servlet.WSSpringServlet</servlet-class> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>jaxws-servlet</servlet-name> 
     <url-pattern>/EtradeMS</url-pattern> 
    </servlet-mapping> 
    <listener> 
     <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> 
    </listener> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 



</web-app> 

5),用於碼頭的上下文文件是碼頭-env.xml文件看起來如下

<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> 
<Configure class="org.mortbay.jetty.webapp.WebAppContext"> 


</Configure> 

它建立它之後在lib中創建一場戰爭,所有的罐子都在那裏。不知道這裏是什麼地方出了錯一些如何開始MVN碼頭的傑裏的同時:運行我得到以下錯誤

2012-09-20 11:49:39.935:WARN:oejw.WebAppContext:Failed startup of context o.m.j.p.JettyWebAppContext{/,file:/C:/DurgaCodeToDebug/jws-wm/jws-assetalloc/webapps/webservices/target/jws-wm-assetalloc-1.0/},C:\DurgaCodeToDebug\jws-wm\jws-assetalloc\webapps\webservices\target\jws-wm-assetalloc-1.0 
java.lang.reflect.InvocationTargetException 
    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:597) 
    at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85) 
    at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72) 
    at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:337) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1236) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:480) 
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:293) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.Server.doStart(Server.java:277) 
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511) 
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364) 
    at org.mortbay.jetty.plugin.JettyRunWarExplodedMojo.execute(JettyRunWarExplodedMojo.java:164) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    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:597) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: 
java.lang.IllegalStateException: Nothing to bind for name javax.sql.DataSource/default 
    at org.eclipse.jetty.plus.webapp.PlusDescriptorProcessor.bindEntry(PlusDescriptorProcessor.java:895) 
    at org.eclipse.jetty.plus.webapp.PlusDescriptorProcessor.bindResourceRef(PlusDescriptorProcessor.java:812) 
    at org.eclipse.jetty.plus.webapp.PlusDescriptorProcessor.visitResourceRef(PlusDescriptorProcessor.java:252) 
    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:597) 
    at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.visit(IterativeDescriptorProcessor.java:85) 
    at org.eclipse.jetty.webapp.IterativeDescriptorProcessor.process(IterativeDescriptorProcessor.java:72) 
    at org.eclipse.jetty.webapp.MetaData.resolve(MetaData.java:337) 
    at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1236) 
    at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:706) 
    at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:480) 
    at org.mortbay.jetty.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:293) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:172) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerCollection.doStart(HandlerCollection.java:229) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.doStart(HandlerWrapper.java:95) 
    at org.eclipse.jetty.server.Server.doStart(Server.java:277) 
    at org.mortbay.jetty.plugin.JettyServer.doStart(JettyServer.java:65) 
    at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) 
    at org.mortbay.jetty.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:511) 
    at org.mortbay.jetty.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:364) 
    at org.mortbay.jetty.plugin.JettyRunWarExplodedMojo.execute(JettyRunWarExplodedMojo.java:164) 
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    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:597) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 

可有一個人幫我在這裏。 不知道真正出了問題 順便說一句,這是鏈接我按照創建服務 http://www.mkyong.com/webservices/jax-ws/jax-ws-spring-integration-example/

+0

看起來像一些數據源綁定丟失或錯誤的基礎上的錯誤 - 「java.lang.IllegalStateException:沒有綁定的名稱javax.sql.DataSource /默認」 – randominstanceOfLivingThing

+0

我沒有任何數據源綁定在所有..thats什麼我很困惑 – swati

回答