This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I m trying to connect to datasource from my standalone program to JBOSS. But I m getting the below error:
javax.naming.NameNotFoundException: commsDSLocal not bound
my standalone program is:
I have configured commDSLocal in -ds.xml file in JBOSS and started the JBOSS server but still I m getting this issue.
First, you need to turn off use-java-context in the *-ds.xml file, and then you need to drop "java:" from the name you arel ooking up. The java: context is valid only for apps running within JBoss AS itself.
Check the jars that you are using. If the JBOSS client jars are from a different version of JBOSS server this type of error comes. I had encountered similar error when my JBOSS server was 5.0.1 and my client jars from 5.1.0
I have checked the jars and they are of same version only.
How did you check that? How exactly are you setting the classpath of the client application? What jars does it contain? Does it point to JBOSS_HOME/client/jbossall-client.jar? Post the command you use to set the classpath.
I am a newbie in the whole java distributed world, so please bear with my ignorance. I had the exact same problem mentioned above (ClassCastException) and I was literrally scouring the web for the last 8 hours for a solution. Dozens of blogs say the same thing, that it has to do with the libraries in your path, but do not say exactly what libraries. Plus most of them are from old Jboss 5.0. I had this problem with Jboss 6 which deals with whole different set of libraries. So I had to do lot of trial and error. Just keep adding missing Jars (aout 20 of them) one at a time and removing ones that caused conflict and see if it hits. Finally after wasting many hours some random combination of libraries did hit which made me happy, but also sad. Here's why.. Are problems in distributed java just like this?, obscure and without much documented or logical approach? I mean, where in Jboss documentation is it mentioned that to do a remote call to jboss you need x, y and z jars and why are those needed ? Is it all just hit, miss and google? Is that how people solve problems in java? I am getting a bit demotivated by this. Would love to hear from veterans on this.
In ages past (oh, a year ago or so) the typical remote client would include client/jboss-all.jar in the classpath. That usually covered everything that the client needed. In 4.2.x and earlier, tat JAR contained all the classes; starting with 5.0.0 that JAR contained no classes and instead referenced the other JAR files in the client directory.
But including all those classes all the time was not always a good idea, especially if you are trying to trim down the amount of space your client takes. Nowadays, JBoss Tattletale can be used to determine the JAR file dependencies so that you will know exactly which JAR files need to be included in your client. Tatttletale beats the old "run it until it complains about a missing class and then hunt up its JAR file" strategy.