2012-09-13 117 views
1

我正在將應用程序從weblogic 8.1遷移到weblogic 10.3.5版本。 同時通過ant腳本構建應用程序;我得到以下錯誤: -weblogic.appc命令在WebLogic Server 10.3.5.0中使用ANT腳本失敗

weblogic.appc.run:

[java] Usage: java weblogic.appc [options] <ear, jar, war or rar file or directory> 
[java] 
[java] where options include: 
[java] -help Print the standard usage message. 
[java] -version Print version information. 
[java] -output <file> Specifies an alternate output archive or 
[java] directory. If not set, output will be 
[java] placed in the source archive or directory. 
[java] -plan <file> Specifies an optional deployment plan. 
[java] -forceGeneration Force generation of EJB and JSP classes. 
[java] Without this flag the classes may not be 
[java] regenerated if it is determined to be 
[java] unnecessary. 
[java] -quiet Turns off output except for errors 
[java] -lineNumbers Add JSP line numbers to generated class 
[java] files to aid in debugging. 
[java] -library <file> Comma-separated list of libraries. Each 
[java] library may optionally set its name and 
[java] versions, if not already set in its 
[java] manifest, using the following syntax: <file> 
[java] [@name=<string>@libspecver=<version> 
[java] @libimplver=<version|string>] 
[java] -librarydir <dir> Registers all files in specified directory 
[java] as libraries. 
[java] -writeInferredDescriptors Write out the descriptors with inferred 
[java] information including annotations. 
[java] -manifest <file> Include manifest information from specified 
[java] manifest file. 
[java] -clientJarOutputDir <dir> Specifies a directory to put generated 
[java] client jars. 
[java] Exception in thread "main" java.lang.NoClassDefFoundError: weblogic/j2ee/J2EELogger 
[java] -keepgenerated Keep the generated .java files. 
[java] -verbose Compile with verbose output. 
[java] -classpath <path> Classpath to use. 
[java] -source <source> Source version. 
[java] -target <target> Target version. 
[java] -advanced Print advanced usage options. 
[java] 
[java] at weblogic.application.compiler.Appc.runBody(Appc.java:205) 
[java] at weblogic.utils.compiler.Tool.run(Tool.java:158) 
[java] at weblogic.utils.compiler.Tool.run(Tool.java:115) 
[java] at weblogic.application.compiler.Appc.main(Appc.java:262) 
[java] at weblogic.appc.main(appc.java:14) 
[java] Caused by: java.lang.ClassNotFoundException: weblogic.j2ee.J2EELogger 
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 
[java] at java.security.AccessController.doPrivileged(Native Method) 
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:307) 
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:248) 
[java] ... 5 more 

下面是其中我在它運行Ant腳本。

<java classname="weblogic.appc" failonerror="true" fork="true" maxmemory="512m"> 
    <arg value="-disableHotCodeGen"/> 
    <arg line="-verbose"/> 
    <arg line="${weblogic.arg.line.compiler}"/> 
    <arg line="-compilerclass com.sun.tools.javac.Main"/> 
    <arg line="${weblogic.appc.options}"/> 
    <arg value="${compile.dir}/${ejb.domain}-ejbc.jar"/> 
    <arg value="${project.dir}/src/java"/> 
    <arg value="${compile.dir}/ejb/${ejb.domain}"/> 
    <classpath> 
    <path refid="weblogic.classpath"/> 
    <path refid="project.classpath"/> 
    <fileset dir="${java.home}/../lib" includes="tools.jar"/> 
    </classpath> 
</java> 

即使我不能夠找到java.lang.NoClassDefFoundError:weblogic的/ J2EE/J2EELogger。哪個jar支持這個?另外我已經正確設置了PATH和CLASSPATH。

讓我知道是否需要更多信息從我身邊。

回答

0

總之,確保您的weblogic.classpath變量中有/wlserver_10.3/server/lib/weblogic.jar

未加載的類是從/modules/com.oracle.core.weblogic.msgcat_1.1.0.0.jar。這應該通過/wlserver_10.3/server/lib/weblogic.jar中的MANIFEST.MF文件導入。假設您的weblogic.classpath中有weblogic.jar,則應加載類weblogic.j2ee.J2EELogger

weblogic.jar加載/modules/features/weblogic.server.modules_10.3.5.0.jar然後通過它自己的MANIFEST.MF加載/modules/com.oracle.core.weblogic.msgcat_1.1.0.0.jar

您的螞蟻配置中還有多個<arg line="">標籤。你需要修改這些。

<arg line="-disableHotCodeGen -verbose -compilerclass com.sun.tools.javac.Main ${weblogic.appc.options} ${compile.dir}/${ejb.domain}-ejbc.jar ${project.dir}/src/java ${compile.dir}/ejb/${ejb.domain}"> 

下面的另一個例子是我如何在我的ant版本中執行appc。

<target name="appc" depends="compile,jar"> 
    <java classname="weblogic.appc" fork="yes" jvm="${bea.java.home}/bin/java" maxmemory="1G" failonerror="true"> 
    <arg line="${archive.jarfile} -J-Xmx1g"/> 
    <classpath> 
     <pathelement path="${container.cp};${server.additional.classpath}"/> 
     <pathelement path="${archive.jarfile}"/> 
    </classpath> 
    </java> 
</target> 

此外,在-v開關運行螞蟻看到正在發出的命令,它應該幫助找出你的問題。

+0

謝謝! weblogic.j2ee.J2EELogger在下面的jar文件中找到com.bea.core.logging_1.8.0.0.jar和com.oracle.core.weblogic.msgcat_1.1.0.0.jar.but在此之後,我又得到了另一個構建問題。 [java] [java] [J2EE:160128]錯誤:不正確的appc命令行。 給出的參數太多。除了支持的選項之外,命令行只接受一個參數,源文件 。 – user350990

+0

是的,我現在也看到了。將所有程序參數放入一個 mrswadge

+0

嗨,我嘗試過單個arg,但是我仍然在使用appc編譯器:[J2EE:160128]錯誤:不正確的appc命令行。提供了太多的論據。除了受支持的選項之外,命令行只接受一個參數,即源文件。 – user350990