Hi Jonathan,
If you're creating an initial context without any properties ensure
that in your container configuration you specify the type
of jndi plug in being used.
Also ensure that your JNDINames.EMPLOYEE_EJB_HOME is
the same as your <jndi-name> tag in your container configuration.
To use the naming service bundled with the App Server
can set your properties to the following:
Hashtable environment=new Hashtable();
environment.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.cosnaming.CNCtxFactory");
// The ORB we want to use is Orbix2000, which is configured below
// to use our iPAS configuration The following two properties are
// usually found in orb.properties, but in case we haven't
// configured our JRE correctly... see
// http://java.sun.com/products/jdk/1.2/docs/api/org/omg/CORBA/ORB.html
Properties orbProperties = new Properties();
orbProperties.put("org.omg.CORBA.ORBClass","com.iona.corba.art.artimpl.ORBImpl");
orbProperties.put("org.omg.CORBA.ORBSingletonClass","com.iona.corba.art.artimpl.ORBSingleton");
// The ORB name dictates the plugins that Orbix2000 will use. The
// ORB named "iPAS" is preconfigured with certain properies, such
// as the ability to propagate security and transaction contexts.
String[] orbArgs = new String[] {"-ORBname","iPAS"};
environment.put("java.naming.corba.orb", org.omg.CORBA.ORB.init(orbArgs,
orbProperties));
InitialContext initial = new InitialContext(environment);
ok,
Maggie
Jonathan van Alteren wrote:
> Hi all,
>
> I am currently working in a team developing an enterprise application. We
> are evaluating the IONA iPortal AppServer.
> I have a test environment with 1 stateless sessionbean referencing 1
> entitybean. Apparently, a client has to set environment properties before
> you can get the Initial context and thus the sessionbean. I have tested
> this, and this is correct.
> The docs state that a (session)bean referencing another bean can just create
> an initial context without any properties. This is exactly what I am doing
> in my bean code, but it just doesn't work. I get a nullpointer exception in
> some internal IONA classes (at a PortableRemoteObject.narrow method).
>
> Has anyone encountered the same or a similar problem?
> Is anyone of you using the IONA iPortal Appserver? If so, what do you think
> of it?
>
> Here is some of my code:
>
> (in a util class)
> public static Object lookup(String jndiName)
> {
> Object obj = null;
> try
> {
> InitialContext initial = new InitialContext();
> obj = initial.lookup(jndiName);
> }
> catch (NamingException ne)
> {
> System.err.println(ne);
> }
> return obj;
> }
>
> (in my sessionbean)
> public EmployeeModel createEmployee(EmployeeModel eModel) throws
> CreateException
> {
> try
> {
> Object obj = EJBUtil.lookup(JNDINames.EMPLOYEE_EJB_HOME);
> EmployeeHome eHome =
> (EmployeeHome)javax.rmi.PortableRemoteObject.narrow(obj,
> EmployeeHome.class);
> EmployeeRemote eRemote = eHome.create(eModel);
>
> return eRemote.getDetails();
> }
> catch (RemoteException re)
> {
> throw new EJBException(re);
> }
> }
>
> Kind regards & thanks for any help,
>
> Jonathan van Alteren
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".