Ant jwsc webservice构建期间的java.lang.IllegalAccessException

时间:2010-12-21 15:52:22

标签: web-services ant weblogic-10.x

我有一个大型应用程序,其中一部分依赖于一组3个Web服务。我目前正在编写Ant构建脚本以构建应用程序并将其打包到EAR文件中。在为此应用程序构建Web子项目时,我使用Ant中的<jwsc>任务来编译Web服务。这会导致IllegalAccessException,如下面的堆栈跟踪中所述:

 [jwsc] warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
 [jwsc] JWS: processing module weboutput
 [jwsc] Parsing source files
 [jwsc] Parsing source files
 [jwsc] 3 JWS files being processed for module weboutput
 [jwsc] JWS: C:\dev\ir\irWeb\src\webservices\DailyRun.java Validated.
 [jwsc] JWS: C:\dev\ir\irWeb\src\webservices\PendingRegistrationsSweep.java Validated.
 [jwsc] JWS: C:\dev\ir\irWeb\src\webservices\RegistrationsGoLive.java Validated.
 [jwsc] Compiling 6 source files to C:\DOCUME~1\KEVIN~1.BRE\LOCALS~1\Temp\_5l950r
 [jwsc] An exception has occurred in the compiler (1.6.0_23). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
 [jwsc] java.lang.IllegalAccessError: tried to access class com.sun.tools.javac.jvm.ClassReader$AnnotationDefaultCompleter from class com.sun.tools.javac.jvm.ClassReader
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.attachAnnotationDefault(ClassReader.java:1128)
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.readMemberAttr(ClassReader.java:906)
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.readMemberAttrs(ClassReader.java:1027)
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.readMethod(ClassReader.java:1490)
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.readClass(ClassReader.java:1586)
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.readClassFile(ClassReader.java:1658)
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.fillIn(ClassReader.java:1845)
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.complete(ClassReader.java:1777)
 [jwsc]     at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
 [jwsc]     at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:763)
 [jwsc]     at com.sun.tools.javac.jvm.ClassReader.loadClass(ClassReader.java:1951)
 [jwsc]     at com.sun.tools.javac.comp.Resolve.loadClass(Resolve.java:842)
 [jwsc]     at com.sun.tools.javac.comp.Resolve.findIdentInPackage(Resolve.java:1011)
 [jwsc]     at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1921)
 [jwsc]     at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1835)
 [jwsc]     at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1522)
 [jwsc]     at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
 [jwsc]     at com.sun.tools.javac.comp.Attr.attribType(Attr.java:390)
 [jwsc]     at com.sun.tools.javac.comp.MemberEnter.attribImportType(MemberEnter.java:681)
 [jwsc]     at com.sun.tools.javac.comp.MemberEnter.visitImport(MemberEnter.java:545)
 [jwsc]     at com.sun.tools.javac.tree.JCTree$JCImport.accept(JCTree.java:495)
 [jwsc]     at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:387)
 [jwsc]     at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:399)
 [jwsc]     at com.sun.tools.javac.comp.MemberEnter.visitTopLevel(MemberEnter.java:512)
 [jwsc]     at com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:446)
 [jwsc]     at com.sun.tools.javac.comp.MemberEnter.memberEnter(MemberEnter.java:387)
 [jwsc]     at com.sun.tools.javac.comp.MemberEnter.complete(MemberEnter.java:819)
 [jwsc]     at com.sun.tools.javac.code.Symbol.complete(Symbol.java:386)
 [jwsc]     at com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:763)
 [jwsc]     at com.sun.tools.javac.comp.Enter.complete(Enter.java:464)
 [jwsc]     at com.sun.tools.javac.comp.Enter.main(Enter.java:442)
 [jwsc]     at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:819)
 [jwsc]     at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
 [jwsc]     at com.sun.tools.javac.main.Main.compile(Main.java:353)
 [jwsc]     at com.sun.tools.javac.main.Main.compile(Main.java:279)
 [jwsc]     at com.sun.tools.javac.main.Main.compile(Main.java:270)
 [jwsc]     at com.sun.tools.javac.Main.compile(Main.java:69)
 [jwsc]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 [jwsc]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
 [jwsc]     at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1097)
 [jwsc]     at weblogic.wsee.tools.anttasks.DelegatingJavacTask$ExposingJavac.compile(DelegatingJavacTask.java:343)
 [jwsc]     at weblogic.wsee.tools.anttasks.DelegatingJavacTask.compile(DelegatingJavacTask.java:286)
 [jwsc]     at weblogic.wsee.tools.anttasks.JwscTask.javac(JwscTask.java:335)
 [jwsc]     at weblogic.wsee.tools.anttasks.JwsModule.compile(JwsModule.java:390)
 [jwsc]     at weblogic.wsee.tools.anttasks.JwsModule.build(JwsModule.java:262)
 [jwsc]     at weblogic.wsee.tools.anttasks.JwscTask.execute(JwscTask.java:227)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.Target.execute(Target.java:390)
 [jwsc]     at org.apache.tools.ant.Target.performTasks(Target.java:411)
 [jwsc]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
 [jwsc]     at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
 [jwsc]     at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
 [jwsc]     at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
 [jwsc]     at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.Target.execute(Target.java:390)
 [jwsc]     at org.apache.tools.ant.Target.performTasks(Target.java:411)
 [jwsc]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
 [jwsc]     at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
 [jwsc]     at com.bea.workshop.cmdline.antlib.AntExTask.execute(AntExTask.java:406)
 [jwsc]     at com.bea.workshop.cmdline.antlib.AntCallExTask.execute(AntCallExTask.java:118)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.Target.execute(Target.java:390)
 [jwsc]     at org.apache.tools.ant.Target.performTasks(Target.java:411)
 [jwsc]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
 [jwsc]     at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
 [jwsc]     at com.bea.workshop.cmdline.antlib.AntExTask.execute(AntExTask.java:406)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
 [jwsc]     at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:217)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
 [jwsc]     at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:197)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor44.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:154)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
 [jwsc]     at net.sf.antcontrib.logic.ForTask.doSequentialIteration(ForTask.java:259)
 [jwsc]     at net.sf.antcontrib.logic.ForTask.doToken(ForTask.java:268)
 [jwsc]     at net.sf.antcontrib.logic.ForTask.doTheTasks(ForTask.java:299)
 [jwsc]     at net.sf.antcontrib.logic.ForTask.execute(ForTask.java:244)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.Target.execute(Target.java:390)
 [jwsc]     at org.apache.tools.ant.Target.performTasks(Target.java:411)
 [jwsc]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
 [jwsc]     at org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:38)
 [jwsc]     at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
 [jwsc]     at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:442)
 [jwsc]     at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:105)
 [jwsc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
 [jwsc]     at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
 [jwsc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 [jwsc]     at java.lang.reflect.Method.invoke(Method.java:597)
 [jwsc]     at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
 [jwsc]     at org.apache.tools.ant.Task.perform(Task.java:348)
 [jwsc]     at org.apache.tools.ant.Target.execute(Target.java:390)
 [jwsc]     at org.apache.tools.ant.Target.performTasks(Target.java:411)
 [jwsc]     at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
 [jwsc]     at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
 [jwsc]     at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
 [jwsc]     at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
 [jwsc]     at org.apache.tools.ant.Main.runBuild(Main.java:801)
 [jwsc]     at org.apache.tools.ant.Main.startAnt(Main.java:218)
 [jwsc]     at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
 [jwsc]     at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
     

[AntUtil.deleteDir]删除目录C:\ DOCUME~1 \ KEVIN~1。BRE \ LOCALS~1 \ Temp_5l950r

使用<jwsc>任务的Ant目标是:

<target name="webservice.build" depends="init,generated.root.init">
  <path id="jwsc.srcpath">
    <path path="${java.sourcepath}" />
    <pathelement path="build/assembly/.src" />
  </path>

  <taskdef name="jwsc" classname="weblogic.wsee.tools.anttasks.JwscTask" >
    <classpath> 
      <path refid="weblogic.jar.classpath" />
    </classpath> 
  </taskdef>

  <property name="jwsc.module.root" value="${project.dir}/build/weboutput"/>

  <property name="jwsc.contextpath" value="irWeb"/>

  <property name="jwsc.srcpath.prop" refid="jwsc.srcpath"/>

  <path id="jwsc.classpath">
    <path refid="weblogic.jar.classpath" />
    <path refid="java.classpath" />
    <pathelement path="${java.outpath}" />
  </path>

  <jwsc destdir="${project.dir}/build" classpathref="jwsc.classpath">
    <module name="weboutput" explode="true" contextPath="${jwsc.contextpath}" >
      <jwsFileSet srcdir="${webservices.dir}" type="JAXRPC"> 
        <include name="**/*.java"/>
      </jwsFileSet> 
      <descriptor file="${jwsc.module.root}/WEB-INF/web.xml" />
      <descriptor file="${jwsc.module.root}/WEB-INF/weblogic.xml" />
    </module>
  </jwsc>
</target>

我不知道是什么原因导致编译器在构建时抛出此错误,并且谷歌搜索的一天已经发现由不同触发器引起的此错误的其他实例,并且这些问题的解决方案不起作用我。我还在Oracle论坛上发现了一份似乎是该问题的副本的单一报告,但没有回复。

该应用程序是在Weblogic Workshop 10中编写的,在Weblogic Server 10.3上运行,并使用Beehive / NetUI。不确定这是否会有所作为。构建脚本由Weblogic Workshop自动生成,我自己对文件的其他方面进行了一些调整和修复,以修复其他兼容性问题。我使用的是Sun的Java 1.6.0_23和Ant 1.8.1

非常感谢任何帮助或建议。

~~~ EDIT ~~~ 更新:我通过将我的系统上的JDK从Sun JDK更改为WebLogic附带的JRockit JDK找到了解决方法。我猜JRockit与Sun JDK相比,为WebLogic修改和优化了类。

((另外,不确定是否将其放入编辑或答案中,因此选择了编辑。如果这是错误的地方,我道歉。)

2 个答案:

答案 0 :(得分:2)

在jwsc任务上使用fork =“true”。它解决了这个问题,而没有切换到JRockit。

答案 1 :(得分:1)

您遇到的错误是因为您的应用程序(真正的ant任务)正在尝试访问对其具有访问限制的类。这就是为什么它适用于JRockit而不是Sun.

其中一个支持库可能存在错误。你应该按照它说的做,并在适当的地方提交错误。