• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat app not connecting to server (jdbc)

 
Ranch Hand
Posts: 409
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going to post an error message below and hope that someone can get a good strong hint from it about what the problem is making a jdbc call here. I've spent quite a bit of time on this problem, that uses code and set-ups that have been working very well on the original development computer. I've checked the installation settings several times to insure that they're the same on another computer. I've run tests, repeatedly checked set-ups and installations, turned the firewall off, etc. etc. etc. Right now, it seems to be down to getting a hint from this error message. Can anyone understand it? What's it trying to tell me?

 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All it tells me is that a NullPointerException was thrown at line 73 of the nu.isr.hll.webshop.core.HLListProcess class, in the initialize method. Is that your code? If so, then you should look there. If not, then you should track down the owner and ask them to help you out.
 
Roger F. Gay
Ranch Hand
Posts: 409
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:All it tells me is that a NullPointerException was thrown at line 73 of the nu.isr.hll.webshop.core.HLListProcess class, in the initialize method. Is that your code? If so, then you should look there. If not, then you should track down the owner and ask them to help you out.





Yes, it's my code. The null pointer is the connection I'm trying to make to the database (Connection con). The first two lines are telling me that don't have a connection to the database; using code that works perfectly on the development machine. I've even previously, on the dev machine, successfully adjusted this code to connect to other databases in the LAN. On the problem machine, I've even involved a db administrator in trying various ways of specifying the db in the connection call that isn't working there.

What I'm hoping at this point is that there's more useful info in the error message. Like, does something in the neighborhood of say anything new? I vaguely remember looking at something to do with Valves in one of the Tomcat configuration files while setting up the development machine. This is new to me though. If I did something like that, it would have seemed quite obscure and I was just following a set of instructions. Haven't done anything like that on the problem machine ... although I've tried to compare files in Tomcat's config folder to be sure they're the same.

 
Roger F. Gay
Ranch Hand
Posts: 409
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jdbc driver wasn't loading.

Looks like the problem comes down to a buggy Microsoft jdbc driver. According to the documentation, sqljdbc4 does not require explicit driver registration. Version 4 should do that automatically. Works fine on the Microsoft Vista dev machine. But it didn't work when I installed the app on Windows 7 (They are two different OS here, and I'm guessing that matters.)

Had to include Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

Now it works!

I'm going to add a caveat here. A good reason to use jdbc is that you don't need to rewrite your code to switch database systems. Doing something based on a nonstandard Microsoft feature is a bad idea in the first place. I've been thinking about that for the past hour, wondering why I fell for it.
 
I am going down to the lab. Do NOT let anyone in. Not even this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic