2012-07-02 3 views
1

Netty 및 개미로 앱을 만들고 있습니다. 컴파일 할 때 오류가 없습니다.java.lang.NoClassDefFoundError : org/jboss/netty/channel/ChannelFactory

Exception in thread "main" java.lang.NoClassDefFoundError: org/jboss/netty/channel/ChannelFactory 
Caused by: java.lang.ClassNotFoundException: org.jboss.netty.channel.ChannelFactory 
     at java.net.URLClassLoader$1.run(URLClassLoader.java:217) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(URLClassLoader.java:205) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:321) 
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) 
     at java.lang.ClassLoader.loadClass(ClassLoader.java:266) 
Could not find the main class: org.darkquest.gs.Server. Program will exit. 

이 내 build.xml 파일 내 프로젝트입니다 :

<project default="compile" basedir="."> 

     <property name="src" location="src" /> 
     <property name="build" location="build" /> 
     <property name="doc" location="doc" /> 
     <property name="lib" location="lib" /> 
     <property name="jar" location="runescape.jar" /> 

     <target name="compile"> 
       <delete file="${jar}" /> 
       <delete dir="${build}" /> 
       <mkdir dir="${build}"/> 
       <javac srcdir="${src}" destdir="${build}" debug="on"> 
        <compilerarg value="-Xlint:unchecked"/> 
        <classpath> 
         <pathelement location="${lib}/mina.jar" /> 
         <pathelement location="${lib}/netty.jar" /> 
         <pathelement location="${lib}/xpp3.jar" /> 
         <pathelement location="${lib}/slf4j.jar"/> 
         <pathelement location="${lib}/xstream.jar"/> 
         <pathelement location="${lib}/mysql-connector.jar" /> 
         <pathelement location="${lib}/hex-string.jar" /> 
         <pathelement path="${java.class.path}/"/> 
        </classpath> 
       </javac> 
       <jar basedir="${build}" destfile="${jar}" > 
         <manifest> 
           <attribute name="Main-Class" value="org.darkquest.gs.Server" /> 
         </manifest> 
       </jar> 
     </target> 

     <target name="doc" depends="compile"> 
       <javadoc sourcepath="${src}" destdir="${doc}" verbose="on" /> 
     </target> 

     <target name="runls"> 
       <java classname="org.darkquest.ls.Server" fork="true"> 
         <jvmarg value="-Xms128m" /> 
         <jvmarg value="-Xmx512m" /> 
         <arg value="ls.conf" /> 
         <classpath> 
           <pathelement location="${lib}/mina.jar" /> 
           <pathelement location="${lib}/netty.jar" /> 
           <pathelement location="${lib}/xpp3.jar" /> 
           <pathelement location="${lib}/slf4j.jar"/> 
           <pathelement location="${lib}/xstream.jar"/> 
           <pathelement location="${lib}/mysql-connector.jar" /> 
           <pathelement location="${lib}/hex-string.jar" /> 
           <pathelement path="${jar}/" /> 
         </classpath> 
       </java> 
     </target> 

     <target name="runserver"> 
       <java classname="org.darkquest.gs.Server" fork="true"> 
         <jvmarg value="-Xms128m" /> 
         <jvmarg value="-Xmx512m" /> 
         <arg value="server.conf" /> 
         <arg value="f2p" /> 
         <arg value="no" /> 
         <classpath> 
           <pathelement location="${lib}/mina.jar" /> 
           <pathelement location="${lib}/xpp3.jar" /> 
           <pathelement location="${lib}/netty.jar" /> 
           <pathelement location="${lib}/slf4j.jar"/> 
           <pathelement location="${lib}/xstream.jar"/> 
           <pathelement location="${lib}/mysql-connector.jar" /> 
           <pathelement location="${lib}/hex-string.jar" /> 
           <pathelement path="${jar}/" /> 
         </classpath> 
       </java> 
     </target> 

</project> 

그리고 이러한 그물코 라이브러리의 항아리입니다

내가 jar 파일을 실행하려고하면, 그것은 이러한 메시지를 가져옵니다
ls -la /usr/share/java/netty* 
-rw-r--r-- 1 root root 1118026 2012-06-24 15:29 /usr/share/java/netty-3.5.1.Final.jar 
lrwxrwxrwx 1 root root  37 2012-07-02 01:31 /usr/share/java/netty.jar -> /usr/share/java/netty-3.5.1.Final.jar 
ls -la lib/ 
total 4904 
drwxrwxrwx 1 user user 4096 2012-07-02 01:49 . 
drwxr-xr-x 1 user user 4096 2012-07-02 02:21 .. 
-rw-rw-rw- 1 user user 281694 2012-06-18 05:43 bsh.jar 
-rw-r--r-- 1 user user 6148 2012-06-18 05:48 .DS_Store 
-rw-rw-rw- 1 user user 1685 2012-06-18 05:43 hex-string.jar 
-rw-rw-rw- 1 user user 2082557 2012-06-18 05:43 jmf.jar 
-rw-rw-rw- 1 user user 112249 2012-06-18 05:43 junit.jar 
-rw-r----- 1 user user 315582 2012-07-01 15:21 mina-core-1.1.7.jar 
-rw-rw-rw- 1 user user 315582 2012-06-18 05:43 mina.jar 
-rw-rw-rw- 1 user user 456729 2012-06-18 05:43 mysql-connector.jar 
-rw-rw-rw- 1 user user 1118026 2012-07-02 01:49 netty.jar 
-rw-rw-rw- 1 user user 13873 2012-06-18 05:43 slf4j.jar 
-rw-rw-rw- 1 user user 24538 2012-06-18 05:43 xpp3.jar 
-rw-rw-rw- 1 user user 261710 2012-06-18 05:43 xstream.jar 

누구든지 나를 도와 줄 수 있습니까?

감사합니다.

답변

6

오류는 netty 클래스 org.jboss.netty.channel.ChannelFactory이 jar 파일에서 발견되지 않음을 나타냅니다. zipfileset 작업을 사용하여 항아리에 그물코 클래스를 포함

시도 :

<jar basedir="${build}" destfile="${jar}" > 
    <manifest> 
    <attribute name="Main-Class" value="org.darkquest.gs.Server" /> 
    </manifest> 
    <zipfileset includes="**/*.class" src="${lib}/netty.jar" /> 
</jar> 
+0

감사합니다! 작동 확인! 내가 충분히 평판이 좋지 않아 투표 할 수는 없지만 고마워! : D – user1193085

+0

@ user1193085 당신은 대답을 받아 들일 수 있습니다. –