Solved

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

Posted on 2007-03-29
9
1,543 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:mayankeagle
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:mayankeagle
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 

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:
mayankeagle 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:mayankeagle
ID: 18827509
My first comment :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

759 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

16 Experts available now in Live!

Get 1:1 Help Now