-
1. Re: NullPointerException thrown loading datasource
camtabor Sep 27, 2001 1:43 PM (in response to yduchesne)Looks like you didn't specify the url of your database, is it running on the same machine as jboss?
-
2. Re: NullPointerException thrown loading datasource
yduchesne Sep 27, 2001 2:39 PM (in response to yduchesne)Me again: I solved part of my problem by specifing all the properties for the datasource (the doc says that only a few mandatory properties are required (username, password, etc), that's why I had done so).
But then, the XADataSourceLoader hangs at startup; I get the following output:
[XADataSourceLoader] Starting
[GemstoneDB] XA Connection pool GemstoneDB bound to java:/GemstoneDB
If I set the 'blocking' property to false, I get the NullPointerException again.
It looks like the XADataSourceLoader never calls my driver's getConnection() or acceptsUrl methods - I've placed log output in the methods, which log to a file, but nothing appears.
What are the causes for XADataSourceLoader hang ups? - n.b.: It cannot be because the driver cannot connect to the database, because for now the driver has a dummy behavior; it does not connect to a DB... -
3. Re: NullPointerException thrown loading datasource
kristom Sep 30, 2001 4:10 PM (in response to yduchesne)Hi,
not sure this helps, but I did experience similar symptoms when running JBoss on Linux with mySQL. I have a dual boot system (W2K/Red Hat) that is able to run same JBoss configuration/deployment with both OS'es, mostly for fun and proof of concept. In any case, JBoss and mySQL run on the same node. However, running on Linux was a bit more tricky than W2K.
To cut the story short, I eventually got the Null pointer exception when JAWS made its first attempts to connnect to the database, depending on the Blocking property of the JDBS driver. The difference between using the blocking=true and ditto false was that the binding simply blocked until the locking timed out, then preceeded as before, with the null-pointer and all.
Investigation showed that the JDBC driver tried to log on as "mysql@localhost.localdomain" (yes, the database user was "mysql") Now, in mySQL's user table only "localhost" was mentioned, which means that "localhost.localdomain" wasn't recognized. Adding that particular user combination fixed the problem, and now the same config/deployment runs equally well on Windows 2000 and Linux. Even same data files, as they share common vfat partitions.
This story may not solve the Gemstone problem, but hopefully may help others in distress.
Regards,
Kristoffer Moe,
Senior Consultant
Elan IT ReSource Norway -
4. Re: NullPointerException thrown loading datasource
yduchesne Oct 1, 2001 10:51 AM (in response to yduchesne)I found my problem; my JDBC driver code was missing the following missing static initializer:
static {
java.sql.DriverManager.registerDriver(new JDBCDriver());
}
This static initializer is called when the driver class is first loaded into the system - i.e. Class.forName(...). This is what jboss does when loading the drivers mentioned in the jboss.jcml config file; it does not instantiate the driver per say (as in DriverManager.registerDriver(new MyDriver()), but rather, the driver class is reponsible to register itself with the DriverManager; jboss just calls Class.forName("MyDriver").
As far as the NullPointerException problem goes, it is related to jboss' pooling behavior; When jboss first starts, it tries to fill the pool with initial db connection instances. If connections cannot be found - for any underlying low-level reason), jboss blocks on the to-be-filled connection pool, unless the 'blocking' property is false. If it is false, then a null connection is returned, and therefore the NullPointerException pops up.