LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-19-2006, 11:23 PM   #1
dickgregory
Member
 
Registered: Oct 2002
Location: Houston
Distribution: Arch, PCLinuxOS, Mint
Posts: 257

Rep: Reputation: 34
Can't locate ejb via jndi - Please help


First the vitals:

Mandrive Linux 2006
1GB memory
J2SE 1.5
J2EE / SJSAS 1.4.2

The bean (Bean1) was deployed by Netbeans and shows up on SJSAS console.

The code:

try {
Context initial = new InitialContext();
Context myEnv = (Context)initial.lookup("java:comp/env");
Object obj = myEnv.lookup("ejb/Bean1");
HelloRemoteHome home = (HelloRemoteHome) javax.rmi.PortableRemoteObject.narrow(obj, HelloRemoteHome.class);
HelloRemote hello = home.create();
Heading.setText(hello.Hello());
hello.remove();
}
catch (javax.naming.NameNotFoundException ex) {
Error1.setText("Could not locate context");
Error2.setText(ex.getMessage());
}
catch (Exception ex) {
Error1.setText("System error locating bean");
Error2.setText(ex.getMessage());
}

The error messages are "Could not locate context"
and "No object bound for java:comp/env"

So it is apparent that it only got to the second line with the try block. The code up to that point is identical to that in the Sun tutorial. I have tried 3 different tutorials and all give similar results from slightly different code variations.

I am running this on localhost. Is there something I am supposed to do to point it to the server machine? None of the turorials are very clear about how to do this.

I'm new to J2EE, but not new to Java. If someone can point me in the right direction I would really appreciate it.
 
Old 02-21-2006, 05:31 PM   #2
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
I never read a lot about Java Entreprise Edition but i think you can configure jndi properties. Your initialContext is a kind of hashmap, and there must be a property you can set like.
initialContext.put("jndi.host", "http://hostnameLikeLocalHost:tcpPortNumber/service");

Try reading a lit bit more on j2ee and ejb in general.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to "publish" a RemoteObject with JNDI? eantoranz Programming 0 04-21-2005 12:54 PM
EJB: Problem with concurrent calls to EJBs (according to JBoss) eantoranz Programming 0 03-14-2005 11:10 AM
EJB: Problem when creating entity beans eantoranz Programming 1 03-08-2005 08:58 AM
Can't locate locate hindenbergbaby Linux - Newbie 3 10-22-2003 04:13 PM
how to locate ? jamaso Linux - General 4 10-17-2002 03:45 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration