Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with JBoss 4.0.3

 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stacktrace is:


And code for getting datasource:

 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ctx.lookup() is returning the datasource object (not null).
I am configuring my datasource using oracle-ds.xml
 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exact code which is throwing exception is:

java.sql.Connection connection = dataSource.getConnection();
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your lookup code should be:



Try it out.
 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
dataSource = (DataSource)ctx.lookup(dataSourceName);

in this, dataSourceName is referring to java:/OracleDS.
But still getting the same error.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tried it, OracleDS is present in Java namespace.
 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can somebody please help on this???
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic