2016-05-13 96 views
0

所以我有一個項目在eclipse中使用Maven的依賴關係。在Eclipse中,該項目正常工作。每當我使用maven assembly插件構建一個可執行文件時,GUI工作正常,但是當我嘗試使用我的程序登錄到我的服務器時,出現大量錯誤。我認爲這可能是因爲jaxrs缺少依賴關係。我的pom.xml文件:Maven項目打破了可執行jar但不是在Eclipse

<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/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 
    <groupId>edu.plu.cs.farkle</groupId> 
    <artifactId>farkle-client</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 

    <dependencies> 


<dependency> 

      <groupId>org.eclipse.jetty.websocket</groupId> 
      <artifactId>javax-websocket-client-impl</artifactId> 
      <version>${jetty.version}</version> 
     </dependency> 



     <!--Jetty Websocket API client side dependency --> 
     <dependency> 
      <groupId>org.eclipse.jetty.websocket</groupId> 
      <artifactId>websocket-client</artifactId> 
      <version>${jetty.version}</version> 
     </dependency> 



     <dependency> 
     <groupId>org.jboss.resteasy</groupId> 
     <artifactId>resteasy-client</artifactId> 
     <version>${resteasy-version}</version> 
    </dependency> 
      <dependency> 
     <groupId>org.jboss.resteasy</groupId> 
     <artifactId>resteasy-jackson-provider</artifactId> 
     <version>${resteasy-version}</version> 
    </dependency> 
    <dependency> 
    <groupId>javax.websocket</groupId> 
    <artifactId>javax.websocket-api</artifactId> 
    <version>1.0</version> 
</dependency> 
    <dependency> 
     <groupId>junit</groupId> 
     <artifactId>junit</artifactId> 
     <version>4.11</version> 
     <scope>test</scope> 
    </dependency> 
    <dependency> 
     <groupId>org.mongodb</groupId> 
     <artifactId>mongodb-driver</artifactId> 
     <version>3.2.2</version> 
    </dependency> 
    </dependencies> 

    <properties> 
    <exec.mainClass>edu.plu.cs.farkle.client.gui.GUI</exec.mainClass> 
    <resteasy-version>3.0.13.Final</resteasy-version> 
    <jetty.version>9.2.11.v20150529</jetty.version> 
    </properties> 
    <build> 
    <plugins> 
    <plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-assembly-plugin</artifactId> 
    <configuration> 
    <archive> 
     <manifest> 
     <mainClass>edu.plu.cs.farkle.client.gui.GUI</mainClass> 
     </manifest> 
    </archive> 
    <descriptorRefs> 
      <descriptorRef>jar-with-dependencies</descriptorRef> 
     </descriptorRefs> 
    </configuration> 
</plugin> 
<plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.5.1</version> 
     <configuration> 

      <source>1.8</source> 
      <target>1.8</target> 
     </configuration> 
     </plugin> 
</plugins> 
</build> 

</project> 

當我運行程序並鍵入用戶憑據時出現錯誤日誌。

Exception in thread "AWT-EventQueue-0" javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request 
    at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:287) 
    at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:436) 
    at org.jboss.resteasy.client.jaxrs.internal.ClientInvocationBuilder.post(ClientInvocationBuilder.java:195) 
    at edu.plu.cs.farkle.client.account.ClientService.Login(ClientService.java:70) 
    at edu.plu.cs.farkle.client.account.ClientBase.login(ClientBase.java:38) 
    at edu.plu.cs.farkle.client.gui.account.LoginPage$3.actionPerformed(LoginPage.java:106) 
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) 
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348) 
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402) 
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259) 
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252) 
    at java.awt.Component.processMouseEvent(Component.java:6535) 
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324) 
    at java.awt.Component.processEvent(Component.java:6300) 
    at java.awt.Container.processEvent(Container.java:2236) 
    at java.awt.Component.dispatchEventImpl(Component.java:4891) 
    at java.awt.Container.dispatchEventImpl(Container.java:2294) 
    at java.awt.Component.dispatchEvent(Component.java:4713) 
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) 
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525) 
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) 
    at java.awt.Container.dispatchEventImpl(Container.java:2280) 
    at java.awt.Window.dispatchEventImpl(Window.java:2750) 
    at java.awt.Component.dispatchEvent(Component.java:4713) 
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) 
    at java.awt.EventQueue.access$500(EventQueue.java:97) 
    at java.awt.EventQueue$3.run(EventQueue.java:709) 
    at java.awt.EventQueue$3.run(EventQueue.java:703) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) 
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86) 
    at java.awt.EventQueue$4.run(EventQueue.java:731) 
    at java.awt.EventQueue$4.run(EventQueue.java:729) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76) 
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) 
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) 
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) 
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 
Caused by: javax.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/json type: edu.plu.cs.farkle.client.account.UserCredentials 
    at org.jboss.resteasy.core.interception.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:40) 
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.getWriter(AbstractWriterInterceptorContext.java:140) 
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:119) 
    at org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor.aroundWriteTo(GZIPEncodingInterceptor.java:100) 
    at org.jboss.resteasy.core.interception.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:124) 
    at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.writeRequestBody(ClientInvocation.java:370) 
    at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.writeRequestBodyToOutputStream(ApacheHttpClient4Engine.java:558) 
    at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.buildEntity(ApacheHttpClient4Engine.java:524) 
    at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.loadHttpMethod(ApacheHttpClient4Engine.java:423) 
    at org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:281) 
    ... 41 more 

回答

相關問題