Solved

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

Posted on 2007-03-29
9
1,549 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
  • 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
GUI builder for Eclipse? 8 35
Spring Framework HTTPSession management 1 33
servlet  URL Rewriting 1 36
Is there a simpler dropbox system? 10 18
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

785 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