JBoss standalone program does not use Classpath - why?

I am using JBoss 6.1.0 on RHEL to exchange messages from a JMS queue between 2 separate Java programs (sender and receiver).

The software works when I include all the necessary Jboss library jar files and properties files in my own Java application JAR file.

But when I pull out the Jboss jar files from my own application jar file, I get the java.lang.NoClassDefFoundError exceptions where the system complains about not finding the Jboss jar library files, even when I run the application using a Classpath argument:

java -cp /opt/jboss/client/*.jar:/opt/jboss/lib/*.jar:/opt/jboss/common/*.jar:/opt/jboss/comm-lang.jar:/jboss/server/default/deploy/*.jar -jar MyJossApplication.jar

The exception points back to a Class file to a JBoss library jar file that is included in the Classpath.

Any idea why my invocation method of Jboss is ignoring the Classpath?  Thanks.
rleelinkAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

for_yanCommented:
With -cp you need to mention all jars' explicitlly - you cannot say *.jat
0
for_yanCommented:

With -cp you need to mention all jars' explicitlly - you cannot say *.jar
0
for_yanCommented:
In Java ^ there is a way to refer to the whole folder of jars, let me see
0
The Lifecycle Approach to Managing Security Policy

Managing application connectivity and security policies can be achieved more effectively when following a framework that automates repeatable processes and ensures that the right activities are performed in the right order.

for_yanCommented:

In Java 6 there is a way to refer to the whole folder of jars, let me see
0
for_yanCommented:
java -Djava.ext.dirs=jarDirectory
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
for_yanCommented:
with omething like that in Java 6:

 -Djava.ext.dirs=/opt/jboss/client:/opt/jboss/lib:/opt/jboss/common

it shoudl pick up all jars in the folders.

0
CEHJCommented:
You need to prevent shell globbing through expansion
java -cp '/opt/jboss/client/*.jar:/opt/jboss/lib/*.jar:/opt/jboss/common/*.jar:/opt/jboss/comm-lang.jar:/jboss/server/default/deploy/*.jar' -jar MyJossApplication.jar

Open in new window

0
gordon_vt02Commented:
With JDK 6 and later, you can also just specify /some/dir/with/jars/* to load all JAR and ZIP files in that directory into the classpath.  Try:

java -cp /opt/jboss/client/*:/opt/jboss/lib/*:/opt/jboss/common/*:/opt/jboss/comm-lang.jar:/jboss/server/default/deploy/* -jar MyJossApplication.jar

Open in new window

0
gordon_vt02Commented:
More clarification on the wildcarding can be found here:

http://download.oracle.com/javase/6/docs/technotes/tools/windows/classpath.html

About 2/3 down the page.
0
CEHJCommented:
Gordon, the point is that the shell will get to that glob before java and that will confuse the issue. The (SINGLE) quoting is to prevent that happening
0
gordon_vt02Commented:
With or without the quotes, the cp should be specified without the '.jar', so the correct command line should be a combination of our responses:

java -cp '/opt/jboss/client/*:/opt/jboss/lib/*:/opt/jboss/common/*:/opt/jboss/comm-lang.jar:/jboss/server/default/deploy/*' -jar MyJossApplication.jar

Open in new window

0
CEHJCommented:
Actually it works fine for me with *.jar
0
CEHJCommented:
rleelink, I'm not sure why you saw fit to ignore my and Gordon't comments. Bear in mind the accepted answer will knock out any other ext jars
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.