> > > > > I get a java.lang.NullPointerException when i do this ?
>
[quoted text clipped - 31 lines]
> Add somewhere:
> parser = DocumentBuilderFactory().newInstance().newDocumentBuilder()
import javax.xml.parsers.*;
DocumentBuilder parser = null;
parser = DocumentBuilderFactory().newInstance().newDocumentBuilder();
I am sorry i must misunderstand something because the compiler doesn't
like it telling me it cant find the symbols.
Lew - 24 Sep 2007 13:53 GMT
Daniel Pitts wrote:
>> Add somewhere:
>> parser = DocumentBuilderFactory().newInstance().newDocumentBuilder()
> import javax.xml.parsers.*;
>
[quoted text clipped - 3 lines]
> I am sorry i must misunderstand something because the compiler doesn't
> like it telling me it cant find the symbols.
It's time for you to provide an "SSCCE" - a Simple, Self-Contained Complete
Example. That is, a complete, simplified example that yields the error of
interest. Complete. Simplified. Complete.
We need /actual/ code and /actual/ compiler messages. Note that it is not
possible that "the compiler doesn't like it"; compilers don't have emotions.
We are unable to diagnose your issue or assist you given only anthropomorphic
approximations to the evidence.
Java note:
>> DocumentBuilder parser = null;
>> parser = DocumentBuilderFactory().newInstance().newDocumentBuilder();
Just use
DocumentBuilder parser =
DocumentBuilderFactory().newInstance().newDocumentBuilder();
Why initialize the variable twice?
Also, in English the word "I" is always capitalized, and use punctuation to
avoid ambiguity. "[T]he compiler doesn't like it telling me..." means, "the
compiler doesn't like [some previously mentioned thing] to tell me ...",
whereas I suspect you intended, "The compiler doesn't like it, telling me ...".
Programming is an art of precision.

Signature
Lew
--
Lew
Andrew Thompson - 24 Sep 2007 14:11 GMT
>> > > > > I get a java.lang.NullPointerException when i do this ?
...
>> Add somewhere:
>> parser = DocumentBuilderFactory().newInstance().newDocumentBuilder()
..
>parser = DocumentBuilderFactory().newInstance().newDocumentBuilder();
"I think what Mr. Pitts* meant to say was.."
parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
However, when code is breaking, it is best to break it
down to the simnplest units possible. For that reason,
I would change that single line to.
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();
System.out.println("factory: " + factory);
parser = factory.newDocumentBuilder();
System.out.println("parser: " + parser);
...
>I am sorry i must misunderstand something because the compiler doesn't
>like it telling me it cant find the symbols.
It would be mighty useful to you if you figure how
to read those exceptions, and always copy/paste
any you do not understand.
But ultimately, I agree with Lew's suggestion of
preparing an SSCCE. You will get more help
from an SSCCE short enough to post to the
group, than either posting code snippets, or
linking to a 'problemsource.zip'.
* Said in the tone of a spokesperson/spin doctor,
rather than anyone's mum.

Signature
Andrew Thompson
http://www.athompson.info/andrew/
Daniel Pitts - 24 Sep 2007 15:02 GMT
> > > > > > I get a java.lang.NullPointerException when i do this ?
>
[quoted text clipped - 39 lines]
> I am sorry i must misunderstand something because the compiler doesn't
> like it telling me it cant find the symbols.
I'm sorry, I had a typo. I added a spurious "()"
Try this: DocumentBuilderFactory.newInstance().newDocumentBuilder()
Also, try using you own discretion when copying peoples examples. You
aren't going to be successful as a programmer unless you can figure
things out on your own.
Andrew Thompson - 24 Sep 2007 15:43 GMT
..
>..try using you own discretion when copying peoples examples. You
>aren't going to be successful as a programmer unless you can figure
>things out on your own.
Wadd'ya' mean 'batteries not included'?!
(bawls) I want my money bac...(..oh)

Signature
Andrew Thompson
http://www.athompson.info/andrew/
gert - 25 Sep 2007 00:50 GMT
It works thanks all :)
As suggested to name my class Query instead of query I get this?
"javax.servlet.ServletException: PWC1397: Wrapper cannot find servlet
class Query or a class it depends on"
When I rename it back to query it works fine?
What config file do I need to change?
I changed this in web.xml
"<servlet-class>Query</servlet-class>"
and this in my servlet
"public class Query extends HttpServlet"
What els am I forgetting?
Andrew Thompson - 25 Sep 2007 01:05 GMT
> As suggested to name my class Query instead of query I get this?
>
> "javax.servlet.ServletException: PWC1397: Wrapper cannot find servlet
> class Query or a class it depends on"
...
> What els am I forgetting?
Try refreshing/restarting the server.
Andrew T.
gert - 25 Sep 2007 01:47 GMT
> > As suggested to name my class Query instead of query I get this?
>
[quoted text clipped - 6 lines]
>
> Andrew T.
Yep that seems to do it thanks :)
PS Can you make a webservice (wsdl) run as a servlet example.com/
some_soap_service ?
Andrew Thompson - 25 Sep 2007 02:45 GMT
...
> PS Can you make a webservice (wsdl) run as a servlet example.com/
> some_soap_service ?
Not sure. You might be better asking that
question on a new thread with more specific*
subject line.
* More specific to your latest question.
Lew - 25 Sep 2007 03:36 GMT
> ....
>> PS [sic] Can you make a webservice [sic] (wsdl [sic]) run as a servlet example.com/
[quoted text clipped - 5 lines]
>
> * More specific to your latest question.
A web service is not the same thing as a WSDL specification. The common way
to run a web service in the Java universe is via a servlet, yes.

Signature
Lew