Solved

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

Posted on 2007-03-29
9
1,565 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
Cloud Training Guides

FREE GUIDES: In-depth and hand-crafted Linux, AWS, OpenStack, DevOps, Azure, and Cloud training guides created by Linux Academy instructors and the community.

 
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

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

Question has a verified solution.

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

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
A solution for Fortify Path Manipulation.
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 about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Suggested Courses

635 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