logo       

Re: XMLC Alpha 3 release: msg#00013

java.enhydra.xmlc

Subject: Re: XMLC Alpha 3 release


Hi David,

Unfortunately, the problem with Deferred Parsing and Xerces was not fixed.  Fortunately, I fixed it....at least the examples work now with Xerces in CATALINA_BASE/shared/lib, CATALINA_HOME/common/lib, or CATALINA_HOME/common/endorsed and the XMLC libs in WEB-INF/lib or shared/lib.  The one thing that still doesn't work quite like it used to is where I used to be able to leave the xercesImpl.jar and xmlParserAPIs.jar in common/endorsed and put the xerces that comes with XMLC in shared/lib and things still worked fine.  Now I get errors with the Deferred Parsing in the fore-mentioned situation.  However, this is still a whole lot better than the old situation where xerces and xmlc had to be in the same directory; ie... both in WEB-INF/lib or both in shared/lib or both in common/lib.  Since the xml parser is not supposed to be in WEB-INF/lib for various reasons that I've stated before, at least the ability to put Xerces in shared/lib or one of the other parent classloaders is a relief.

Here is what I had to do to fix the issue...

in org.apache.xerces.parsers.DOMParser.java:

replace
Class.forName("org.mypackage.MyClass");

with either of the following (I think they are functionally equivalent):
Class.forName("org.mypackage.MyClass", true, getClass().getClassLoader());
getClass().getClassLoader().loadClass("org.mypackage.MyClass");


Attached is a zip file containing a a diff for DOMParser.java and a copy of the modified DOMParser.java and a slightly modified build.xml which puts xerces.jar in build/shared/lib.  To find the changes in DOMParser.java either look at the diff or look for the string jrk_20021208.


NOTE:  I tried using:
Thread.currentThread().getContextClassLoader().loadClass("org.mypackage.MyClass");

And that actually worked fine at runtime when I had already built the examples and just stopped tomcat, replaced the xerces.jar with the new one, and ran the app again.  However, when I tried running the ant build, it always failed with the following error...

compile:
     [xmlc] Invoke XMLC on D:\myclasses\Servlets\xmlc-2.2-reloading\xmlc-2.2.alp
ha.3\examples\tomcat\res\pkg\xmlc\demo\test01.html
     [xmlc] Error: java.lang.IllegalArgumentException: PAR003 Class, "org.apache
.xerces.dom.DocumentImpl", not found.
     [xmlc] org.apache.xerces.dom.DocumentImpl
     [xmlc] java.lang.IllegalArgumentException: PAR003 Class, "org.apache.xerces
.dom.DocumentImpl", not found.
     [xmlc] org.apache.xerces.dom.DocumentImpl
     [xmlc]     at org.apache.xerces.parsers.DOMParser.setDocumentClassName(DOMP
arser.java:514)
     [xmlc]     at org.apache.xerces.parsers.DOMParser.<init>(DOMParser.java:228
)
     [xmlc]     at org.enhydra.xml.io.DOMParser$XercesParser.<init>(DOMParser.ja
va:95)
     [xmlc]     at org.enhydra.xml.io.DOMParser.parse(DOMParser.java:170)
     [xmlc]     at org.enhydra.xml.xmlc.metadata.MetaDataDocument.doParseMetaDat
a(MetaDataDocument.java:145)
     [xmlc]     at org.enhydra.xml.xmlc.metadata.MetaDataDocument.parseMetaData(
MetaDataDocument.java:180)
     [xmlc]     at org.enhydra.xml.xmlc.commands.options.OptionsParser.parseMeta
DataFile(OptionsParser.java:227)
     [xmlc]     at org.enhydra.xml.xmlc.commands.options.OptionsParser.parseMeta
DataOptionsFile(OptionsParser.java:243)
     [xmlc]     at org.enhydra.xml.xmlc.commands.options.OptionsParser.parseMeta
DataOptionsFiles(OptionsParser.java:260)
     [xmlc]     at org.enhydra.xml.xmlc.commands.options.OptionsParser.parse(Opt
ionsParser.java:320)
     [xmlc]     at org.enhydra.xml.xmlc.commands.xmlc.XMLCOptionsParser.parse(XM
LCOptionsParser.java:75)
     [xmlc]     at org.enhydra.xml.xmlc.commands.xmlc.XMLC.parseArgs(XMLC.java:1
01)
     [xmlc]     at org.enhydra.xml.xmlc.commands.xmlc.XMLC.compile(XMLC.java:121
)
     [xmlc]     at org.enhydra.xml.xmlc.commands.xmlc.XMLC.compileHandleErrors(X
MLC.java:142)
     [xmlc]     at org.enhydra.xml.xmlc.commands.xmlc.XMLC.main(XMLC.java:153)
     [xmlc]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [xmlc]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces
sorImpl.java:39)
     [xmlc]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet
hodAccessorImpl.java:25)
     [xmlc]     at java.lang.reflect.Method.invoke(Method.java:324)
     [xmlc]     at org.enhydra.barracuda.taskdefs.Xmlc.execute(Xmlc.java:577)
     [xmlc]     at org.apache.tools.ant.UnknownElement.execute(UnknownElement.ja
va:166)
     [xmlc]     at org.apache.tools.ant.Task.perform(Task.java:319)
     [xmlc]     at org.apache.tools.ant.Target.execute(Target.java:309)
     [xmlc]     at org.apache.tools.ant.Target.performTasks(Target.java:336)
     [xmlc]     at org.apache.tools.ant.Project.executeTarget(Project.java:1306)

     [xmlc]     at org.apache.tools.ant.Project.executeTargets(Project.java:1250
)
     [xmlc]     at org.apache.tools.ant.Main.runBuild(Main.java:610)
     [xmlc]     at org.apache.tools.ant.Main.start(Main.java:196)
     [xmlc]     at org.apache.tools.ant.Main.main(Main.java:235)


I'm not sure why that happens with the contextClassLoader, but as long as something works, I guess that is fine.

Jake


At 12:21 AM 12/9/2002 +0800, you wrote:
http://homepage.mac.com/taweili/XMLC.html

In this release:

1. Remove the legacy reload package.
2. Fix problem with Deferred Parsing and Xerces (hopefully).
3. Improve the XMLC taskdef to take option files into dependency check.

David Li

_______________________________________________
XMLC mailing list
XMLC@xxxxxxxxxxx
http://www.enhydra.org/mailman/listinfo.cgi/xmlc

Attachment: xmlc.examples.2.2alpha3.mods.zip
Description: Zip archive

<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise