Forums Register Login

java.lang.nullpointerexception

+Pie Number of slices to send: Send
I am a beginner in java programming. I am trying to read response from url and insert it into database. I ran my program which is posted below and it came back with this error:




I have been trying to solve this issue on my own through research, but I could not solve it. I was wondering if anyone can help me. If you do need any other information about my program, please just ask. Thanks in advance!

here is the code i have written

1
+Pie Number of slices to send: Send
In future, while posting code, please UseCodeTags
I have added them this time for you. As you can see the tags make the code much more easier to read and understand
+Pie Number of slices to send: Send
The stack trace is telling you what is gone wrong


JavaApplication Line 41 is

So the variable "input" is null.
+Pie Number of slices to send: Send
At this point in the code:

the static variable input is null. When passed to the parseResponseString method, the NullPointerException is thrown on the line:

because input is null.

From looking at the whole class, I think you think you are setting the input variable here:

But you are not as you had declared a local variable called input on line 5 of the snippet above. This is used and then discarded once this method completes.
+Pie Number of slices to send: Send
thanks a lot it helped but now i am getting new errors,sorry but i really am new to java please help

java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at javaapp.JavaApplication1.insertToDatabase(JavaApplication1.java:61)
at javaapp.JavaApplication1.main(JavaApplication1.java:78)
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor

at oracle.net.ns.NSProtocol.connect(NSProtocol.java:386)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
... 8 more
+Pie Number of slices to send: Send
Do you have Oracle installed correctly on the same machine?

If so, go to the command line and type the following:

tnsping xe

What output do you get?
+Pie Number of slices to send: Send


The world's cheapest jedi mind trick: "Aw c'mon, why not read this tiny ad?"
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1142 times.
Similar Threads
scanning the webpage
reading url response and writing it to database
Help wanted to put correct Loop type....
Connection in servlets
HttpURLConnection or URLConnection to login in to sites
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 03:40:14.