Hi Michael (and others).
 
Still hunting that EJB access from Jython within Borland AppServer 4.5...
> Did you try to run the code I posted with Borland's Initial Context requirements and Provider_Url?
Yes, I tried to use your previous script as posted, but I get only as far as to what value to use for the PROVIDER_URL setting. Below is "my" script, and the exception I get ("unknown protocol "t3"", if I drop the "t3" part, I get the same exception, simply "unknown protocol "localhost"").
> Are you able to access your beans via a java client?
Yes, I can access my beans via a J2EE client. Thus, the usual JNDI lookup via InitialContext and so forth is working fine.
 
Hopes this helps anyone out there. I've looked hard in the Borland AppServer doc for this, but have come up short so far.
 
Cheers,
Thomas
 
--- code & exception ---
import java
from java.lang import Object,StringBuffer,String
from javax.naming import *
from java.util import *
from javax.rmi import *
from java.io import *
from java.lang import System
class Client:
        def __init__(self):
            self.doNothing = 0
            self.p = Properties()
            self.jndiContext = InitialContext()
            self.ref = Object()
           
            self.p.put(Context.INITIAL_CONTEXT_FACTORY, 'com.sun.jndi.cosnaming.CNCtxFactory')
            self.p.put(Context.PROVIDER_URL, 't3://localhost:14050')
           
        def getInitialContext(self):
self.p.put(Context.INITIAL_CONTEXT_FACTORY, 'com.sun.jndi.cosnaming.CNCtxFactory')
            self.p.put(Context.PROVIDER_URL, 't3://localhost:14050')
            return InitialContext(self.p)
 
        def getRemote(self,jndiContext):
            self.jndiContext = self.getInitialContext()
#     self.ref = jndiContext.lookup("ejb/SimpleBean")
#     home = PortableRemoteObject.narrow(self.ref,SimpleBeanHome.class)
            #Create a remote reference to the stateless bean
            home = jndiContext.lookup("ejb/SimpleBeanHome")
            sb = home.create()
            print 'CONNECTION SUCCESS!!'
            return sb
           
if __name__ == '__main__':
    print 'Begin client'
    a = Client()
    print 'Object creation'
    ctx = a.getInitialContext()
    #print 'InitialContext is', ctx
    #rem = a.getRemote(ctx)
    #print rem.getS()
    print 'End of client'
 
...and here's my exception:
 
 
>>> execfile("src/ejbacc.py")
Begin client
Object creation
Traceback (innermost last):
  File "<console>", line 1, in ?
  File "src/ejbacc.py", line 36, in ?
  File "src/ejbacc.py", line 20, in getInitialContext
javax.naming.ConfigurationException: Invalid URL: t3://localhost:14050.  Root exception is java.net. MalformedURLException: unknown protocol: t3
        at java.net.URL.<init>(Unknown Source)
        at java.net.URL.<init>(Unknown Source)
        at java.net.URL.<init>(Unknown Source)
        at com.sun.jndi.cosnaming.CNCtx.getStringifiedIor(Unknown Source)
        at com.sun.jndi.cosnaming.CNCtx.initOrbAndRootContext(Unknown Source)
        at com.sun.jndi.cosnaming.CNCtx.<init>(Unknown Source)
        at com.sun.jndi.cosnaming.CNCtxFactory.getInitialContext(Unknown Source)
        at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
        at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
        at javax.naming.InitialContext.init(Unknown Source)
        at javax.naming.InitialContext.<init>(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at org.python.core.PyReflectedConstructor.__call__(PyReflectedConstructor.java:125)
        at org.python.core.PyJavaInstance.__init__(PyJavaInstance.java:61)
        at org.python.core.PyJavaClass.__call__(PyJavaClass.java:786)
        at org.python.core.PyObject.__call__(PyObject.java:272)
        at org.python.pycode._pyx12.getInitialContext$3(src/ejbacc.py)
        at org.python.pycode._pyx12.call_function(src/ejbacc.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:155)
        at org.python.core.PyTableCode.call(PyTableCode.java:210)
        at org.python.core.PyFunction.__call__(PyFunction.java:96)
        at org.python.core.PyInstance.invoke(PyInstance.java:248)
        at org.python.pycode._pyx12.f$0(src/ejbacc.py)
        at org.python.pycode._pyx12.call_function(src/ejbacc.py)
        at org.python.core.PyTableCode.call(PyTableCode.java:155)
        at org.python.core.Py.runCode(Py.java:1055)
        at org.python.core.__builtin__.execfile(__builtin__.java:288)
        at org.python.core.__builtin__.execfile(__builtin__.java:295)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:158)
        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:166)
        at org.python.core.PyObject.__call__(PyObject.java:272)
        at org.python.pycode._pyx11.f$0(<console>)
        at org.python.pycode._pyx11.call_function(<console>)
        at org.python.core.PyTableCode.call(PyTableCode.java:155)
        at org.python.core.Py.runCode(Py.java:1055)
        at org.python.core.Py.exec(Py.java:1076)
        at org.python.util.PythonInterpreter.exec(PythonInterpreter.java:145)
        at org.python.util.InteractiveInterpreter.runcode(InteractiveInterpreter.java:87)
        at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:68)
        at org.python.util.InteractiveInterpreter.runsource(InteractiveInterpreter.java:42)
        at org.python.util.InteractiveConsole.push(InteractiveConsole.java:83)
        at org.python.util.InteractiveConsole.interact(InteractiveConsole.java:62)
        at org.python.util.jython.main(jython.java:178)
javax.naming.ConfigurationException: javax.naming.ConfigurationException: Invalid URL: t3://localhost:14050 [Root exception is java.net.MalformedURLException: unknown protocol: t3]
Regards,
 
Thomas
 
 
-----Original Message-----
From: Garcia, Michael [mailto:mgarcia@Businessedge.com]
Sent: 11. april 2001 19:19

Hi Thomas,
Did you try to run the code I posted with Borland's Initial Context requirements and Provider_Url?  The app server's docs should have what these values should be.  You need these values or else you cannot do a remote lookup on your EJB's.  Are you able to access your beans via a java client?  If yes, you should have no problem accessing via a Jython client. 

-----Original Message-----
From: Thomas Bang Biilmann
To: Jython Dev (E-mail)
Sent: 4/11/01 3:13 AM
Subject: RE: [Jython-dev] RE: EJB access from Jython

OK, I'm just about to surrender now...

 <...>