Bug 170288 - Can't find Bcel delegate error when weaving exploded struts.jar with multiple aspects
Summary: Can't find Bcel delegate error when weaving exploded struts.jar with multiple...
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.2   Edit
Hardware: PC Windows XP
: P4 normal (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-01-11 22:20 EST by jennie CLA
Modified: 2008-10-02 14:04 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jennie CLA 2007-01-11 22:20:05 EST
I tried to weave the action/ directory of an exploded struts jar but get an Abort. 

== ajc.bat command ==:
ajc.bat -inpath action -d actionNew -classpath <myclasspath>
-aspectpath "C:/Core/aspects/aspects.jar" -Xlintfile "C:/Core/Xlint.properties 

== PointCut in one of the aspects (there are several aj files) looks like this ==:
pointcut strutsAction(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response):
	execution(ActionForward Action.*(ActionMapping, ActionForm,  
                  HttpServletRequest, HttpServletResponse))
	          && args(mapping, form, request, response);


== error in the core dump ==: 
abort ABORT -- (BCException) Can't find bcel delegate for org.apache.struts.action.ActionMapping type=class org.aspectj.weaver.ReferenceType
when weaving classes 
when weaving 
when batch building BuildConfig[null] #Files=0

Can't find bcel delegate for org.apache.struts.action.ActionMapping type=class org.aspectj.weaver.ReferenceType
when weaving classes 
when weaving 
when batch building BuildConfig[null] #Files=0

org.aspectj.weaver.BCException: Can't find bcel delegate for org.apache.struts.action.ActionMapping type=class org.aspectj.weaver.ReferenceType
when weaving classes 
when weaving 
when batch building BuildConfig[null] #Files=0

	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1111)
	at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.weave(AjCompilerAdapter.java:311)
	at org.aspectj.ajdt.internal.compiler.AjCompilerAdapter.afterCompiling(AjCompilerAdapter.java:183)
	at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:70)
	at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:367)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:862)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:242)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:161)
	at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
	at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
	at org.aspectj.tools.ajc.Main.run(Main.java:367)
	at org.aspectj.tools.ajc.Main.runMain(Main.java:246)
	at org.aspectj.tools.ajc.Main.main(Main.java:86)

== Alternatives that worked ==:
If I do 
1) each class file one at a time (per ajc call), i.e. the -inpath directory has only one class file.
2) each aspect file at a time (per ajc call), i.e. 
ajc.bat -inpath action -d actionNew -classpath <myclasspath>
SampleAspect.aj -Xlintfile "C:/Core/Xlint.properties 

then weaving succeeds. 

1) I thought that the compiler would be doing the same thing given one file or multiple files in a directory internally. Is there some optimization for multiple files? Same question for multiple vs. one aspect. 
 
 
Please let me know if you need any other information.
Comment 1 Andrew Clement CLA 2008-10-02 14:04:03 EDT
> I thought that the compiler would be doing the same thing given one file or
> multiple files in a directory internally. Is there some optimization for
> multiple files? Same question for multiple vs. one aspect. 

There is no optimization for multiple files, it is the same thing.  However in order to weave correctly we need to resolve many types and if they are not all available on the classpath then errors might appear like you mention.

if this is still an issue for you I will look into it.  

I hope 'action' is a root location with package structure and types below it?  If it is just halfway down a package structure (eg. bin/com/something/foo/action/somesubpackage/*.class), I don't think we support that (I've never tried it) - and if it is doesn't work that would be an enhancement request.