Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception from jbossall-client.jar

 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I created a sample Servlet-BMP bean application, where in I'm calling create methods for inserting application. But after deploying my ear file and lauched the application, I'm getting the following error



Even my servlet is not called as the System.out.println statement placed in init method itself not called.

when I clicked on InitialContext.java from the error message, it shows error message as

From this I believe something going wrong with jbossall-client.jar
I'm not very much experienced with jboss. Can some one tell me what would have gone wrong
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can someone help me out
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post the entire exception stacktrace that you see on the server? Where are you calling the create method from?
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi JaiKiran,

I investigated problem. Previously I didn't see the entire log as my IDE didn't show me up the previous thing. So I went to log file generated and found that something went wrong in my ejbCreate() method. I'm further looking into this.
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After further investigation I found that there is something which went wrong with my Datasource bindng.

Before I can go further , I would like to clarify one thing.

My mysql-ds.xml which I copied into deploy folder has the following structure



and my ejb-jar.xml has


and my jboss.xml has


From the stack over flow I can see some thing went wrong while trying to lookup for the datasource.

The error log shows


One more thing which I do not understand here is , why the error is coming from create() method... we haven't completed the construtor of the bean itself. After the error message "Before Create Lookup" I'm trying to lookup the datasource using



I'm totally confused here. Did I do anything wrong with my Datasource or in create method.....
[ March 16, 2008: Message edited by: Schandha Ravi ]
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<resource-ref>
<res-ref-name>jdbc/MySQL</res-ref-name>
<jndi-name>java:/comp/env/jdbc/MySQL</jndi-name>
</resource-ref>


The jndi-name here looks wrong. The jndi-name that you specify in the resource-ref is the actual jndi-name of the resource (in this case the datasource) to which the resource is already bound. This is not the jndi-name by which the client will lookup. So change this to

You dont have to change the lookup code. You will continue using java:/comp/env/jdbc/MySQL jndi-name for the lookup, because this is the res-ref-name that you have specified above (Note that the res-ref-name is prefixed with java:/comp/env).
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks JaiKiran, as you suggested I changed the <jndi-name> in jboss.xml to java:/MySQL and it is working now.

But, I have couple of things which I would like to get clarified.

1) When we use ejb-jar.xml and jboss.xml, we are try to achieve a level of indirection, so that when our ear is deployed in some other ApplicationServer, we need not change our code. So in this process, we map the name <res-ref-name> of ejb-jar.xml to <res-ref-name> of jboss.xml. Is my understanding correct ?

2) Is there any mapping beween the <jndi-name> of mysql-ds.xml and jboss.xml
in mysql-ds.xml, I mentioned <jndi-name> as MySQL and
in jboss.xml, I mentioned <jndi-name> as java:/MySQL.

How can container map between these two values.

Thanks in advance.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Schandha Ravi:

1) When we use ejb-jar.xml and jboss.xml, we are try to achieve a level of indirection, so that when our ear is deployed in some other ApplicationServer, we need not change our code. So in this process, we map the name <res-ref-name> of ejb-jar.xml to <res-ref-name> of jboss.xml. Is my understanding correct ?


Yes, that's correct.


Originally posted by Schandha Ravi:
2) Is there any mapping beween the <jndi-name> of mysql-ds.xml and jboss.xml
in mysql-ds.xml, I mentioned <jndi-name> as MySQL and
in jboss.xml, I mentioned <jndi-name> as java:/MySQL.

How can container map between these two values.



Actually, when you specify the jndi-name in the ds.xml file of JBoss, the server *by default* prefixes the java: namespace to the jndi-name and binds it in the java: JNDI namespace. So your datasource is actually available at java:/MySQL and you use this exact name in the jndi-name of the resource-ref element of jboss.xml
 
Schandha Ravi
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jaikiran, for clarifying my doubts .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic