473,605 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Client JNDI lookup (vs. JBoss), ClassNotFoundEx ception

I'm running on Win2000 and JRE 1.4.1....

I've got a small client trying to do get an InitialContext( ) and talk
to the local JBoss server running on same machine (different VM of
course).

When I run the client using the -D parameters to specify the JNDI
properties, it works fine.

Example command line:
-----------------------------
java -cp C:\pathTo\jboss all-client.jar;C:\p athTo\app.jar
-Djava.naming.pr ovider.url=jnp://localhost:1099
-Djava.naming.fa ctory.initial=o rg.jnp.interfac es.NamingContex tFactory
my.app.ClientCl ass
-----------------------------

That works fine. When I use the same command line but remove the -D
JNDI properties, and specify these in a jndi.properties file (by
adding to CLASSPATH), I get a ClassNotFoundEx ception.

Example command line:
-----------------------------
%JAVA_HOME%\bin \java -cp
C:\pathTo\jboss all-client.jar;C:\p athTo\app.jar;C :\pathTo
my.app.ClientCl ass
-----------------------------
(the jndi.properties file is in the C:\pathTo dir, and it IS getting
picked up - that is, ClassLoader.get SystemResources ("jndi.properti es")
picks it up fine).

NOTE THAT THE CLASSPATH IS THE SAME IN BOTH CASES. THE ONLY DIFFERENCE
is that one uses the -D properties and the other does not.

If I screw up the jndi.properties file so it can't be found, I get a
different error (the "please provide JNDI properties" standard error).
So I really think I have JNDI properties, just the JVM is having
ClassLoader issues.

Here's my stack trace for reference:
-----------------------------
Exception in thread "main" javax.naming.No InitialContextE xception:
Cannot instantiate class: org.jnp.interfa ces.NamingConte xtFactory .
Root exception is java.lang.Class NotFoundExcepti on:
org/jnp/interfaces/NamingContextFa ctory
at java.lang.Class .forName0(Nativ e Method)
at java.lang.Class .forName(Unknow n Source)
at com.sun.naming. internal.Versio nHelper12.loadC lass(Unknown Source)
at javax.naming.sp i.NamingManager .getInitialCont ext(Unknown Source)
at javax.naming.In itialContext.ge tDefaultInitCtx (Unknown Source)
at javax.naming.In itialContext.in it(Unknown Source)
at javax.naming.In itialContext.<i nit>(Unknown Source)
at com.g1440.hasp. util.jms.QueueC lient.initComm( QueueClient.jav a:159)
at com.g1440.hasp. util.jms.QueueC lient.init(Queu eClient.java:70 )
at com.g1440.hasp. util.jms.QueueC lient.<init>(Qu eueClient.java: 50)
-----------------------------

I've worked this for a while, and can find nothing useful at JBoss,
Sun or otherwise. Perhaps I'm doing something stupid.

I've tried a bunch of things like:
+ defining my classpath as a SYSTEM env var
+ using different JAR combinations of jbossall-client.jar,
jnp-client.jar, jboss-j2ee.jar, etc. etc.
+ putting the jbossall-client.jar into %JAVA_HOME%\jre \lib\ext
+ placing my jndi.properties next to my .class inside of my JAR, and
various other places (referenced via a CLASSPATH entry pointing to the
directory)
+ specifying ClassPath in my Manifest (desperation only - I'm not
running as java -jar...)
+ reading the contents of my jndi.properties myself and populating
the System.properti es with this (before getting the InitialContext)

At this point it looks like a weird ClassLoader situation.

Anybody see this as well? Thanks -
Jul 17 '05 #1
1 25428
Kent wrote:
I'm running on Win2000 and JRE 1.4.1....

I've got a small client trying to do get an InitialContext( ) and talk
to the local JBoss server running on same machine (different VM of
course).

When I run the client using the -D parameters to specify the JNDI
properties, it works fine.

That works fine. When I use the same command line but remove the -D
JNDI properties, and specify these in a jndi.properties file (by
adding to CLASSPATH), I get a ClassNotFoundEx ception.


Kent,

I'm not sure the problem is, but here's some things to try:

1. Pass the contents of your jndi.properties file to the
InitialContext( Hashtable) constructor and see if that works.
2. Try doing a Class.forName() on the offending class as the first thing
in your app. Try it under both scenarios. Print out the result of
getSystemClassL oader().getReso urce("class/name/here") under both
circumstances.
3. Verify that none of the other jar files in the classpath contain a
jndi.properties file.
4. Verify that a jndi.properties file does not exist in your JRE's
lib/ext directory (or anywhere in your JRE installation).
5. Try running the app from jar with java -jar. Put the jndi.properties
in the jar.

Be sure to let us know what the problem ultimately turned out to be.

HTH,
Ray

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2372
by: Unbreakable | last post by:
I am using the nusoap client and nusoap server without any problem. However, once I change the client to the excel, I am not sure how to call the nusoap server. Especially the nusoap server only generate the a SOAP message as follow instead of a WSDL file. So, my question is 1.) Can I use excel or .Net as a client to call the nusoap server?
0
8593
by: Steffen | last post by:
Hi! I'm trying to access a EntityBean from a servlet via the bean's local home interface. The EJB and the Servlet are together in one .ear file and I'm using JBoss 3.2.3. I think the "<local-jndi-name>" in jboss-web.xml is wrong. But I don't know what to write there. I've searched for examples or other help, but I haven't found anything useful. Thanks for your help in advance!
1
6199
by: slurper | last post by:
i have problems understanding jndi. i'm this far: i deployed the sun application server and i'm working through the examples (Duke bookstore, ...). Sometimes i see code which does a lookup to a JNDI-name like this: Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup("java:comp/env"); DataSource ds = (DataSource) envCtx.lookup("jdbc/BookDB"); con = ds.getConnection();
3
2695
by: Jacky Zhu | last post by:
Hi all, I am having a problem trying to consume a webservice that is developed on ..Net. I can access it without any problem using a .net client, but when I use a java client (based on Axis 1.1), some methods work, some don't. The error message I got is "org.apache.axis.types.URI$MalformedURIException: No scheme found in URI..."
2
1580
by: Hi5 | last post by:
Hi, I am working on a project in access 2000, Whilst I already have a table called client and seems to be related with other tables ,I tried making TBL client as lookup too, I ended up having another table called Client_1,The question is: 1- How it created? 2- this Why is this table in relationships view and not anywhere else? 3- Is it the same table as client? 4-can I remove One of them?
0
1789
by: nuhu jibrin | last post by:
Good day all, Please, i can't compile my ejb classes in JBoss-4.0.5.GA or JBoss-4.0.2 after proper installation (because i can log on to the server via http://localhost:8080/ after using "run.bat" at the jboss bin directory, from windows DOS command-line). IN WINDOWS-XP, I USED THE TWO FOLLOWING COMPILERS DIFFERENTLY AT THE DOS COMMAND-LINE:
1
1030
by: sajithamol | last post by:
What’s the difference between JNDI lookup(), list(), listBindings(), and search()?
0
3264
by: sajithamol | last post by:
I am getting the following error when I am invoke my ejb from webservice method. BTW I am using EJB3.0, jboss-4.0.5, Myeclipse5.5 M2.Please let me know what might be the issue javax.naming.CommunicationException at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:728) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) at javax.naming.InitialContext.lookup(InitialContext.java:351) ...
9
2651
dmjpro
by: dmjpro | last post by:
I thought that when the connection gets closed then all resources get closed . I also included the ResultSet and Statement ;) . But if the Statement closed then only ResultSet closed. But now i got the point ..after closing Connection i am still able to access to iterate the ResultSet . Actually it is tested only with Postgres. Is it sun specified : ? Now i tested another code ... import...
0
7934
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8424
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8286
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6742
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3912
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3958
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2438
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1537
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.