Solved

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

Posted on 2007-03-29
9
1,546 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
 
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

862 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

Need Help in Real-Time?

Connect with top rated Experts

27 Experts available now in Live!

Get 1:1 Help Now