2016-04-28 63 views
0

添加網狀-tcnative到Tomcat我有一個動態的Web項目在Eclipse中使用以下Maven設置在運行時

的pom.xml

<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>PushyNotification</groupId> 
    <artifactId>PushyNotification</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <packaging>war</packaging> 
    <build> 
    <sourceDirectory>src</sourceDirectory> 
    <plugins> 
     <plugin> 
     <artifactId>maven-compiler-plugin</artifactId> 
     <version>3.1</version> 
     <configuration> 
      <source>1.7</source> 
      <target>1.7</target> 
     </configuration> 
     </plugin> 
     <plugin> 
     <artifactId>maven-war-plugin</artifactId> 
     <version>2.3</version> 
     <configuration> 
      <warSourceDirectory>WebContent</warSourceDirectory> 
      <failOnMissingWebXml>false</failOnMissingWebXml> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    <dependencies> 
     <dependency> 
      <groupId>asm</groupId> 
      <artifactId>asm</artifactId> 
      <version>3.3.1</version> 
     </dependency> 
     <dependency> 
      <groupId>com.sun.jersey</groupId> 
      <artifactId>jersey-bundle</artifactId> 
      <version>1.19</version> 
     </dependency> 
     <dependency> 
      <groupId>org.json</groupId> 
      <artifactId>json</artifactId> 
      <version>20140107</version> 
     </dependency> 
     <dependency> 
      <groupId>com.sun.jersey</groupId> 
      <artifactId>jersey-server</artifactId> 
      <version>1.19</version> 
     </dependency> 
     <dependency> 
      <groupId>com.sun.jersey</groupId> 
      <artifactId>jersey-core</artifactId> 
      <version>1.19</version> 
     </dependency> 
     <dependency> 
      <groupId>com.relayrides</groupId> 
      <artifactId>pushy</artifactId> 
      <version>0.6.1</version> 
     </dependency> 
     <dependency> 
      <groupId>io.netty</groupId> 
      <artifactId>netty-all</artifactId> 
      <version>4.1.0.CR7</version> 
     </dependency> 
     <dependency> 
      <groupId>com.google.code.gson</groupId> 
      <artifactId>gson</artifactId> 
      <version>2.5</version> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
      <version>1.7.6</version> 
     </dependency> 
     <dependency> 
      <groupId>io.netty</groupId> 
      <artifactId>netty-tcnative</artifactId> 
      <version>1.1.33.Fork15</version> 
      <classifier>osx-x86_64</classifier> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.jetty.alpn</groupId> 
      <artifactId>alpn-api</artifactId> 
      <version>1.1.2.v20150522</version> 
      <scope>runtime</scope> 
     </dependency> 
    </dependencies> 
</project> 

我已經在WEB將這兩個jar添加到lib目錄-INF

netty-tcnative-1.1.33.Fork9-osx-x86_64.jar 
alpn-api-1.1.2.v20150522.jar 

我也曾嘗試setenv.sh文件中添加這些到tomcat CLASSPATH:

CLASSPATH="/Users/williammcerlane/.m2/repository/org/eclipse/jetty/alpn/alpn-api/1.1.2.v20150522/alpn-api-1.1.2.v20150522.jar" 
CLASSPATH="$CLASSPATH /Users/williammcerlane/.m2/repository/io/netty/netty-all/4.1.0.CR7/netty-all-4.1.0.CR7.jar" 

但在運行時我胡扯過程中指出,它無法找到:

DEBUG io.netty.util.internal.NativeLibraryLoader – Unable to load the library: netty-tcnative-osx-x86_64. 
java.lang.UnsatisfiedLinkError: no netty-tcnative-osx-x86_64 in java.library.path 

這我漂亮難倒什麼是試圖加載的罐子並不能找到它。

完全錯誤:

33 [http-bio-8080-exec-3] DEBUG io.netty.util.internal.NativeLibraryLoader – Unable to load the library: netty-tcnative-osx-x86_64. 
java.lang.UnsatisfiedLinkError: no netty-tcnative-osx-x86_64 in java.library.path 
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1886) 
    at java.lang.Runtime.loadLibrary0(Runtime.java:849) 
    at java.lang.System.loadLibrary(System.java:1088) 
    at io.netty.util.internal.NativeLibraryLoader.load(NativeLibraryLoader.java:189) 
    at io.netty.util.internal.NativeLibraryLoader.loadFirstAvailable(NativeLibraryLoader.java:161) 
    at io.netty.handler.ssl.OpenSsl.<clinit>(OpenSsl.java:78) 
    at com.relayrides.pushy.apns.ApnsClient.getBaseSslContextBuilder(ApnsClient.java:366) 
    at com.relayrides.pushy.apns.ApnsClient.getSslContextWithCertificateAndPrivateKey(ApnsClient.java:358) 
    at com.relayrides.pushy.apns.ApnsClient.getSslContextWithP12InputStream(ApnsClient.java:354) 
    at com.relayrides.pushy.apns.ApnsClient.getSslContextWithP12File(ApnsClient.java:331) 
    at com.relayrides.pushy.apns.ApnsClient.<init>(ApnsClient.java:234) 
    at com.relayrides.pushy.apns.ApnsClient.<init>(ApnsClient.java:209) 
    at com.joemcerlane.restjersey.Pushy.doNotification(Pushy.java:48) 
    at com.joemcerlane.restjersey.Pushy.convertFtoC(Pushy.java:30) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:606) 
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60) 
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205) 
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75) 
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302) 
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108) 
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147) 
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1542) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1473) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419) 
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409) 
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558) 
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:733) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98) 
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040) 
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607) 
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:313) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:744) 
+0

你正在使用哪個操作系統?我認爲它不是關於JAR,它關於DLL或庫丟失 – tesnik03

+0

我正在我的本地mac上運行,因此MAC操作系統 – Will

+0

@yyny OSX El Capitan – Will

回答

1

首先,這個線程說加載APR的-1和OpenSSL一是爲了使用這個罐子

Forked Tomcat Native

和第二,你可以嘗試一下Java的 - Djava.library.path =。 -jar netty-tcnative-VER.jar

+0

嘗試都嘗試構建jar來確保構建工作的所有依賴關係我引用了我的本地生成的罐子。同樣的錯誤仍然存​​在 – Will

+0

你可以嘗試第二個建議在這個http://stackoverflow.com/questions/35194395/how-to-make-the-netty-example-works – tesnik03