2017-02-22 71 views
0

Я пытаюсь развернуть мой проект maven проекта ws. Я не знаю, с чего начать искать причину этой ошибки. Проект связан с другим проектом, называемым ws-интерфейсом супер-пом. Я не уверен, что я должен предоставить любому, кто сможет идентифицировать эту проблему, поэтому, пожалуйста, не стесняйтесь запрашивать дополнительную информацию.maven tomcat deploy soap webservice error

-ws-производитель pom-

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>nl.hu.fnt.gsos</groupId> 
    <artifactId>ws-producer</artifactId> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <parent> 
     <groupId>nl.hu.fnt.gsos</groupId> 
     <artifactId>ws-parent</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 
    <name>Producer Maven Webapp</name> 
    <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>com.sun.xml.ws</groupId> 
      <artifactId>jaxws-rt</artifactId> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>nl.hu.fnt.gsos</groupId> 
      <artifactId>ws-interface</artifactId> 
     </dependency> 
     <dependency> 
      <groupId>com.sun.xml.bind</groupId> 
      <artifactId>jaxb-impl</artifactId> 
      <version>2.2.6</version> 
      <scope>provided</scope> 
     </dependency> 
    </dependencies> 
    <build> 
     <finalName>ws-producer</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.tomcat.maven</groupId> 
       <artifactId>tomcat7-maven-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

-ws-интерфейс pom-

<project 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>nl.hu.fnt.gsos</groupId> 
    <artifactId>ws-interface</artifactId> 
    <packaging>jar</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Webservice interface project</name> 
    <parent> 
     <groupId>nl.hu.fnt.gsos</groupId> 
     <artifactId>ws-parent</artifactId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 
    <dependencies> 
     <dependency> 
      <groupId>junit</groupId> 
      <artifactId>junit</artifactId> 
      <version>3.8.1</version> 
     </dependency> 
     <dependency> 
      <groupId>javax.servlet</groupId> 
      <artifactId>servlet-api</artifactId> 
      <version>2.5</version> 
     </dependency> 
     <dependency> 
      <groupId>com.sun.xml.ws</groupId> 
      <artifactId>jaxws-rt</artifactId> 
      <version>2.2.5</version> 
      <exclusions> 
       <exclusion> 
        <artifactId>istack-commons-runtime</artifactId> 
        <groupId>com.sun.istack</groupId> 
       </exclusion> 
      </exclusions> 
     </dependency> 
     <dependency> 
      <groupId>com.sun.xml.bind</groupId> 
      <artifactId>jaxb-impl</artifactId> 
      <version>2.2.6</version> 
      <scope>runtime</scope> 
     </dependency> 
    </dependencies> 
    <build> 
     <finalName>ws-interface</finalName> 
     <plugins> 
      <plugin> 
       <groupId>org.jvnet.jax-ws-commons</groupId> 
       <artifactId>jaxws-maven-plugin</artifactId> 
       <configuration> 
        <!-- Needed with JAXP 1.5 --> 
        <vmArgs> 
         <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg> 
        </vmArgs> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-install-plugin</artifactId> 
       <version>2.4</version> 
       <executions> 
        <execution> 
         <phase>install</phase> 
         <goals> 
          <goal>install-file</goal> 
         </goals> 
         <configuration> 
          <groupId>nl.hu.fnt.gsos</groupId> 
          <artifactId>ws-interface</artifactId> 
          <version>1.0-SNAPSHOT</version> 
          <packaging>jar</packaging> 
          <file>${basedir}/target/ws-interface.jar</file> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

-Супер pom-

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
          http://maven.apache.org/maven-v4_0_0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>nl.hu.fnt.gsos</groupId> 
    <artifactId>ws-parent</artifactId> 
    <packaging>pom</packaging> 
    <version>1.0-SNAPSHOT</version> 
    <name>Simple parent project for GSOS purpose</name> 

    <modules> 
     <module>ws-interface</module> 
     <module>ws-producer</module> 
     <module>ws-consumer</module> 
    </modules> 

    <dependencyManagement> 
     <dependencies> 
      <dependency> 
       <groupId>junit</groupId> 
       <artifactId>junit</artifactId> 
       <version>3.8.1</version> 
       <scope>test</scope> 
      </dependency> 
      <dependency> 
       <groupId>javax.servlet</groupId> 
       <artifactId>servlet-api</artifactId> 
       <version>2.5</version> 
       <scope>provided</scope> 
      </dependency> 
      <dependency> 
       <groupId>com.sun.xml.ws</groupId> 
       <artifactId>jaxws-rt</artifactId> 
       <version>2.2.8</version> 
       <scope>provided</scope> 
      </dependency> 
      <dependency> 
       <groupId>nl.hu.fnt.gsos</groupId> 
       <artifactId>ws-interface</artifactId> 
       <scope>compile</scope> 
       <version>1.0-SNAPSHOT</version> 
      </dependency> 
      <dependency> 
      <groupId>com.sun.xml.bind</groupId> 
      <artifactId>jaxb-impl</artifactId> 
      <version>2.2.11</version> 
     </dependency> 

     <dependency> 
      <groupId>com.sun.xml.bind</groupId> 
      <artifactId>jaxb-core</artifactId> 
      <version>2.2.11</version> 
     </dependency> 

     </dependencies> 
    </dependencyManagement> 
    <build> 
     <pluginManagement> 
      <plugins> 
       <plugin> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-compiler-plugin</artifactId> 
        <version>3.1</version> 
        <configuration> 
         <source>1.7</source> 
         <target>1.7</target> 
        </configuration> 
       </plugin> 
       <plugin> 
        <groupId>org.jvnet.jax-ws-commons</groupId> 
        <artifactId>jaxws-maven-plugin</artifactId> 
        <version>2.3</version> 
        <executions> 
         <execution> 
          <id>wsimport-from-jdk</id> 
          <goals> 
           <goal>wsimport</goal> 
          </goals> 
          <phase>generate-sources</phase> 
         </execution> 
        </executions> 
        <configuration> 
         <!--wsdls file directory --> 
         <wsdlDirectory>src/main/webapp/wsdl/</wsdlDirectory> 
         <!-- which wsdl file --> 
         <wsdlFiles> 
          <wsdlFile>BookService.wsdl</wsdlFile> 
         </wsdlFiles> 
         <!-- Keep generated files --> 
         <keep>true</keep> 
         <!-- Package name --> 
         <packageName>nl.hu.fnt.gsos.wsinterface</packageName> 
         <!-- generated source files destination --> 
         <!-- <sourceDestDir>target/generated-code/src</sourceDestDir> --> 
        </configuration> 
       </plugin> 
       <plugin> 
        <groupId>org.apache.tomcat.maven</groupId> 
        <artifactId>tomcat7-maven-plugin</artifactId> 
        <version>2.2</version> 
        <configuration> 
         <server>tomcatappserver</server> 
         <url>http://localhost:5471/manager/text</url> 
         <username>tomcat</username> 
         <password>s3cret</password> 
        </configuration> 
       </plugin> 
       <plugin> 
        <inherited>true</inherited> 
        <groupId>org.apache.maven.plugins</groupId> 
        <artifactId>maven-eclipse-plugin</artifactId> 
        <version>2.8</version> 
        <configuration> 
         <skip>false</skip> 
         <downloadSources>true</downloadSources> 
         <downloadJavadocs>true</downloadJavadocs> 
         <projectNameTemplate>[artifactId]</projectNameTemplate> 
         <wtpmanifest>true</wtpmanifest> 
         <wtpapplicationxml>true</wtpapplicationxml> 
         <useProjectReferences>true</useProjectReferences> 
         <wtpapplicationxml>true</wtpapplicationxml> 
         <wtpversion>1.5</wtpversion> 
         <!-- wtpdefaultserver>${eclipse.ear.runtime.name}</wtpdefaultserver --> 
        </configuration> 
        <executions> 
         <execution> 
          <id>synchronise-eclipse-eclipse</id> 
          <phase>generate-resources</phase> 
          <goals> 
           <goal>eclipse</goal> 
          </goals> 
          <inherited>true</inherited> 
         </execution> 
         <execution> 
          <id>synchronise-eclipse-clean</id> 
          <phase>clean</phase> 
          <goals> 
           <goal>clean</goal> 
          </goals> 
          <inherited>true</inherited> 
         </execution> 
        </executions> 
       </plugin> 

      </plugins> 
     </pluginManagement> 
    </build> 
    <repositories> 
     <repository> 
      <id>java.net2</id> 
      <name>Repository hosting the jee6 artifacts</name> 
      <url>http://download.java.net/maven/2</url> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>codehaus</id> 
      <name>Codehaus REPO</name> 
      <url>http://repository.codehaus.org</url> 
      <layout>default</layout> 
      <releases> 
       <enabled>true</enabled> 
       <updatePolicy>always</updatePolicy> 
       <checksumPolicy>warn</checksumPolicy> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
       <updatePolicy>never</updatePolicy> 
       <checksumPolicy>fail</checksumPolicy> 
      </snapshots> 

     </pluginRepository> 
     <pluginRepository> 
      <id>java.net2</id> 
      <name>Repository hosting the jee6 artifacts</name> 
      <url>http://download.java.net/maven/2</url> 
     </pluginRepository> 
    </pluginRepositories> 

</project> 

-Sun-jaxws.xml-

<?xml version="1.0" encoding="UTF-8"?> 
<endpoints 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/jax-ws/ri/runtime http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/2.0/jaxws/sun-jaxws.xsd" 
    xmlns="http://java.sun.com/xml/ns/jax-ws/ri/runtime" version="2.0"> 
    <endpoint name="ws-producer" implementation="nl.hu.fnt.gsos.wsproducer.BookServiceImpl" 
     url-pattern="/ws-producer" /> 
</endpoints> 

-BookServiceImpl.java-

package nl.hu.fnt.gsos.wsproducer; 

import javax.jws.WebService; 

import nl.hu.fnt.gsos.wsinterface.BookRequestType; 
import nl.hu.fnt.gsos.wsinterface.BookResponseType; 
import nl.hu.fnt.gsos.wsinterface.IBookService; 
import nl.hu.fnt.gsos.wsinterface.ObjectFactory; 

@WebService(endpointInterface= "nl.hu.fnt.gsos.wsinterface.IBookService") 
public class BookServiceImpl implements IBookService { 

    @Override 
    public BookResponseType getBookByISDNRequestNumber(BookRequestType request) { 
     ObjectFactory factory = new ObjectFactory(); 
     BookResponseType response = factory.createBookResponseType(); 
     try{ 

     } catch (RuntimeException e){ 

     } 
     return response; 
    } 

} 

-ошибка протоколирование

22-Feb-2017 21:48:22.618 SEVERE [http-apr-8009-exec-45] org.apache.catalina.core.StandardContext.startInternal Error during ServletContainerInitializer processing 
javax.servlet.ServletException: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoClassDefFoundError: com/sun/xml/bind/api/JAXBRIContext 
    at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:70) 
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5240) 
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) 
    at org.apache.catalina.manager.ManagerServlet.start(ManagerServlet.java:1284) 
    at org.apache.catalina.manager.HTMLManagerServlet.start(HTMLManagerServlet.java:666) 
    at org.apache.catalina.manager.HTMLManagerServlet.doPost(HTMLManagerServlet.java:217) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) 
    at org.apache.catalina.filters.CsrfPreventionFilter.doFilter(CsrfPreventionFilter.java:136) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) 
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) 
    at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) 
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2500) 
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2489) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) 
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
    at java.lang.Thread.run(Thread.java:745) 
Caused by: com.sun.xml.ws.transport.http.servlet.WSServletException: WSSERVLET11: failed to parse runtime descriptor: java.lang.NoClassDefFoundError: com/sun/xml/bind/api/JAXBRIContext 
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:141) 
    at com.sun.xml.ws.transport.http.servlet.WSServletContainerInitializer.onStartup(WSServletContainerInitializer.java:65) 
    ... 34 more 
Caused by: java.lang.NoClassDefFoundError: com/sun/xml/bind/api/JAXBRIContext 
    at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:255) 
    at com.sun.xml.ws.db.DatabindingImpl.<init>(DatabindingImpl.java:99) 
    at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:74) 
    at com.sun.xml.ws.db.DatabindingProviderImpl.create(DatabindingProviderImpl.java:58) 
    at com.sun.xml.ws.db.DatabindingFactoryImpl.createRuntime(DatabindingFactoryImpl.java:120) 
    at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:521) 
    at com.sun.xml.ws.server.EndpointFactory.create(EndpointFactory.java:300) 
    at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:164) 
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:577) 
    at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:560) 
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parseAdapters(DeploymentDescriptorParser.java:303) 
    at com.sun.xml.ws.transport.http.DeploymentDescriptorParser.parse(DeploymentDescriptorParser.java:179) 
    at com.sun.xml.ws.transport.http.servlet.WSServletContextListener.parseAdaptersAndCreateDelegate(WSServletContextListener.java:131) 
    ... 35 more 
Caused by: java.lang.ClassNotFoundException: com.sun.xml.bind.api.JAXBRIContext 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    ... 48 more 

22-Feb-2017 21:48:22.621 SEVERE [http-apr-8009-exec-45] org.apache.catalina.core.StandardContext.startInternal Context [/ws-producer] startup failed due to previous errors 

ответ

1

На самом деле журнал ошибок показывает точную проблему.

необходимый класс com.sun.xml.bind.api.JAXBRIContext не находится в вашем пути к серверу или классу приложения. (это временная зависимость, которую вы должны иметь в пути к классу).

Он находится в JAXB-осущ-x.x.x.jar (x.x.x - это версия, как, например, JAXB-осущ-2.2.6.jar)

Это зависит от того, что Container вы используете.

Контейнеры, такие как JBoss, есть, но у вас нет.

Итак, у вас есть несколько вариантов: 1. Положите его в пути класса System 2. Положите его в пути класса сервера 3. Пакет его с вашим файлом WAR. Для этого в вашем файле проекта пом добавить зависимость как

 <dependencies> 
      <dependency> 
      <groupId>com.sun.xml.bind</groupId> 
      <artifactId>jaxb-impl</artifactId> 
      <version>2.2.6</version> 
      <scope>runtime</scope> 
      </dependency> 
     </dependencies> 

Примечание. Не в <dependencyManagement> элемент в "супер пом"

+0

Спасибо за ваш ответ, однако это решило мою проблему. Однако вы, вероятно, правы, потому что я не могу найти никаких зависимостей в созданной папке военной библиотеки. Так что что-то должно быть не так с моими файлами pom в проектах ws-interface и ws-manufacturer. Я добавил их в свой оригинальный пост. – Colivar

+0

Я решил его, отредактировав зависимости ws-производителя pom от области, предоставленной для компиляции. Есть ли у вас какие-либо идеи, почему кто-то предоставил ее? Еще раз спасибо за то, что дал мне правильный намек, поставив меня в правильном направлении. – Colivar

+0

С твоей помпой ничего не случилось. Если необходимо, файл jar находится в пути к классу, нет необходимости вставлять другой файл в военный файл. Таким образом, необходимый объем «предоставляется». Он специфичен для военных или ушных файлов. Это означает, что во время компиляции Maven помещает его в путь класса, но не упаковывает его. 'compile' или' runtime' scope Maven для упаковки файла jar в WAR/EAR. Вот и все. Так как я очень часто говорил, что jaxb-impl или другая реализация уже находится в пути к классу, поэтому «предоставленный» является наилучшим вариантом. – Vadim