aspose file tools*
The moose likes JBoss/WildFly and the fly likes Exception from jbossall-client.jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Exception from jbossall-client.jar" Watch "Exception from jbossall-client.jar" New topic
Author

Exception from jbossall-client.jar

Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
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


Thanks & Regards, SK
SCJP 5.0, DB2 - 800, DB2 - 803, SCDJWS (On the way)
Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
can someone help me out
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9329
    
110

Can you post the entire exception stacktrace that you see on the server? Where are you calling the create method from?


[My Blog] [JavaRanch Journal]
Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
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

Joined: Oct 20, 2007
Posts: 167
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

Joined: Jul 20, 2005
Posts: 9329
    
110

<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

Joined: Oct 20, 2007
Posts: 167
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

Joined: Jul 20, 2005
Posts: 9329
    
110

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

Joined: Oct 20, 2007
Posts: 167
Thanks Jaikiran, for clarifying my doubts .
 
wood burning stoves
 
subject: Exception from jbossall-client.jar
 
Similar Threads
Strange JBoss start behaviour
EJB3 Null Pointer Exception
DeploymentException: Error cant find datasource:
invoking EJB via Http call using Jboss
mssqlds not bound and throws NameNotFoundException