Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

EJB access problem form applet

4 views
Skip to first unread message

hawl...@ars.de

unread,
Mar 1, 2000, 3:00:00 AM3/1/00
to
I can access my session ejb from an applet inside the VAJ test
environment but not outside
(neither in Internet Explorer 5 with Sun Java Plug-In 1.2.2 nor with
the Sun appletviewer)!

This piece of code causes the error:

Call inside the applet:
BLBSMSMachineInfoAccessor acc = new BLBSMSMachineInfoAccessor
("iiop://xblbtest01:900/");
acc.retrieveHomeRef();
acc.instantiate(<machineNr>);
de.blb.smsview.BLBMachineInfo machineInfo = acc.getEjbRef(); //
BLBMachineInfo is the remote interface
....

The error occurs inside the call of retrieveHomeRef() of my ejb
accessor class. Here is the code:

package de.blb.smsview.applet;

public class BLBSMSMachineInfoAccessor {
private static java.lang.String nameServiceURL;
private de.blb.smsview.BLBMachineInfoHome home = null;
private de.blb.smsview.BLBMachineInfo ejbRef;
private static String nameServiceFactory
= "com.ibm.ejs.ns.jndi.CNInitialContextFactory";
private final static boolean trace = true;

public BLBSMSMachineInfoAccessor(String nameServiceURL) {
setNameServiceURL(nameServiceURL);
}

public void instantiate(String dwMachineID)
{
try { ejbRef = home.create(dwMachineID); }
catch (javax.ejb.CreateException e)
{
System.out.println("Instantiation error");
e.printStackTrace();
}
catch (java.rmi.RemoteException e)
{
System.out.println("Server- or connection error");
e.printStackTrace();
}

}

public void retrieveHomeRef()
{
java.util.Properties nameServiceProperties = new
java.util.Properties();

nameServiceProperties.put(javax.naming.Context.PROVIDER_URL,
getNameServiceURL());
nameServiceProperties.put
(javax.naming.Context.INITIAL_CONTEXT_FACTORY, getNameServiceFactory
());

// Set context for Java Naming And Directory Interface (JNDI)
try
{
javax.naming.InitialContext initContext = new
javax.naming.InitialContext(nameServiceProperties);
// here occurs the crash!! (see below)

// Retrieve reference to Home of BLBMachineInfo
Object obj = initContext.lookup("BLBMachineInfo");
home = (de.blb.smsview.BLBMachineInfoHome)
javax.rmi.PortableRemoteObject.narrow( obj,
de.blb.smsview.BLBMachineInfoHome.class);
}
catch (javax.naming.NamingException e)
{
System.out.println("Nameservice error);
e.printStackTrace();
}

}
public de.blb.smsview.BLBMachineInfo getEjbRef() {
return ejbRef;
}

public de.blb.smsview.BLBMachineInfoHome getHome() {
return home;
}

public java.lang.String getNameServiceURL() {
return nameServiceURL;
}

public void setNameServiceFactory(String newNameServiceFactory) {
nameServiceFactory = newNameServiceFactory;
}

public void setNameServiceURL(java.lang.String newNameServiceURL) {
nameServiceURL = newNameServiceURL;
}
}

Thats's the error I get from IE5 with Java Plug-In
(I provided all the "missing" classes on the webserver):

Nameservice error
javax.naming.NoInitialContextException: Cannot instantiate class:
com.ibm.ejs.ns.jndi.CNInitialContextFactory.
Root exception is java.lang.ClassNotFoundException:
com/ibm/ejs/ns/jndi/CNInitialContextFactory
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:199)
at com.sun.naming.internal.VersionHelper12.loadClass
(VersionHelper12.java:45)
at javax.naming.spi.NamingManager.getInitialContext
(NamingManager.java:665)
at javax.naming.InitialContext.getDefaultInitCtx
(InitialContext.java:250)
at javax.naming.InitialContext.init(InitialContext.java:226)
at javax.naming.InitialContext.<init>(InitialContext.java:202)
at de.blb.smsview.applet.BLBSMSMachineInfoAccessor.retrieveHomeRef
(BLBSMSMachineInfoAccessor.java:131)
at de.blb.smsview.applet.BLBSMSApplet.loadMachineInfoEJB
(BLBSMSApplet.java:310)
at de.blb.smsview.applet.BLBSMSApplet.connEtoC1(BLBSMSApplet.java:44)
at de.blb.smsview.applet.BLBSMSApplet.actionPerformed
(BLBSMSApplet.java:29)
at javax.swing.AbstractButton.fireActionPerformed
(AbstractButton.java:1066)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed
(AbstractButton.java:1101)
at javax.swing.DefaultButtonModel.fireActionPerformed
(DefaultButtonModel.java:378)
at javax.swing.DefaultButtonModel.setPressed
(DefaultButtonModel.java:250)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased
(BasicButtonListener.java:204)
at java.awt.Component.processMouseEvent(Component.java:3160)
at java.awt.Component.processEvent(Component.java:2999)
at java.awt.Container.processEvent(Container.java:990)
at java.awt.Component.dispatchEventImpl(Component.java:2394)
at java.awt.Container.dispatchEventImpl(Container.java:1035)
at java.awt.Component.dispatchEvent(Component.java:2307)
at java.awt.LightweightDispatcher.retargetMouseEvent
(Container.java:2043)
at java.awt.LightweightDispatcher.processMouseEvent
(Container.java:1827)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:1730)
at java.awt.Container.dispatchEventImpl(Container.java:1022)
at java.awt.Component.dispatchEvent(Component.java:2307)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:287)
at java.awt.EventDispatchThread.pumpOneEvent
(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:92)

at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)

If I provide all the IBM ejb classes locally in the classpath (with is
not the sense of an applet!!!),
I get the following error (same with appletviewer):

Nameservice error
[Root exception is org.omg.CORBA.INITIALIZE: can't instantiate default
ORB implementation com.ibm.CORBA.iiop.ORB minor code: 0 completed: No]
javax.naming.ServiceUnavailableException
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.initORB
(CNInitialContextFactory.java:339)
at com.ibm.ejs.ns.jndi.CNInitialContextFactory.getInitialContext
(CNInitialContextFactory.java:186)
at javax.naming.spi.NamingManager.getInitialContext
(NamingManager.java:783)
at javax.naming.InitialContext.getDefaultInitCtx
(InitialContext.java:165)
at javax.naming.InitialContext.<init>(InitialContext.java:142)
at
de.blb.smsview.applet.BLBSMSMachineInfoAccessor.retrieveHomeRef
(BLBSMSMachineInfoAccessor.java:131)
at de.blb.smsview.applet.BLBSMSApplet.loadMachineInfoEJB
(BLBSMSApplet.java:310)
at de.blb.smsview.applet.BLBSMSApplet.connEtoC1
(BLBSMSApplet.java:44)
at de.blb.smsview.applet.BLBSMSApplet.actionPerformed
(BLBSMSApplet.java:29)
at javax.swing.AbstractButton.fireActionPerformed
(AbstractButton.java:1066)
at
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed
(AbstractButton.java:1101)
at javax.swing.DefaultButtonModel.fireActionPerformed
(DefaultButtonModel.java:378)
at javax.swing.DefaultButtonModel.setPressed
(DefaultButtonModel.java:250)
at javax.swing.AbstractButton.doClick(AbstractButton.java:226)
at de.blb.smsview.applet.BLBSMSApplet.connEtoM1
(BLBSMSApplet.java:62)
at de.blb.smsview.applet.BLBSMSApplet.actionPerformed
(BLBSMSApplet.java:31)
at javax.swing.JTextField.fireActionPerformed
(JTextField.java:409)
at javax.swing.JTextField.postActionEvent(JTextField.java:443)
at javax.swing.JTextField$NotifyAction.actionPerformed
(JTextField.java:537)
at javax.swing.text.JTextComponent.mapEventToAction
(JTextComponent.java:966)
at javax.swing.text.JTextComponent.processComponentKeyEvent
(JTextComponent.java:1431)
at javax.swing.JComponent.processKeyEvent(JComponent.java:1538)
at java.awt.Component.processEvent(Component.java:3008)
at java.awt.Container.processEvent(Container.java:990)
at java.awt.Component.dispatchEventImpl(Component.java:2394)
at java.awt.Container.dispatchEventImpl(Container.java:1035)
at java.awt.Component.dispatchEvent(Component.java, Compiled
Code)
at java.awt.LightweightDispatcher.processKeyEvent
(Container.java:1766)
at java.awt.LightweightDispatcher.dispatchEvent
(Container.java:1740)
at java.awt.Container.dispatchEventImpl(Container.java:1022)
at java.awt.Component.dispatchEvent(Component.java, Compiled
Code)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:287)
at java.awt.EventDispatchThread.pumpOneEvent
(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents
(EventDispatchThread.java:92)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:83)

Florian Hawlitzek.


Sent via Deja.com http://www.deja.com/
Before you buy.

0 new messages