aspose file tools*
The moose likes JBoss/WildFly and the fly likes Problem with JBoss 4.0.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Problem with JBoss 4.0.3" Watch "Problem with JBoss 4.0.3" New topic
Author

Problem with JBoss 4.0.3

Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
Hi All,
I am trying to deploy an application on JBoss 4.0.3. but it is throwing NullPointerException from below mentioned try block:

try {
java.sql.Connection connection = dataSource.getConnection();
java.sql.Statement statement = connection.createStatement();
connection.close();
statement.close();
}

But when we tried to deploy the same application on JBoss 4.0.2, it worked properly.

Can anybody help on why is it happening? It will be highly appreciated.

Thanks in Advance.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

Post the exception stacktrace and also the code where you initializing the datasource variable.(Remember to use the 'Code' button to wrap your code and stacktrace while posting)


[My Blog] [JavaRanch Journal]
Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
Stacktrace is:


And code for getting datasource:

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

What does return? Is it null? How have you deployed your datasource? Using a *.-ds.xml? If yes then post the contents of your datasource configuration. Also, what is the value of datasource jndiname that you are doing a lookup on?

at com.zsf.struts.plugin.ApplicationInitPlugin.testDataSource

The NullpointerException is occuring in this piece of code. What's the exact statement in the code which is leading to this exception?
Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
ctx.lookup() is returning the datasource object (not null).
I am configuring my datasource using oracle-ds.xml
Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
The exact code which is throwing exception is:

java.sql.Connection connection = dataSource.getConnection();
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

Your lookup code should be:



Try it out.
Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
dataSource = (DataSource)ctx.lookup(dataSourceName);

in this, dataSourceName is referring to java:/OracleDS.
But still getting the same error.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10102
    
165

To make sure that your OracleDS datasource is deployed and bound to java:/OracleDS, do the following:

- Go to http://localhost:8080/jmx-console
- You will find service=JNDIView
- Click on it
- On the page that comes up, click on the Invoke button next to the 'list' method
- The next page that comes up will display the jndi names and the corresponding objects bound to the JNDI
- In the java namespace see if your OracleDS is present.
- If you are not able to decipher the contents of the JNDI tree, post the output here.
Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
Tried it, OracleDS is present in Java namespace.
Kshitija Ambulgekar
Greenhorn

Joined: Aug 27, 2006
Posts: 24
Can somebody please help on this???
 
 
subject: Problem with JBoss 4.0.3