Tomcat:java.lang.UnsatisfiedLinkError:java.library.path中没有jnetpcap

时间:2014-12-08 13:12:37

标签: tomcat ant build.xml jnetpcap

将应用程序部署到Tomcat时出现以下错误: Tomcat error

我已将jnetpcap jar文件添加到Tomcat的 lib 文件夹中。我也在eclipse中将它添加到了我的classpath中。

我正在将我的应用程序部署为使用Apache ant从命令行构建的WAR文件。我认为问题可能出在我的 build.xml 文件中。

的build.xml

<?xml version="1.0" ?>
<project name="IBM_Project" default="dist" basedir=".">
<description>
    sample
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist"  location="dist"/>
<property name="lib"  location="lib"/>
<property name="web.dir"  location="WebContent"/>

<path id="class.path">
  <pathelement path="${classpath}"/>
  <fileset dir="lib">
    <include name="**/*.jar"/>
  </fileset>
</path>

<javac srcdir="${src}"
    destdir="${build}"
    classpathref="class.path"/>

<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>

<target name="compile" depends="init"
    description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
</target>

<target name="dist" depends="compile"
    description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>  
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/PROJECT-${DSTAMP}.jar" basedir="${build}"/> 
</target>

<target name="build-war">
<war destfile="${dist}/ROOT.war" webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}">
  <include name="**/*.*"/>
</fileset>
<lib dir="${lib}">
</lib>
<classes dir="${build}"/>
</war>
</target>

<target name="clean"
    description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>

</project>

运行的Ant命令:

  

ant build-war

我的build.xml中可能有很多东西是无关紧要的,我还在尝试学习Ant的方法。

有谁能请说明我的问题?

1 个答案:

答案 0 :(得分:1)

这意味着找不到本机jnetpcap共享库。 jnetpcap是本机libpcap库的Java包装器。在Windows系统上安装“libpcap”库或WinPcap是installing jnetpcap的先决条件。
该库随jNetPcap提供。您需要确保在每个特定系统上正确定义库所在的文件夹或目录。有关解决问题的详细信息,请参阅jnetpcap FAQ