|
From:
<and...@er...> - 2003-09-17 11:46:07
|
Hi, in an embedded system of ours, I wrote a socket server in Java which delegates incoming commands to the PythonInterpreter and sends back its output. It would have been so cool if it had worked... (How foolish of me.) For some reason the java.io.StringBufferInputStream class is missing (see output below) from the embedded JVM api which is based on the CDC foundation profile (see http://java.sun.com/products/cdc/). However, according to spec all java.io files are supported, so the StringBufferInputStream _should_ be present. Reading the javadoc for this class, it seems the class is deprecated, so maybe that is the reason? I also tried to extract the class file from a JDK 1.3 distribution and zip it in my embedded jar. That didn't work either, of course, because of a SecurityException (see below). (Is there a way to bypass this security check?) My questions are: * Is there a jython.jar later than 2.1 that does not use the deprecated java.io.StringBufferInputStream class? * If not, should I change the org.python.core.PySystemState class myself? (However, there may be other places to take care of.) * Any idea why CDC foundation profile lacks the java.io.StringBufferInputStream class in the first place? * Let's say I get this thing running. What is the memory footprint of the JythonInterpreter? Thanks a lot! /Andreas ###################################################### Original exception $ Accepting new connection LicensingStub : OSA_LIC_NOTIF_SUBSCRIBE_REQ Client connected Waiting for commands... Receving commands... >>print 1+1 Server is closing connection java.lang.NoClassDefFoundError: java.io.StringBufferInputStream at org.python.core.PySystemState.initStaticFields()V(PySystemState.java) at org.python.core.PySystemState.initialize(Ljava/util/Properties;Ljava/util/Properties;[Ljava/lang/String;Ljava/lang/ClassLoader;)V(PySystemState.java) at org.python.core.PySystemState.initialize(Ljava/util/Properties;Ljava/util/Properties;[Ljava/lang/String;)V(PySystemState.java) at org.python.util.PythonInterpreter.initialize(Ljava/util/Properties;Ljava/util/Properties;[Ljava/lang/String;)V(PythonInterpreter.java) at se.ericsson.cello.cli.JythonOracle.<clinit>()V(JythonOracle.java:143) at java.lang.Class.runStaticInitializers()V(Class.java:1499) at se.ericsson.cello.cli.CelloJavaCLIServer.handleRequest(Ljava/io/InputStream;Ljava/io/OutputStream;)V(CelloJavaCLIServer.java:103) at se.ericsson.cello.cli.CelloJavaCLIServer.run()V(CelloJavaCLIServer.java:51) at java.lang.Thread.run()V(Thread.java:553) at java.lang.Thread.startup(JZ)V(Thread.java:606) ######################################################## Trying to patch the java.io.StringBufferInputStream in another jar file $ Accepting new connection Client connected Waiting for commands... LicensingStub : OSA_LIC_NOTIF_SUBSCRIBE_REQ Receving commands... >>print 1+1 Server is closing connection java.lang.ExceptionInInitializerError: java.lang.SecurityException: Prohibited package name: java.io at java.lang.ClassLoader.defineClass(Ljava/lang/String;[BIILjava/security/ProtectionDomain;)Ljava/lang/Class;(ClassLoader.java:494) at java.security.SecureClassLoader.defineClass(Ljava/lang/String;[BIILjava/security/CodeSource;)Ljava/lang/Class;(SecureClassLoader.java:111) at java.net.URLClassLoader.defineClass(Ljava/lang/String;Lsun/misc/Resource;)Ljava/lang/Class;(URLClassLoader.java:248) at java.net.URLClassLoader.access$100(Ljava/net/URLClassLoader;Ljava/lang/String;Lsun/misc/Resource;)Ljava/lang/Class;(URLClassLoader.java:56) at java.net.URLClassLoader$1.run()Ljava/lang/Object;(URLClassLoader.java:195) at java.security.AccessController.doPrivileged0(Ljava/security/PrivilegedAction;Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;[Ljava/lang/Object;)Z(AccessController.java:367) at java.security.AccessController.doPrivileged(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object;(AccessController.java:334) at java.net.URLClassLoader.findClass(Ljava/lang/String;)Ljava/lang/Class;(URLClassLoader.java:188) at java.lang.ClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class;(ClassLoader.java:313) at sun.misc.Launcher$AppClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class;(Launcher.java:286) at java.lang.ClassLoader.loadClass(Ljava/lang/String;)Ljava/lang/Class;(ClassLoader.java:269) at java.lang.ClassLoader.loadClassInternal(Ljava/lang/String;)Ljava/lang/Class;(ClassLoader.java:329) at org.python.core.PySystemState.initStaticFields()V(PySystemState.java) at org.python.core.PySystemState.initialize(Ljava/util/Properties;Ljava/util/Properties;[Ljava/lang/String;Ljava/lang/ClassLoader;)V(PySystemState.java) at org.python.core.PySystemState.initialize(Ljava/util/Properties;Ljava/util/Properties;[Ljava/lang/String;)V(PySystemState.java) at org.python.util.PythonInterpreter.initialize(Ljava/util/Properties;Ljava/util/Properties;[Ljava/lang/String;)V(PythonInterpreter.java) at se.ericsson.cello.cli.JythonOracle.<clinit>()V(JythonOracle.java:143) at java.lang.Class.runStaticInitializers()V(Class.java:1499) at se.ericsson.cello.cli.CelloJavaCLIServer.handleRequest(Ljava/io/InputStream;Ljava/io/OutputStream;)V(CelloJavaCLIServer.java:103) at se.ericsson.cello.cli.CelloJavaCLIServer.run()V(CelloJavaCLIServer.java:51) at java.lang.Thread.run()V(Thread.java:553) at java.lang.Thread.startup(JZ)V(Thread.java:606) |