Results 1 to 4 of 4

Thread: XmlUtils class

  1. #1
    liez is offline Member
    Join Date
    Nov 2015
    Location
    Algeria
    Posts
    2
    Rep Power
    0

    Question XmlUtils class

    Hi,
    i'm creating a webMethod that must return table from my bd and i'm using XmlUtils class but when i test my webService i got errors, i'm totally novice in webServices i don't know were is the problem, here is my code :

    Java Code:
    @WebMethod(operationName = "affT")
        public String affT(@WebParam(name = "nmT") String nmT) throws IOException {
            String html=null;
            try
            {
                Class.forName( "com.mysql.jdbc.Driver" );
                conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/TP1","root","");
                pst=conn.createStatement();
                    rs=pst.executeQuery("select *  from '"+nmT+"'");
                    html = net.proteanit.sql.XmlUtils.resultSetToXml(rs);
            }
            catch(Exception e)
            {
                System.out.println(" Echec !");
                e.printStackTrace();
            }
            return html;
        }
        }
    XmlUtils class-er.png
    could you help me please ? Thank you

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: XmlUtils class

    Look at the statement where the exception happened, find the variable with the null value and then backtrack in the code to see why the variable doesn't have a valid value.

    Note: It's not possible to copy text from an image so I can't copy the line number of the error.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    liez is offline Member
    Join Date
    Nov 2015
    Location
    Algeria
    Posts
    2
    Rep Power
    0

    Default Re: XmlUtils class

    Thank you for replying ,

    i can't find the variable with null value, or maybe i'm looking for it in a wrong place, i was looking here :

    Exceptions details : java.lang.NullPointerException

    javax.servlet.ServletException: java.lang.NullPointerException at org.glassfish.webservices.monitoring.WebServiceTes terServlet.doPost(WebServiceTesterServlet.java:342 ) at org.glassfish.webservices.monitoring.WebServiceTes terServlet.invoke(WebServiceTesterServlet.java:106 ) at org.glassfish.webservices.EjbWebServiceServlet.ser vice(EjbWebServiceServlet.java:143) at javax.servlet.http.HttpServlet.service(HttpServlet .java:790) at org.glassfish.grizzly.servlet.ServletHandler.doSer vletService(ServletHandler.java:223) at org.glassfish.grizzly.servlet.ServletHandler.servi ce(ServletHandler.java:174) at com.sun.enterprise.v3.services.impl.ContainerMappe r$HttpHandlerCallable.call(ContainerMapper.java:45 9) at com.sun.enterprise.v3.services.impl.ContainerMappe r.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runS ervice(HttpHandler.java:201) at org.glassfish.grizzly.http.server.HttpHandler.doHa ndle(HttpHandler.java:175) at org.glassfish.grizzly.http.server.HttpServerFilter .handleRead(HttpServerFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver $9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterCha in.executeFilter(DefaultFilterChain.java:284) at org.glassfish.grizzly.filterchain.DefaultFilterCha in.executeChainPart(DefaultFilterChain.java:201) at org.glassfish.grizzly.filterchain.DefaultFilterCha in.execute(DefaultFilterChain.java:133) at org.glassfish.grizzly.filterchain.DefaultFilterCha in.process(DefaultFilterChain.java:112) at org.glassfish.grizzly.ProcessorExecutor.execute(Pr ocessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTranspor t.fireIOEvent(TCPNIOTransport.java:561) at org.glassfish.grizzly.strategies.AbstractIOStrateg y.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStr ategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStr ategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStr ategy$WorkerThreadRunnable.run(WorkerThreadIOStrat egy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPoo l$Worker.doWork(AbstractThreadPool.java:565) at org.glassfish.grizzly.threadpool.AbstractThreadPoo l$Worker.run(AbstractThreadPool.java:545) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.NullPointerException at org.glassfish.webservices.monitoring.WebServiceTes terServlet.doPost(WebServiceTesterServlet.java:313 ) ... 24 more

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: XmlUtils class

    i was looking here
    Sorry, you seemed to have left off the line number.

    The error message has lost its line end characters making it hard to easily scan, The message should look like this for easier scanning:

    javax.servlet.ServletException: java.lang.NullPointerException
    at org.glassfish.webservices.monitoring.WebServiceTes terServlet.doPost(WebServiceTesterServlet.java:342 )
    at org.glassfish.webservices.monitoring.WebServiceTes terServlet.invoke(WebServiceTesterServlet.java:106 )
    at org.glassfish.webservices.EjbWebServiceServlet.ser vice(EjbWebServiceServlet.java:143)
    at javax.servlet.http.HttpServlet.service(HttpServlet .java:790)
    at org.glassfish.grizzly.servlet.ServletHandler.doSer vletService(ServletHandler.java:223)
    at org.glassfish.grizzly.servlet.ServletHandler.servi ce(ServletHandler.java:174)
    at com.sun.enterprise.v3.services.impl.ContainerMappe r$HttpHandlerCallable.call(ContainerMapper.java:45 ]
    .....
    Somewhere in that list of locations should be a reference to a line in your program. Start at the top of the error messages and search downwards to a reference to a line in your code.

    Also where is the output from this statement in the catch block
    Java Code:
      System.out.println(" Echec !");
    Last edited by Norm; 11-07-2015 at 01:48 PM.
    If you don't understand my response, don't ignore it, ask a question.

Similar Threads

  1. Replies: 3
    Last Post: 12-08-2013, 09:28 PM
  2. Replies: 1
    Last Post: 12-13-2012, 03:06 AM
  3. Replies: 0
    Last Post: 12-07-2011, 11:55 AM
  4. Replies: 0
    Last Post: 03-27-2011, 05:49 AM
  5. Replies: 5
    Last Post: 01-26-2011, 06:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •