|
|
Re: XMLC 2.2 Alpha 2 and Examples released (Download location): msg#00131
java.enhydra.xmlc
|
Subject: |
Re: XMLC 2.2 Alpha 2 and Examples released (Download location) |
Here are some slight modifications to the example app make things work
for both Unix and Windows users out of the box (attached zip file).
I've included only the files that were modified. Should be obvious
where they go.
Jake
At 02:34 PM 11/30/2002 -0600, you wrote:
Hi David,
Is the XMLC reloading mechanism or anywhere else using Class.forName() to
load classes? This would explain the lack of ability to load
classes across classloaders. Any instance of Class.forName(String)
should be changed to
Thread.currentThread().getContextClassLoader().loadClass(String).
I'm pretty sure that will fix most of the classloading issues I have
experienced.
jake
At 05:07 AM 11/29/2002 +0800, you wrote:
Hi
Are you running this under Cygnus shell or Cmd? What's your JDK
version?
I just tested on Windows machine and it works fine after I remove
the xercesImpl.jar/xml-api.jar from Ant's lib. I use cmd and fresh copy
of Ant/Tomcat/XMLC. It works except a path separator problem in the
examples/tomcat/build/webapps/xmlc/WEB-INF/web.xml has to be fixed.
Turning the / to \ in the file.
David
On Friday, Nov 29, 2002, at 15:55 Asia/Shanghai, Jacob Kjome wrote:
Hi David,
I'm getting the following error trying to build the example app. I
think this would be solved if I could put a "classpathref attribute
on the
<xmlc ..../> element or use a nested <classpath> element,
neither of which are supported by the Xmlc taskdef. However, the
Localize taskdef from the Barracuda project which extends the Xmlc
taskdef supports both strategies for adding a classpath. I guess
first, I'm not sure how you got the build to run correctly and second,
maybe the Xmlc taskdef needs to support the classpathref attribute and
the nested <classpath> elements. BTW, I did set the xmlc.home
and tomcat.home properties correctly in build.properties. .......
compile:
[xmlc] Invoke XMLC on
D:\myclasses\Servlets\xmlc-2.2-reloading\xmlc-2.2.alp
ha.2\examples\tomcat\res\pkg\xmlc\demo\test01.html
[xmlc] Error:
java.lang.IllegalArgumentException: PAR003 Class, "org.enhydr
a.xml.xmlc.metadata.MetaDataDocument", not found.
[xmlc]
org.enhydra.xml.xmlc.metadata.MetaDataDocument
[xmlc] java.lang.IllegalArgumentException:
PAR003 Class, "org.enhydra.xml.x
mlc.metadata.MetaDataDocument", not found.
[xmlc]
org.enhydra.xml.xmlc.metadata.MetaDataDocument
[xmlc] at
org.apache.xerces.parsers.DOMParser.setDocumentClassName(DOMP
arser.java:510)
[xmlc] at
org.enhydra.xml.io.DOMParser$XercesParser.<init>(DOMParser.ja
va:97)
[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:584)
[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)
D:\myclasses\Servlets\xmlc-2.2-reloading\xmlc-2.2.alpha.2\examples\tomcat>
Jake
At 01:52 AM 11/28/2002 +0800, you wrote:
The release is at the same location:
http://homepage.mac.com/taweili/XMLC.html
David
On Thursday, Nov 28, 2002, at 01:31 Asia/Shanghai, David Li wrote:
The release fixes several bugs and updates several helpers classes to
ease the integration of XMLC in a servlet containers. This new release
contains an example webapp using the new reloading for XMLC which can be
easily deploy under Tomcat containers. (nothing Tomcat specific about it
but I just have time to test it on Tomcat.)
The attached is the README for the example.
David
---
This is an example program to demo how to use XMLC in a Servlet. The
example is use Tomcat 4.1.12, other containers have not been tested.
Configuration:
Copy the 'build.properties.examples' to 'build.properties' and
edit
the two properties according to your local setup.
Build:
Simply 'ant'
Running:
A script run-tomcat.sh will be created in this directory. Just
type
$ ./run-tomcat.sh
Accessing the demo:
The demo servlet is located at /xmlc/ReloadTest and can be access
with
http://localhost:8080/xmlc/ReloadTest
The servlet expects a 'docClass' or a
'doc' parameter pointing to
the document to be retrived.
The 'docClass' parameter points to a fully qualified classname of
a
XMLC compiled page. Currently available document class are:
Compiled from res/pkg,
xmlc.demo.test01HTML
xmlc.demo.test02HTML
Compiled from res/page
xmlc.page.page01HTML
xmlc.page.page02HTML
Example:
http://localhost:8080/xmlc/ReloadTest?docClass=xmlc.page.page02HTML
The 'doc' parameter points to a relative
path name of a page to be
compiled and retrieved. These pages do not have to be precompiled
by
XMLC in order to be loaded and use as a XMLObject. Currently
available documents are:
dyna/dyna01.html
dyna/dyna02.html
The following pages are the source of the above
compiled XMLC
class. They can be loaded with the following path
name. However,
loading them will only return a XMLObject, not the
above named
class/interface.
page/page01.html
page/page02.html
pkg/xmlc/demo/test01.html
pkg/xmlc/demo/test02.html
Examples:
http://localhost:8080/xmlc/ReloadTest?doc=dyna/dyna01.html
ReloadTest source:
The source code for ReloadTest servlet is located under
src/xmlc/demo/ReloadTest.java. This file demostracted the use of
the
following class:
org.enhydra.xml.xmlc.servlet.XMLCContext:
This is a convenient class to integrate
XMLC with Servlet. It
configure the XMLCFactory with parameter
from Servlet
context. In this demo, the configuration
is done in
res/webapps/xmlc/WEB-INF/web.xml for the
XMLC WebApp. The
document on the parameters can be found in
the javadoc of
org.enhydra.xml.xmlc.servlet.XMLCContext.
This class also provides methods to
serialize of XMLObject
object to the response with various of
configuration.
org.enhydra.xml.xmlc.deferredparsing.XMLCDeferredParsingFactory:
The dynamic page loading using method the
createFromFile which
is specific to this call and not in
XMLCFactory. The use of this
method is demo here.
_______________________________________________
XMLC mailing list
XMLC@xxxxxxxxxxx
http://www.enhydra.org/mailman/listinfo.cgi/xmlc
_______________________________________________
XMLC mailing list
XMLC@xxxxxxxxxxx
http://www.enhydra.org/mailman/listinfo.cgi/xmlc
</blockquote></x-html>
example.mod.zip
Description: Zip archive
| |