-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Weird exception:

Recently, I have been getting this error from my applet:

16:54:30 [unknown class] [ERROR] Exception caught. Stack trace
follows: javax.naming.NamingException: java:comp/env namespace is
only available from within a J2EE component     at
com.sun.enterprise.naming.java.javaURLContext.getComponentContext(java
URLContext.java:392)    at
com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.ja
va:51)  at javax.naming.InitialContext.lookup(Unknown Source)   at
com.telenor.mobil.planit.appit.util.AppitUtilities.getHome(AppitUtilit
ies.java:254)   at
com.telenor.mobil.planit.appit.util.AppitUtilities.getSessionHome(Appi
tUtilities.java:104)    at
com.telenor.mobil.planit.doping.applet.RnpAppletSharedProperties.<init
>(RnpAppletSharedProperties.java:75)    at
com.telenor.mobil.planit.doping.applet.RnpAppletSharedProperties.getIn
stance(RnpAppletSharedProperties.java:298)      at
com.telenor.mobil.planit.doping.applet.RnpApplet.init(RnpApplet.java:1
95)     at sun.applet.AppletPanel.run(Unknown Source)   at
java.lang.Thread.run(Unknown Source)

Does anyone know what this means? If the java:comp/env namespace is
only available from within a J2EE component, then how is it possible
to program a client or applet which should communicate with my EJBs?

The code creating the error is:

    private static final EJBHome getHome(
    String remoteInterfaceName,
    String moduleName,
    String beanType
    )
    throws ClassNotFoundException, NamingException {
        if( DEBUG ) Log.debug( "getHome( " + remoteInterfaceName + "
" + moduleName + " " + beanType + " )", instance );
        final StringBuffer homeName = new StringBuffer(
"com.telenor.mobil.planit." );
        homeName.append( moduleName.replace('/', '.') );
        homeName.append( ".ejb." );
        homeName.append( beanType );
        homeName.append( "." );
        homeName.append( remoteInterfaceName );
        homeName.append( "Home" );
        
        if( context == null ) {
            if( env != null ) {
                context = new InitialContext( env );
            }
            else {
                context = new InitialContext();
            }
        }
        
        final Object homeObject = context.lookup("java:comp/env/ejb/"
+
        moduleName + "/" + remoteInterfaceName );

yours,
Christian Tellefsen

-----BEGIN PGP SIGNATURE-----
Version: PGP Personal Privacy 6.5.8

iQA/AwUBOh0ySCZr3JnfcXIbEQJcsQCglBp12GnKYrCQ34qkO9lxYPtD6YwAoLOq
+g4vsyMu9gSt8RcLns8HOkPG
=7K60
-----END PGP SIGNATURE-----

Reply via email to