• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Servlet unable to connect to mySQL database

 
Greenhorn
Posts: 3
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

I have created a simple web app designed to provide Java flash cards for my study. The cards are stored in a mySQL database. This web app works great when run locally through Eclipse, as well as on Jelastic. I decided to try and deploy it on my Raspberry Pi and I've run into a problem. Everything works except I can't get the database connection going. The odd thing is that if I run the app from within Eclipse and reference the DB on the Pi, it works!
I have placed the two required JARs (JDBC Connection and JSON) in every possible location Google suggests on the Pi, but to no avail.
The only error I can find while running everything on the Pi is a 500 error each time the JSP requests a flash card's data from the servlet.

I'm new to setting up Apache/Tomcat, so I'm having trouble figuring out where I can see logs that might show a stack trace similar to what I am accustomed to in Eclipse.

For the record, phpMyAdmin accesses the DB fine from the Pi as well.

Any suggestions would be greatly appreciated.
 
Rancher
Posts: 989
9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Were you able to get it working locally on Tomcat? The tomcat logs should be easy to find once you find the tomcat base folder.
 
Chad Hunt
Greenhorn
Posts: 3
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Locally (on the Raspberry Pi), I can access the database via phpMyAdmin as well as through mySQL command line. Don't know if it's useful, but i have a separate PHP script that also has no issue using the database.

So far, the only logs that I have found are in, if I remember correctly, /var/lib/tomcat7/logs/ They are: catalina.out, catalina.2013-07-*.log, and a couple relating to localhost. (I'm not at my home right now to get the exact names) Catalina out shows no errors. The only error shows up in one of the localhost logs when my JSP sends a POST request for database data (error 500). This is done using AJAX, and the response from the servlet comes back as a JSON object.
 
Chad Hunt
Greenhorn
Posts: 3
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In case anyone stumbles across this, I managed to solve my own problem after many days of troubleshooting. My code was written and compiled on my Mac using Java 1.7 where everything worked fine. My Raspberry Pi, however, was only running Tomcat 6. After updating to Tomcat 7, all worked as it should. Ultimately, a simple 'duh' solution.

Hope this helps someone in the future.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic