为什么Spring-Boot应用程序会冻结创建CXF SOAP服务步骤?

时间:2016-02-10 15:37:45

标签: java spring-boot wsdl embedded-tomcat-8

我有一个jar文件,可以在本地计算机上启动(Windows 7)。但是,当我在另一个(使用Win Server 2008的测试服务器)上运行它时,应用程序在“创建服务”步骤中冻结:

C:\app_services>java -jar appservices-2.0.0.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.3.2.RELEASE)

10.02.2016 18:25:38.492 INFO  Application:48 - Starting Application on TESTSERV1 with PID 2520 (C:\app_services\appservices-2.0.0.jar started by Administrator in C:\app_services)
10.02.2016 18:25:38.501 INFO  Application:666 - No active profile set, falling back to default profiles: default
10.02.2016 18:25:38.599 INFO  AnnotationConfigEmbeddedWebApplicationContext:578 - Refreshing org.springframework.boot.co
ntext.embedded.AnnotationConfigEmbeddedWebApplicationContext@5bd5c1ed: startup date [Wed Feb 10 18:25:38 MSK 2016]; root
 of context hierarchy
10.02.2016 18:25:39.003 INFO  Version:17 - HV000001: Hibernate Validator 5.2.2.Final
10.02.2016 18:25:40.484 INFO  DefaultListableBeanFactory:839 - Overriding bean definition for bean 'beanNameViewResolver
' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=
3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.
ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null;
 destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoCo
nfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=fal
se; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.a
utoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMet
hodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/W
ebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
10.02.2016 18:25:42.412 INFO  TomcatEmbeddedServletContainer:81 - Tomcat initialized with port(s): 23322 (http)
10.02.2016 18:25:42.453 INFO  StandardService:180 - Starting service Tomcat
10.02.2016 18:25:42.457 INFO  StandardEngine:180 - Starting Servlet Engine: Apache Tomcat/8.0.30
10.02.2016 18:25:42.760 INFO  [/]:180 - Initializing Spring embedded WebApplicationContext
10.02.2016 18:25:42.762 INFO  ContextLoader:272 - Root WebApplicationContext: initialization completed in 4177 ms
10.02.2016 18:25:44.208 INFO  ServletRegistrationBean:189 - Mapping servlet: 'CXFServlet' to [/appservices/*]
10.02.2016 18:25:44.223 INFO  FilterRegistrationBean:258 - Mapping filter: 'metricFilter' to: [/*]
10.02.2016 18:25:44.225 INFO  FilterRegistrationBean:258 - Mapping filter: 'characterEncodingFilter' to: [/*]
10.02.2016 18:25:44.226 INFO  FilterRegistrationBean:258 - Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
10.02.2016 18:25:44.227 INFO  FilterRegistrationBean:258 - Mapping filter: 'httpPutFormContentFilter' to: [/*]
10.02.2016 18:25:44.228 INFO  FilterRegistrationBean:258 - Mapping filter: 'requestContextFilter' to: [/*]
10.02.2016 18:25:44.231 INFO  FilterRegistrationBean:258 - Mapping filter: 'webRequestLoggingFilter' to: [/*]
10.02.2016 18:25:44.232 INFO  FilterRegistrationBean:258 - Mapping filter: 'applicationContextIdFilter' to: [/*]
10.02.2016 18:25:44.966 INFO  ReflectionServiceFactoryBean:388 - Creating Service {http://new.webservice.namespace}CompServiceForPCO from WSDL: classpath:CompService.wsdl

在此步骤中,应用程序将进入sopor ......

你知道为什么吗? 你能推荐一些解决方法来“解冻”应用程序吗?

做了什么: 1.打包期间更改了Java版本(mvn clean package

<properties>
        <jdkName>JavaSE-1.8</jdkName>
        <jdk.version>1.8</jdk.version>
</properties>

到1.7(这是服务器上的java版本)
2.将wsdl中的地址位置值更改为http://servername:8080

<wsdl:port name="CompServiceEndPoind" binding="tns:CompServiceSOAP">
            <soap:address location="http://localhost:8080/appservices/ws"/>
</wsdl:port>

更新

哇!它在睡眠10分钟后开始,下一个例外:

Caused by: java.net.ConnectException: Connection refused: connect
        at java.net.DualStackPlainSocketImpl.connect0(Native Method)
        at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
        at java.net.PlainSocketImpl.connect(Unknown Source)
        at java.net.SocksSocketImpl.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at java.net.Socket.connect(Unknown Source)
        at sun.net.NetworkClient.doConnect(Unknown Source)
        at sun.net.www.http.HttpClient.openServer(Unknown Source)
        at sun.net.www.http.HttpClient.openServer(Unknown Source)
        at sun.net.www.http.HttpClient.<init>(Unknown Source)
        at sun.net.www.http.HttpClient.New(Unknown Source)
        at sun.net.www.http.HttpClient.New(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
        at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
        at com.ibm.wsdl.xml.WSDLReaderImpl.getDocument(WSDLReaderImpl.java:2188)

1 个答案:

答案 0 :(得分:1)

问题出在wsdl的<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>中。应用程序无法在jar或外部找到此导入。所以我只是评论这个字符串,现在就可以了。