7 Replies Latest reply on Jan 4, 2003 5:01 PM by 843834

    Where shall i save the dom.jar file in WSDP

    843834
      Hi

      I need to create a xml fil using dom parser.

      I want to know where do i have to save the dom.jar file

      in WSDP.

      I have save my java class in

      C:\WORK\jwsdp-1_0\webapps\ROOT\WEB-INF\classes

      Directory


      IS that Just adding the jar file is enough to enviourment variable?

      My os is windows2000

      Thanks for your advice and happy new year
        • 1. Re: Where shall i save the dom.jar file in WSDP
          843834
          Copy it to the directory $JWSDP_HOME/common/lib
          • 2. Re: Where shall i save the dom.jar file in WSDP
            843834
            I copied to common/lib and common/endorsed still giving this error when i go to directory and try to compile.

            I save my java class jwsdp-1_0/webapps/ROOT/WEB-INF/classes



            import org.w3c.dom.*;
            ^
            MetaBuilder.java:4: cannot resolve symbol
            symbol : class DocumentImpl
            location: package dom
            import org.apache.xerces.dom.DocumentImpl;
            ^
            MetaBuilder.java:5: cannot resolve symbol
            symbol : class DOMImplementationImpl
            location: package dom
            import org.apache.xerces.dom.DOMImplementationI
            ^
            MetaBuilder.java:6: cannot resolve symbol
            symbol : class Document
            location: package dom
            import org.w3c.dom.Document;
            ^
            MetaBuilder.java:7: cannot resolve symbol
            symbol : class OutputFormat
            location: package serialize
            import org.apache.xml.serialize.OutputFormat;
            ^
            MetaBuilder.java:8: cannot resolve symbol
            symbol : class Serializer
            location: package serialize
            import org.apache.xml.serialize.Serializer;
            ^
            MetaBuilder.java:9: cannot resolve symbol



            • 3. Re: Where shall i save the dom.jar file in WSDP
              843834
              I think you have problem with the classpath.

              If you want to manually compile your java files, you have to set the variable CLASSPATH to point to those libraries. I'd like to use ant tool to do this job. It's especially helpful when building a large project. Let's take a look into jwsdp examples.

              If you are using some IDE (e.g. JBuilder), then you may add those libs into your project before compiling.
              • 4. Re: Where shall i save the dom.jar file in WSDP
                843834
                I think you have problem with the classpath.

                If you want to manually compile your java files, you have to set the variable CLASSPATH to point to those libraries. I'd like to use ant tool to do this job. It's especially helpful when building a large project. Let's take a look into jwsdp examples.

                If you are using some IDE (e.g. JBuilder), then you may add those libs into your project before compiling.
                • 5. Re: Where shall i save the dom.jar file in WSDP
                  843834
                  When i run a java class which refer jdom and create xml
                  it run sucessfully and create the xml file.JWSDP refer jdom successfully





                  But When i do that using a servlet following exception comes

                  Is that some problem with catelina
                  after installing jwsdp C:\WORK\jwsdp-1_0\common\classes
                  classes folder is empty


                  Is it some problem with catelina?.

                  These are the exception


                  message

                  description The server encountered an internal error () that prevented it from fulfilling this request.What shall i do for this

                  exception

                  javax.servlet.ServletException: Cannot allocate servlet instance for path /servlet/ShowSkeleton
                       at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:420)
                       at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                       at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2349)
                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
                       at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
                       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                       at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
                       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:376)
                       at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
                       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:518)
                       at java.lang.Thread.run(Thread.java:536)


                  root cause

                  java.lang.NoClassDefFoundError: org/jdom/input/DOMBuilder
                       at java.lang.Class.getDeclaredConstructors0(Native Method)
                       at java.lang.Class.privateGetDeclaredConstructors(Class.java:1576)
                       at java.lang.Class.getConstructor0(Class.java:1748)
                       at java.lang.Class.newInstance0(Class.java:266)
                       at java.lang.Class.newInstance(Class.java:249)
                       at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:887)
                       at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:656)
                       at org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:401)
                       at org.apache.catalina.servlets.InvokerServlet.doPost(InvokerServlet.java:216)
                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
                       at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
                       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
                       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
                       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                       at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2349)
                       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
                       at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
                       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:171)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:646)
                       at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:469)
                       at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:644)
                       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:483)
                       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
                       at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
                       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:405)
                       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:376)
                       at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:508)
                       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:518)
                       at java.lang.Thread.run(Thread.java:536)


                  • 6. Re: Where shall i save the dom.jar file in WSDP
                    843834
                    Problem solved problem was that when i run in jbuilder my programm creates and read xml files properly when i try to run in jwsdp it gives exception.There are two implementation of parsers when i use
                    import org.jdom.*;
                    import org.jdom.input.*;
                    import org.jdom.output.*;

                    This works only in jbuilder not in jwsdp.I use the same parser i don't know why when use this implementation my programm works sucessfully

                    import org.w3c.dom.*;
                    import org.apache.xerces.dom.DocumentImpl;
                    import org.apache.xerces.dom.DOMImplementationImpl;
                    import org.w3c.dom.Document;
                    import org.apache.xml.serialize.OutputFormat;
                    import org.apache.xml.serialize.Serializer;
                    import org.apache.xml.serialize.SerializerFactory;
                    import org.apache.xml.serialize.XMLSerializer;


                    Thanks for all the guys who helped me.

                    • 7. Re: Where shall i save the dom.jar file in WSDP
                      843834
                      This helped me you can use the same thing here is the code

                      DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                      doc = documentBuilder.parse(file);

                      Element rootElement = doc.getDocumentElement();
                      NodeList nodeListRules = rootElement.getElementsByTagName("Tagname");
                      for(int i=0;i<nodeListRules.getLength();i++){
                      p2.println(nodeListRules.item(i).getFirstChild().getNodeValue());