Solved

Simple Client(standalone) trying to access a Remote EJB on weblogic

Posted on 2007-03-29
9
1,556 Views
Last Modified: 2013-11-24
I have a remote client on the machine say       
iiop://some.thing.company.com:1004

and say the JNDI name is  SomeHome.JNDI_NAME


How do I access this EJB ..I am getting a NamingException with this
*************************

Context initialContext = new InitialContext();
Object ref = initialContext.lookup("SomeHome.JNDI_NAME");
                        
SomeHome = (SomeHome) PortableRemoteObject.narrow(ref,SomeHome.class)
0
Comment
Question by:micro_learner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18818383
Have you set up the initial context environment properties?

Hashtable env = new Hashtable () ;
env.put ( Context.INITIAL_CONTEXT_FACTORY, "class name of your  app server's initial context factory" ) ;
env.put ( Context.PROVIDER_URL, "iiop://some.thing.company.com:1004" ) ;
Context initialContext = new InitialContext ( env ) ;
0
 

Author Comment

by:micro_learner
ID: 18818593

Thanks for your time.
>>>env.put ( Context.INITIAL_CONTEXT_FACTORY, "class name of your  app server's initial context factory" ) ;

by the above you mean the remote weblogic factory right ?
0
 

Author Comment

by:micro_learner
ID: 18818636
Do I need to be on an App server to access a remote EJB call ?.Cant I have a standalone client accessing a EJB on a weblogic server.

I am trying to fire a standalone client to the EJB
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 30

Expert Comment

by:Mayank S
ID: 18819081
>> by the above you mean the remote weblogic factory right ?

No this is a local factory - the class which will serve on this JVM as the factory for the initial context.

>> Do I need to be on an App server to access a remote EJB call ?.

No.

>> Cant I have a standalone client accessing a EJB on a weblogic server.

Yes you can.
0
 

Author Comment

by:micro_learner
ID: 18820123
>> by the above you mean the remote weblogic factory right ?

>>No this is a local factory - the class which will serve on this JVM as the factory for the initial context.

Can you please give me an example of this ...
0
 

Author Comment

by:micro_learner
ID: 18820217
As I am hitting Weblogic I am using
env.put ( Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory" )

I am getting this error, when I do this ..

Cannot instantiate class: weblogic.jndi.WLInitialContextFactory

Do I need to have a weblogic jar on my client ?
If so where do I get that ?
0
 
LVL 30

Accepted Solution

by:
Mayank S earned 500 total points
ID: 18820759
>> Do I need to have a weblogic jar on my client ?

No. Are you using the standard Sun JVM for your stand alonge application?

Every JVM needs an initial context factory - the "weblogic.jndi.WLInitialContextFactory" will be present on the weblogic app-server (e.g., if a servlet deployed on it wants to connect to the EJB, it can use it), but not on a stand alone client. I guess if you are using Sun's JVM, you need to use the Sun initial context factory. It might be the default, so you can try without that and just specify the URL
0
 

Author Comment

by:micro_learner
ID: 18821263
I know this sounds dumb ...but can you gimme an example using the Sun JVM ( a standalone clinet that does this ..) I seem to be making some mistake somewhere ...

Thanks
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 18827509
My first comment :)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
String array comparison 4 58
Java 8 to Java 6 8 44
Setup GlassFish 4 57
ArrayList Adding/settign data 3 38
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question