简体   繁体   English

Spring-boot:运行正常,但java-jar不运行

[英]Spring-boot:run works but java-jar doesn't

The application is an integration WS (exposes an endpoint whose operations call a third-party WS). 该应用程序是一个集成WS(公开一个端点,其操作称为第三方WS)。 The application worked correctly with http, but when the third party added its own certificate and forced the use of https, it stopped working. 该应用程序可与http正常工作,但是当第三方添加其自己的证书并强制使用https时,它将停止工作。

I have created the jks, and I have managed to generate the third-party wsdl classes. 我已经创建了jks,并且设法生成了第三方wsdl类。 The application compiles and executes mvn spring-boot: run -Djavax.net.ssl.trustStore = MiJks.jks works correctly. 该应用程序编译并执行mvn spring-boot: run -Djavax.net.ssl.trustStore = MiJks.jks正常工作。 On the other hand, if I use java -jar Miapp.jar -Djavax.net.ssl.trustStore = MiJks.jks , it is not able to create the beans of the 3rd services. 另一方面,如果使用java -jar Miapp.jar -Djavax.net.ssl.trustStore = MiJks.jks ,则无法创建第三项服务的bean。

To generate the wsdl code of the 3rd, I use jaxws-maven-plugin from codehaus. 为了生成第三个的wsdl代码,我使用了来自Codehaus的jaxws-maven-plugin。

This is the definition of the bean within the application-context: 这是应用程序上下文中bean的定义:

<bean id="teleoptiInternalService"
        class="org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean">
        <property name="serviceInterface"
            value="com.teleopti.ccc.schemas.sdk._2010._04.TeleoptiCccSdkInternal" />
        <property name="wsdlDocumentUrl"
             value="https://WTWFMWEB01.comunicaciones.tel/TeleoptiWFM/SDK/TeleoptiCccSdkService.svc?wsdl" />
        <property name="serviceName" value="TeleoptiCccSdkService" />
        <property name="portName" value="TeleoptiOrganizationService1" />
        <!-- TODO Endpoint URL should be in a properties file -->
        <property name="endpointAddress"
            value="https://WTWFMWEB01.comunicaciones.tel/TeleoptiWFM/SDK/TeleoptiCccSdkService.svc" />
        <property name="handlerResolver" ref="wsHandlerResolver" />
        <property name="portFeatures">
            <bean class="org.apache.cxf.feature.LoggingFeature" />
        </property>
    </bean>

This is the error showed : 这是显示的错误:

2018-05-28 10:32:55.623  WARN 2172 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'teleoptiInternalService' defined in class path resource [applicationContext-teleopti-integration.xml]: Invocation of init method failed; nested exception is javax.xml.ws.WebServiceException: org.apache.cxf.service.factory.ServiceConstructionException: Failed to create service.

What's wrong? 怎么了? What's the difference between running java through maven and running the java directly? 通过maven运行Java和直接运行Java有什么区别?

Thanks 谢谢

解决方案:在执行Java命令时将-D放在-jar之前

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM