[jdom-interest] Problem using the Crimson Parser

HOOI Tak Keong, Henry tkhooi at my.ncs-i.com
Thu Aug 16 22:46:59 PDT 2001


Hi All, 

I'm having a hard time trying to figure out how to use the Crimson parser
instead of the Xerces one, and I was hoping someone on the list could help
me out. Based on the readme file, I included the crimson.jar, jaxp.jar and
jdom.jar into the classpath environment variable, and left out the
xerces.jar(the default one)

	SET
CLASSPATH=%MY_PROJECT%\lib\jdom.jar;%MY_PROJECT%\lib\jaxp.jar;%MY_PROJECT%\l
ib\crimson.jar

And when I ran my servlet that made a call to the parser, I got the
following Security Exception:

2001-08-17 12:09:24 - ContextManager: Adding context Ctx( /examples )
2001-08-17 12:09:24 - ContextManager: Adding context Ctx( /admin )
Starting tomcat. Check logs/tomcat.log for error messages
2001-08-17 12:09:24 - ContextManager: Adding context Ctx(  )
2001-08-17 12:09:24 - ContextManager: Adding context Ctx( /test )
2001-08-17 12:09:24 - ContextManager: Adding context Ctx( /crm )
2001-08-17 12:09:24 - ContextManager: Adding context Ctx( /sptb )
2001-08-17 12:09:24 - ContextManager: Adding context Ctx( /TestNewMVC )
PATH: C:\jakarta-tomcat-3.2.1\webapps\TestNewMVC\log\
Log Level: 0
2001-08-17 12:09:25 - PoolTcpConnector: Starting HttpConnectionHandler on
8080
2001-08-17 12:09:25 - PoolTcpConnector: Starting Ajp12ConnectionHandler on
8007
java.lang.SecurityException: sealing violation
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:234)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
        at
vrs.controller.MappingRules.parseMappingConfig(MappingRules.java:48)
        at vrs.controller.MappingRules.getInstance(MappingRules.java:32)
        at vrs.controller.BaseServlet.doPost(BaseServlet.java:62)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:4
04)
        at org.apache.tomcat.core.Handler.service(Handler.java:286)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372
)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:797)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743
)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
n(HttpConnectionHandler.java:210)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java
:498)
        at java.lang.Thread.run(Thread.java:484)


I'm assuming that I'm receiving this error because I have extracted the
crimson, jaxp and jdom jar files out of their defult directory (e.g.
c:\jdom\lib) and am running them in my own project directory. Although this
doesn't make sense I don't know how to move on. I've searched the mailing
list already and came across a few mails with similar issues but there
didn't seem to be any answer to it. Please help me out.. Thank you..

The code I used to invoke the parser is listed below...

try {
			System.out.println("********RELOADING*********");
			SAXBuilder builder =  new SAXBuilder();
			Document doc = builder.build(thisFile);		
			Element businessrules = doc.getRootElement();

			List commands =
businessrules.getChildren("command");		
			Iterator i = commands.iterator();		
			while (i.hasNext()) {
				Element command = (Element) i.next();

				String name =
command.getChild("name").getText();
				Element pages = command.getChild("pages");
				List forwardList =
pages.getChildren("forward");
				Iterator j = forwardList.iterator();
				
				PageList pageList = new PageList();
			
				while (j.hasNext()) {
					Element forward = (Element)j.next();

					String pageName =
forward.getAttribute("name").getValue();
					String resource =
forward.getAttribute("resource").getValue();
					String sequence = "";
					String xsl= "";
					if (forward.getAttribute("sequence")
!= null) 
						sequence =
forward.getAttribute("sequence").getValue();
					if (forward.getAttribute("xsl") !=
null) 
						xsl =
forward.getAttribute("xsl").getValue();
					System.out.println("PARSING:");
					System.out.println("pageName:" +
pageName);
					System.out.println("resource:" +
resource);
					System.out.println("sequence:" +
sequence);
					System.out.println("xsl:" + xsl);
					System.out.println("\n");
					
					Forwarder fwd = new Forwarder();
					fwd.setResource(resource);
					fwd.setXsl(xsl);
					System.out.println("LENGTH: " +
sequence.length() );
					fwd.setSequence(sequence.length() >=
1 );
					
					pageList.setPgNameVec(pageName);
					pageList.setPropertyVec(fwd);
				}
				mappingTable.put(name, pageList);
			}
	 	} catch (JDOMException e) {
		            if (e.getRootCause() != null) {
	            	e.getRootCause().printStackTrace();
	            } else {
			e.printStackTrace();
	            }
	        } catch (Exception e) {
			e.printStackTrace();
	        }  


Cheers'
Henry Hooi Tak Keong
Software Engineer, 
NCS-I (Malaysia) Sdn. Bhd.
Tel: 603-7725-6878 (ext. 119)
tkhooi at my.ncs-i.com

This email (including all attachments) contains confidential information,
which may be privileged. It is intended solely for the identified
recipient(s) to whom it is addressed. If you are not an intended recipient,
please reply to us immediately and delete this message from your system. You
may not copy or use it for any purpose, or otherwise disclose its contents
to any person.




More information about the jdom-interest mailing list