2017-03-20 31 views
0

응용 프로그램 용 spring webservices를 작성하고 있습니다. 전쟁을 만들기 위해 webservices와 maven을 생성하기 위해 아파치 cxf를 사용하고 있습니다. weblogic 12c를 사용하여 내 PC에 webservice를 배포하고 있습니다. 나는 "org.codehaus.jackson.jaxrs.JacksonJsonProvider"를 jsonProvider로 사용하고 있습니다. 코드는 오류없이 서버를 실행중인 시스템에 배포됩니다. 하지만 난 배포가 다음 오류와 함께 실패 웹 로직 12.2.1을 가지고있는 클라이언트 시스템에서 동일한 코드를 배포 할 때 :Apache CXF를 사용하는 Spring Webservices가 클라이언트 서버 (weblogic)에 배포되지 않습니다.

"Jersey" failed to preload on startup in Web application: "broker-ws.war".

<[ACTIVE] ExecuteThread: '12' for queue: 'weblogic.kernel.Default (self-tuning)'> <<WLS Kernel>> <> <> <1490020025257> <BEA-101216> <Servlet: "Jersey" failed to preload on startup in Web application: "broker-ws.war". 
    at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170) 
    at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136) 
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:491) 
    at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:321) 
    at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:605) 
    at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:207) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:376) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:559) 
    at javax.servlet.GenericServlet.init(GenericServlet.java:240) 
    at weblogic.jaxrs.server.portable.servlet.ServletContainer.init(ServletContainer.java:121) 
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:337) 
    at weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:288) 
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) 
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120) 
    at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57) 
    at weblogic.servlet.internal.StubSecurityHelper.initServletInstance(StubSecurityHelper.java:98) 
    at weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:86) 
    at weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:71) 
    at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:57) 
    at weblogic.servlet.internal.StubLifecycleHelper.<init>(StubLifecycleHelper.java:31) 
    at weblogic.servlet.internal.ServletStubImpl.initStubLifecycleHelper(ServletStubImpl.java:656) 
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:600) 
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1974) 
    at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1951) 
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1841) 
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2871) 
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1661) 
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:823) 
    at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360) 
    at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356) 
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42) 
    at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138) 
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:124) 

내가 명시 적으로 어디서든 내 프로젝트에 저지를 참조하고 있지 않다,하지만 난 Jersey를 찾고있는 jax-rs를 사용하고 있습니다. 내 컴퓨터의 weblogic 서버에는 Jersey Jar가 있지만 클라이언트 시스템에있는 weblogic에는 Jersey Jar가 없습니다.

<!-- https://mvnrepository.com/artifact/org.glassfish.jersey.bundles/jaxrs-ri --> 
    <dependency> 
      <groupId>org.glassfish.jersey.bundles</groupId> 
      <artifactId>jaxrs-ri</artifactId> 
      <version>2.25.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.glassfish.hk2</groupId> 
      <artifactId>hk2-api</artifactId> 
      <version>2.5.0-b32</version> 
     </dependency> 

     <dependency> 
      <groupId>org.glassfish.hk2</groupId> 
      <artifactId>hk2-locator</artifactId> 
      <version>2.5.0-b32</version> 
     </dependency> 

     <dependency> 
      <groupId>org.glassfish.hk2</groupId> 
      <artifactId>hk2-utils</artifactId> 
      <version>2.5.0-b32</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/org.glassfish.hk2/hk2-inhabitant-generator --> 
     <dependency> 
      <groupId>org.glassfish.hk2</groupId> 
      <artifactId>hk2-inhabitant-generator</artifactId> 
      <version>2.5.0-b19</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/javax.inject/javax.inject --> 
     <!-- https://mvnrepository.com/artifact/org.apache.servicemix.bundles/org.apache.servicemix.bundles.javax-inject --> 
     <dependency> 
      <groupId>org.apache.servicemix.bundles</groupId> 
      <artifactId>org.apache.servicemix.bundles.javax-inject</artifactId> 
      <version>1_2</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client --> 
     <dependency> 
      <groupId>org.glassfish.jersey.core</groupId> 
      <artifactId>jersey-client</artifactId> 
      <version>2.25.1</version> 
     </dependency> 

     <!-- https://mvnrepository.com/artifact/org.glassfish.jersey.bundles.repackaged/jersey-guava --> 
     <dependency> 
      <groupId>org.glassfish.jersey.bundles.repackaged</groupId> 
      <artifactId>jersey-guava</artifactId> 
      <version>2.25</version> 
     </dependency> 

아직 내가 오류없이 응용 프로그램을 배포 할 수 없습니다입니다 : 내 의 pom.xml에 다음 항아리를 추가했습니다. 이제 다른 오류가 발생합니다.

java.lang.IllegalStateException: No generator was provided and there is no default generator registered

spring-config 파일의 jax-rs 구성을 아래에서 찾으십시오.

<jaxrs:server id="restService" address="/rest"> 
     <jaxrs:serviceBeans> 
      <ref bean="userService" /> 
      <ref bean="billingService" /> 
     </jaxrs:serviceBeans> 
     <jaxrs:providers> 
      <ref bean='jsonProvider' /> 
     </jaxrs:providers> 
     <jaxrs:inInterceptors> 
      <bean class="com.brokerws.interceptor.WSLoggingRequestInterceptor" /> 
     </jaxrs:inInterceptors> 
     <jaxrs:outInterceptors> 
      <bean class="com.brokerws.interceptor.WSLoggingResponseInterceptor" /> 
     </jaxrs:outInterceptors> 
    </jaxrs:server> 

내 web.xml을 검색 할

<?xml version="1.0" encoding="ISO-8859-1"?> 
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns="http://java.sun.com/xml/ns/javaee" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" 
    metadata-complete="true" version="3.0"> 
    <display-name>SuppApp</display-name> 
    <context-param> 
     <param-name>contextConfigLocation</param-name> 
     <param-value>/WEB-INF/app-beans.xml</param-value> 
    </context-param> 
    <listener> 
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener> 
    <servlet> 
     <servlet-name>CXFServlet</servlet-name> 
     <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class> 
     <load-on-startup>1</load-on-startup> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>CXFServlet</servlet-name> 
     <url-pattern>/services/*</url-pattern> 
    </servlet-mapping> 
    <servlet> 
     <servlet-name>health-check</servlet-name> 
     <servlet-class>com.suddenlink.util.HealthCheckServlet</servlet-class> 
    </servlet> 
    <servlet-mapping> 
     <servlet-name>health-check</servlet-name> 
     <url-pattern>/healthCheck</url-pattern> 
    </servlet-mapping> 

    <filter> 
     <filter-name>Logback-MDC-Filter</filter-name> 
     <filter-class>com.suddenlink.traceability.filter.HttpHeaderServletFilter</filter-class> 
     <init-param> 
      <param-name>application_name</param-name> 
      <param-value>broker-ws</param-value> 
     </init-param> 
     <init-param> 
      <param-name>application_type</param-name> 
      <param-value>ws</param-value> 
     </init-param> 
    </filter> 
    <filter-mapping> 
     <filter-name>Logback-MDC-Filter</filter-name> 
     <url-pattern>/*</url-pattern> 
    </filter-mapping> 

</web-app> 

누군가가 내가 이리와 인터넷을 통해 주어진 다양한 솔루션을 시도 잃었는지 말해, 아무것도 나를 위해 일한 적이 있습니다.

+0

여기에 cxf jar가 포함되어 있습니까? 그들은 웹 로직과 함께합니까? – yaswanth

+0

@yaswanth pom.xml에 포함 시켰지만 weblogic.xml의 prefer-application-packages 구성에 포함시키지 않았습니다. 따라서 weblogic 서버에서 제공됩니다 – Venu

답변

0

마지막으로 문제의 근본 원인을 발견했습니다. 그것은 weblogic 서버가 저지 종속성을 찾도록 만드는 스프링 webapp 버전이었습니다. webapp 버전을 3.0에서 2.5로 변경했는데 오류가 사라졌습니다. 이것이 실제로 일어난 일을 파악하는 데 거의 이틀이 걸렸기 때문에이 문제에 참여할 수있는 사람에게 도움이되기를 바랍니다.