FW: [jdom-interest] Sealing violation

Steven Smith ssmith at neonsys.com
Thu Mar 8 11:27:20 PST 2001


Here's the response from Eric...I thought it went to the list, but it was
send directly to me.

One additional question, is JDomServlet2 in a package?  The code snippet
doesn't reflect it, but on closer examination it looks like your problem
might be with that file.

-----Original Message-----
From: Eric Burke [mailto:burke_e at yahoo.com]
Sent: Thursday, March 08, 2001 12:42 PM
To: Steven Smith
Subject: RE: [jdom-interest] Sealing violation


The "sealing violation" is always a CLASSPATH
issue.  Under Tomcat 3.x, Tomcat includes its
own XML JAR files in your web app's 
environment. We found that we had to hand-edit
Tomcat's startup scripts to modify the
CLASSPATH.

Look inside of Tomcat's startup.bat (I'm assuming 
this is Windows). Somewhere in there you will
see a lot of code that configures the
CLASSPATH. Just make sure that Tomcat's
older jaxp.jar and parser.jar appear
AFTER any newer XML parsers and XSLT processors
that you intend to use.

Another option is to move up to Tomcat 4.0.
They have really cleaned up the CLASSPATH
problems, although you will still have to
get in there and provide updated JAR files
in Tomcat's "lib" directory --- Tomcat 4.0
still ships with an older XML parser. I
believe you can just replace their version
with a newer one.

I'm at a client site so I can't look at
my files right now, otherwise I could
provide more details. I hope this helps.

- Eric


--- Steven Smith <ssmith at neonsys.com> wrote:
> What's the classpath look like for this servlet?
> 
> -----Original Message-----
> From: JStalnecker at idssinfo.com
> [mailto:JStalnecker at idssinfo.com]
> Sent: Thursday, March 08, 2001 10:39 AM
> To: jdom-interest at jdom.org
> Subject: [jdom-interest] Sealing violation
> 
> 
> I have just come across the jdom product thru an
> article on www.onjava.com
> at
>
http://www.onjava.com/pub/a/onjava/2000/12/15/xslt_servlets.html.
>  I
> have made some changes the servlet and class.  I am
> also using my own XSL.
> When I run my servlet(code below) I get the
> following error:
> 
> java.lang.ClassNotFoundException: class JDomServlet2
> :
> java.lang.SecurityException: sealing violation
>            at
> java.beans.Beans.instantiate(Beans.java:215)
>            at
> java.beans.Beans.instantiate(Beans.java:55)
>            at
>
com.caucho.server.http.Application.loadServlet(Application.java:1244)
>            at
>
com.caucho.server.http.Invocation.getServlet(Invocation.java:292)
>            at
>
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:409)
>            at
>
com.caucho.server.http.AbstractRequest.service(AbstractRequest.java:393)
>            at
>
com.caucho.server.http.PageCache$Entry.service(PageCache.java:252)
>            at
>
com.caucho.server.http.PageCache.service(PageCache.java:103)
>            at
>
com.caucho.server.http.VirtualHost.service(VirtualHost.java:395)
>            at
>
com.caucho.server.http.Request.dispatch(Request.java:211)
>            at
>
com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:201)
>            at
>
com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java,
> Compiled Code)
>            at
>
com.caucho.server.TcpConnection.run(TcpConnection.java,
> Compiled Code)
>            at java.lang.Thread.run(Thread.java:479)
> 
> 
> import java.io.*;
> import javax.servlet.*;
> import javax.servlet.http.*;
> import org.apache.xalan.xslt.*;
> import org.jdom.*;
> import org.jdom.input.*;
> import org.jdom.output.*;
> 
> public class JDomServlet2 extends HttpServlet {
>     // reuse the same processor over and over
>     private XSLTProcessor processor =
> XSLTProcessorFactory.getProcessor(
>             new
> org.apache.xalan.xpath.xdom.XercesLiaison());
> 
>           ServletContext context = null;
> 
>     // initialize the Servlet.  This code is
> executed once.
>     public void init(ServletConfig config) throws
> ServletException {
>         super.init(config);
> 
>        context = config.getServletContext();
> 
> 
>     }
> 
>     // handle a single request from the client
>     public void doGet(HttpServletRequest request,
>             HttpServletResponse response) throws
> IOException,
>             ServletException {
>         try {
>                     HttpSession session =
> request.getSession(true);
>                String xsltURL =
> request.getParameter("xsltURL");
>                     // read the XSLT stylesheet and
> cache it for future
> reuse
>             InputStream xsltStream =
> context.getResourceAsStream(xsltURL);
>             StylesheetRoot parsedStylesheet =
> processor.processStylesheet(
>                     new
> XSLTInputSource(xsltStream));
>            
> processor.setStylesheet(parsedStylesheet);
> 
>             response.setContentType("text/html");
> 
>             // in a real app, the CreditInfo object
> would be retrieved
>             // from an EJB component
>                     CustomerInfo ci = new
> CustomerInfo("100014", "123 Main
> Street", "Suite 12345",
>                     "This is the third address
> line", "Reading", "PA",
> "19607");
> 
> 
>             // convert the JDOM into DOM
>             Document jdomDoc = ci.getDocument();
>             org.w3c.dom.Document domDoc =
>                     new
> DOMOutputter().output(jdomDoc);
> 
>             // transform the XML into HTML
>             processor.process(new
> XSLTInputSource(domDoc),
>                               null,  // use
> pre-compiled stylesheet
>                               new
> XSLTResultTarget(response.getWriter()));
>         } catch (Exception ex) {
>             ex.printStackTrace();
>         }
>     }
> }
> 
> import java.io.*;
> import org.jdom.*;
> import org.jdom.output.*;
> import com.sun.java.util.collections.*;
> 
> /**
>  * Example of an object that knows how to represent
> itself as
>  * XML using JDOM.
>  *
>  * @author Eric M. Burke
>  */
> public class CustomerInfo implements Serializable {
>     private String number;
>     private String address1;
>     private String address2;
>     private String address3;
>      private String city;
>      private String state;
>      private String zip;
> 
>     // transient fields are not serialized.  This
> prevents the potential
>     // overhead of sending too much data between an
> EJB and the web tier
>     private transient Document doc = null;
>     private transient Element elem = null;
> 
>     /**
>      * Construct a new data object.
>      */
>     public CustomerInfo(String number, String
> address1, String address2,
>             String address3, String city, String
> state, String zip) {
>         this.number = number;
>         this.address1 = address1;
>         this.address2 = address2;
>         this.address3 = address3;
>           this.city = city;
>           this.state = state;
>           this.zip = zip;
>     }
> 
>     /**
>      * @return the contents of this object as an XML
> document.
>      */
>    public Document getDocument() {
>        if (this.doc == null) {
>            this.doc = new Document(getElement());
>         }
>         return this.doc;
>     }
> 
>     /**
>      * This method makes it possible to easily embed
> the output from
>      * this data object into some other larger XML
> document.
>      *
>      * @return the contents of this object as an
> Element, which is just
>      * the root element without the XML declaration.
>      */
> 
=== message truncated ===


=====
Eric M. Burke
Principal Software Engineer, Object Computing, Inc.
314-494-3185 (mobile)
636-978-3268 (home)
burke_e at ociweb.com

__________________________________________________
Do You Yahoo!?
Get email at your own domain with Yahoo! Mail. 
http://personal.mail.yahoo.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://jdom.org/pipermail/jdom-interest/attachments/20010308/89d9344c/attachment.htm


More information about the jdom-interest mailing list