-
15. Re: JBossRetro weaver issues
ryan.campbell Feb 8, 2006 4:43 PM (in response to starksm64)Cruisecontrol scheduled: http://jira.jboss.com/jira/browse/JBQA-290
I will look into the JBossWS retroweaving and create JIRA tasks for any problems encountered. http://jira.jboss.com/jira/browse/JBAS-2791 -
16. Re: JBossRetro weaver issues
ryan.campbell Feb 13, 2006 11:05 PM (in response to starksm64)
I've created a build-retro.xml in webservices which imports the webservices/build.xml so that I can integrate seamlessly with the existing build without screwing up the dependency structure. It assumes jbossretro is built and checked out in ../jbossretro.export JAVA_HOME=/pathto/jdk5 ant clean ant -f build-retro.xml module-jars14 -Dretro=yes export JAVA_HOME=/pathto/jdk1.4 ant -f build-retro.xml check
-
17. Re: JBossRetro weaver issues
ryan.campbell Feb 13, 2006 11:07 PM (in response to starksm64)The retroweave task completes without error, but the check task is failing with this exception:
[retrocheck] Exception in thread "main" java.lang.NullPointerException [retrocheck] at javassist.bytecode.ConstPool.getNameAndTypeName(ConstPool.java:195) [retrocheck] at javassist.bytecode.EnclosingMethodAttribute.methodName(EnclosingMethodAttribute.java:85) [retrocheck] at javassist.bytecode.EnclosingMethodAttribute.copy(EnclosingMethodAttribute.java:108) [retrocheck] at javassist.bytecode.AttributeInfo.copyAll(AttributeInfo.java:236) [retrocheck] at javassist.bytecode.ClassFile.compact(ClassFile.java:127) [retrocheck] at org.jboss.ant.tasks.retrocheck.Checker.doCheck(Checker.java:451) [retrocheck] at org.jboss.ant.tasks.retrocheck.Checker.checkFile(Checker.java:287) [retrocheck] at org.jboss.ant.tasks.retrocheck.Checker.check(Checker.java:198) [retrocheck] at org.jboss.ant.tasks.retrocheck.Checker.main(Checker.java:100)
I will dig deeper in this tomorrow unless the stack trace points to something obvious. -
18. Re: JBossRetro weaver issues
adrian.brock Feb 14, 2006 4:57 AM (in response to starksm64)This is something I fixed a couple of weeks ago.
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=76831
Use the version of javassist from jbossretro not the one that is a part of JBossAS. -
19. Re: JBossRetro weaver issues
adrian.brock Feb 14, 2006 3:42 PM (in response to starksm64)I fixed your build script and also the missing mapping for ConcurrentMap.
It now shows the unimplemented weaving:[ejort@htimes2 webservice]$ ant -f build-retro.xml check Buildfile: build-retro.xml _buildmagic:init: Trying to override old definition of task property _buildmagic:init:buildlog: configure: _default:task-init: init: check: [retrocheck] ==== /home/ejort/jboss-head/workspace/webservice/output/classes-retro/org/jboss/ws/utils/ToolsUtils.class [retrocheck] Cannot find method java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String; [retrocheck] Cannot find method java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String; [retrocheck] Cannot find method java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String; [retrocheck] ==== /home/ejort/jboss-head/workspace/webservice/output/classes-retro/org/jboss/ws/wsse/STRTransform.class [retrocheck] Cannot find method java.lang.String.contains(Ljava/lang/CharSequence;)Z [retrocheck] ==== /home/ejort/jboss-head/workspace/webservice/output/classes-retro/org/jboss/ws/wspolicy/PolicyAssertion.class [retrocheck] Cannot find interface method org.w3c.dom.Document.adoptNode(Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node; [retrocheck] ==== /home/ejort/jboss-head/workspace/webservice/output/classes-retro/org/jboss/ws/soap/DocumentFragmentImpl.class [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.compareDocumentPosition(Lorg/w3c/dom/Node;)S [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.getBaseURI()Ljava/lang/String; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.getFeature(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.getTextContent()Ljava/lang/String; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.getUserData(Ljava/lang/String;)Ljava/lang/Object; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.isDefaultNamespace(Ljava/lang/String;)Z [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.isEqualNode(Lorg/w3c/dom/Node;)Z [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.isSameNode(Lorg/w3c/dom/Node;)Z [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.lookupNamespaceURI(Ljava/lang/String;)Ljava/lang/String; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.lookupPrefix(Ljava/lang/String;)Ljava/lang/String; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.setTextContent(Ljava/lang/String;)V [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object; [retrocheck] ==== /home/ejort/jboss-head/workspace/webservice/output/classes-retro/org/jboss/ws/tools/WSDLToJava.class [retrocheck] Cannot find method java.lang.String.replace(Ljava/lang/CharSequence;Ljava/lang/CharSequence;)Ljava/lang/String; [retrocheck] ==== /home/ejort/jboss-head/workspace/webservice/output/classes-retro/org/jboss/ws/jaxb/JAXBUnmarshallerImpl$SoapElementHandler.class [retrocheck] Cannot find constructor java.lang.IllegalStateException(Ljava/lang/String;Ljava/lang/Throwable;)V [retrocheck] Cannot find constructor java.lang.IllegalStateException(Ljava/lang/String;Ljava/lang/Throwable;)V [retrocheck] ==== /home/ejort/jboss-head/workspace/webservice/output/classes-retro/org/jboss/ws/metadata/AnnotationsMetaDataBuilder.class [retrocheck] Cannot find method java.lang.reflect.Method.getParameterAnnotations()[[Lorg/jboss/lang/Annotation; [retrocheck] ==== /home/ejort/jboss-head/workspace/webservice/output/classes-retro/org/jboss/ws/wspolicy/PolicyFactory.class [retrocheck] Cannot find constructor java.lang.IllegalArgumentException(Ljava/lang/String;Ljava/lang/Throwable;)V BUILD FAILED /home/ejort/jboss-head/workspace/webservice/build-retro.xml:77: Java returned: 1
-
20. Re: JBossRetro weaver issues
adrian.brock Feb 14, 2006 3:46 PM (in response to starksm64)These can be summarised as four problems:
1) DOM level problems
2) String.replace with character sequences (not in JDK1.4)
3) Parameter annotations
4) Exception constructors that don't exist in JDK1.4 -
21. Re: JBossRetro weaver issues
ryan.campbell Feb 14, 2006 10:43 PM (in response to starksm64)I just ran the check target against the *retrotranslator* output (after adding retrotranslator to the classpath) and got the following results:
[retrocheck] ==== /home/rcampbell/work/jboss-head/webservice/output/classes-retro/org/jboss/ws/wspolicy/PolicyAssertion.class [retrocheck] Cannot find interface method org.w3c.dom.Document.adoptNode(Lorg/w3c/dom/Node;)Lorg/w3c/dom/Node; [retrocheck] ==== /home/rcampbell/work/jboss-head/webservice/output/classes-retro/org/jboss/ws/soap/DocumentFragmentImpl.class [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.compareDocumentPosition(Lorg/w3c/dom/Node;)S [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.getBaseURI()Ljava/lang/String; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.getFeature(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/Object; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.getTextContent()Ljava/lang/String; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.getUserData(Ljava/lang/String;)Ljava/lang/Object; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.isDefaultNamespace(Ljava/lang/String;)Z [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.isEqualNode(Lorg/w3c/dom/Node;)Z [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.isSameNode(Lorg/w3c/dom/Node;)Z [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.lookupNamespaceURI(Ljava/lang/String;)Ljava/lang/String; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.lookupPrefix(Ljava/lang/String;)Ljava/lang/String; [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.setTextContent(Ljava/lang/String;)V [retrocheck] Cannot find interface method org.w3c.dom.DocumentFragment.setUserData(Ljava/lang/String;Ljava/lang/Object;Lorg/w3c/dom/UserDataHandler;)Ljava/lang/Object; [retrocheck] ==== /home/rcampbell/work/jboss-head/webservice/output/classes-retro/org/jboss/ws/jaxb/JAXBUnmarshallerImpl$SoapElementHandler.class [retrocheck] Cannot find constructor java.lang.IllegalStateException(Ljava/lang/String;Ljava/lang/Throwable;)V [retrocheck] Cannot find constructor java.lang.IllegalStateException(Ljava/lang/String;Ljava/lang/Throwable;)V [retrocheck] ==== /home/rcampbell/work/jboss-head/webservice/output/classes-retro/org/jboss/ws/wspolicy/PolicyFactory.class [retrocheck] Cannot find constructor java.lang.IllegalArgumentException(Ljava/lang/String;Ljava/lang/Throwable;)V
Anyway, I'll create JIRA subtasks for the 4 issues. -
22. Re: JBossRetro weaver issues
starksm64 Feb 15, 2006 3:48 AM (in response to starksm64)I tried adding an edit(ConstructorCall) to the ClassRedirectEditor to convert the new jdk5 exception ctors like IllegalArgumentException(String, Throwable), but I'm not seeing these get passed to the edit method.
public void edit(ConstructorCall call) throws CannotCompileException { ... }
The new IllegalArgumentException from this fragment in org.jboss.ws.wspolicy.PolicyFactory should be getting passed to this shouldn't it?public Policy createPolicy(String strPolicy) { try { return createPolicy(DOMUtils.parse(strPolicy)); } catch (IOException ex) { throw new IllegalArgumentException("Cannot parse: " + strPolicy, ex); } }
-
23. Re: JBossRetro weaver issues
adrian.brock Feb 15, 2006 4:31 AM (in response to starksm64)You need to use:
public void edit(NewExpr newExpr) throws CannotCompileException { ... }
-
24. Re: JBossRetro weaver issues
adrian.brock Feb 15, 2006 4:32 AM (in response to starksm64)It looks like ConstructorCall just catches
this() and super() constructor invocations. -
25. Re: JBossRetro weaver issues
adrian.brock Feb 15, 2006 4:34 AM (in response to starksm64)On the DOM stuff.
I think we need to write or configure the ClassPool such that it prefers the classpath
classes over the JDK classes.
That way it will use Xerces (in the classpath) rather than the JDK version. -
26. Re: JBossRetro weaver issues
adrian.brock Feb 15, 2006 4:36 AM (in response to starksm64)"ryan.campbell@jboss.com" wrote:
I just ran the check target against the *retrotranslator* output (after adding retrotranslator to the classpath) and got the following results:
So the retrotranslater stuff is also incomplete. :-)
Except we wouldn't have found this out until runtime without RetroCheck. -
27. Re: JBossRetro weaver issues
ryan.campbell Feb 15, 2006 9:07 AM (in response to starksm64)"adrian@jboss.org" wrote:
So the retrotranslater stuff is also incomplete. :-)
Except we wouldn't have found this out until runtime without RetroCheck.
That was my point: only a couple of things need to be fixed to be functionally equivalent. -
28. Re: JBossRetro weaver issues
starksm64 Feb 15, 2006 10:18 AM (in response to starksm64)"adrian@jboss.org" wrote:
It looks like ConstructorCall just catches
this() and super() constructor invocations.
Ok thanks. I was suspicious of all of the RuntimeException ctors I saw being called in the log. -
29. Re: JBossRetro weaver issues
starksm64 Feb 15, 2006 10:31 AM (in response to starksm64)So I see you added support for specific exceptions. I was thinking of making this a little more generic using an approach like:
public class ClassRedirectEditor extends ExprEditor { ... /** */ private static HashSet<String> exceptionCtors = new HashSet<String>(); static { exceptionCtors.add("java.lang.IllegalArgumentException(Ljava/lang/String;Ljava/lang/Throwable;)V"); } public void edit(NewExpr newExpr) throws CannotCompileException { String signature = newExpr.getSignature(); boolean hasMsg = method.getParameterTypes().length == 1; if (exceptionCtors.contains(signature)) { if( hasMsg == false ) { call.replace("$_ = " + EXCEPTION_HELPER + ".createExceptionWithCause($class, $1);"); } else { call.replace("$_ = " + EXCEPTION_HELPER + ".createExceptionWithCause($class, $1, $2);"); } } } ... } public class ExceptionHelper { public static Throwable createExceptionWithCause(Class exClass, Throwable cause) { return createExceptionWithCause(exClass, null, cause); } public static Throwable createExceptionWithCause(Class exClass, String msg, Throwable cause) { Throwable ex = null; try { Class[] sig = {String.class}; Constructor ctor = exClass.getConstructor(sig); Object[] args = {msg}; ex = (Throwable) ctor.newInstance(args); ex.initCause(cause); } catch(Exception e) { e.printStackTrace(); } return ex; } }
This way the signatures could just be added and even externalized.