Jump to content

Recommended Posts

Posted

Remote mysql is already set up. The problem is probably on the end of whatever that thing is that is trying to connect to the database. What is the exact error?

Posted

Remote mysql is already set up. The problem is probably on the end of whatever that thing is that is trying to connect to the database. What is the exact error?

Hi. I don't know the exact error. This is what I got:

Type Exception Report

Description The server encountered an unexpected condition that prevented it from fulfilling the request.

Exception

java.lang.NullPointerException
	tulli.jm.dao.UserDAO.findByName(UserDAO.java:20)
	tulli.jm.servlets.LoginServlet.doPost(LoginServlet.java:21)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
Note The full stack trace of the root cause is available in the server logs.

My question is: how can I see the server logs to track the root cause?

 

Thanks for your help!

Posted

You don't need remote mysql then, because the app is local not remote. You only need remote mysql if your script is remote. Like if it was running on your home computer or another server.

 

I don't see any errors in the tomcat logs regarding your app. Try outputting the error message to the browser.

Posted

Awesome!

 

If you have a chance it might be helpful for people in the future who have the same problem if you posted what the problem was and how you fixed it. If not, no big deal. It can just be a mystery and people in the future can figure it out themselves.

Posted (edited)

Sure I can!

The problem was not in the connection itself, but how I was connecting.

  • Before, I was trying to get the connection in the static initialization block, and then trying to perform a query on the DB. But this wasn't working, and when I try the query I got nullpointer exception, bc the connection was null.
  • Now I just created an method to connect, and I call it before perform the query, checking previously that the connection is not null.

 

Actually I don't really know why this happened, bc using the former way in my localhost (but connecting to remote DB) it worked...

Edited by jmtulli
Guest
This topic is now closed to further replies.
×
×
  • Create New...