简体   繁体   English

树莓派上的Tomcat无法初始化gnu.io.CommPortIdentifier

[英]Tomcat on raspberry pi couldnt initialize gnu.io.CommPortIdentifier

I have Oracle's Java JDK 8 and Tomcat 8 installed on Raspberry PI. 我在Raspberry PI上安装了Oracle的Java JDK 8和Tomcat 8。

I have a standalone and a web application, both with the same functionaties (open serial communication). 我有一个独立的和一个Web应用程序,两者具有相同的功能(开放式串行通信)。 Both are running on my macbook. 两者都在我的Macbook上运行。

The problem is: The standalone application runs well on raspbian when I give the CLASSPATH with RXTXcomm.jar, like java -Djava.library.path=/usr/lib/jni -cp /usr/share/java/RXTXcomm.jar:. -jar myapp.jar 问题是:当我给CLASSPATH加上RXTXcomm.jar时,独立应用程序在raspbian上运行良好,例如java -Djava.library.path=/usr/lib/jni -cp /usr/share/java/RXTXcomm.jar:. -jar myapp.jar java -Djava.library.path=/usr/lib/jni -cp /usr/share/java/RXTXcomm.jar:. -jar myapp.jar

But the web application doesn't run. 但是该Web应用程序无法运行。 I put the war file is Tomcat's webapps directory. 我把war文件放在Tomcat的webapps目录中。 When I try to go to http://localhost:8080/myApp/ , I get the message: 当我尝试转到http://localhost:8080/myApp/ ,收到消息:

HTTP Status 500 - javax.servlet.ServletException: java.lang.NoClassDefFoundError: Could not initialize class gnu.io.CommPortIdentifier HTTP状态500-javax.servlet.ServletException:java.lang.NoClassDefFoundError:无法初始化类gnu.io.CommPortIdentifier

What would cause it? 是什么原因造成的?

You can try copying a compatible version of RXTXcomm.jar into your tomcat/lib directory. 您可以尝试将兼容版本的RXTXcomm.jar复制到tomcat / lib目录中。 All jars in Tomcat/lib are available on the classpath when running webapps. 运行webapps时,classpath中可以使用Tomcat / lib中的所有jar。

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

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