Well the application server is just Apache. I'm not running JSP or
"applet" HTML tag. Java SDK 1.6.0 update 12.
> Have you tried to run the application using JNLP yet? If it works as a
> standalone JAR then it will probably work with JNLP. However, even if
> it does work then this is not really a resolution for your issue. Can
> you tell us what application server and Java version that you are running?
>
>
> Josh Juneau
>
juneau001@... <mailto:
juneau001@...>
>
http://jj-blogger.blogspot.com> Twitter ID: javajuneau
>
>
> On Mon, Jun 15, 2009 at 3:40 PM, Neil M. <
nabber00@...
> <mailto:
nabber00@...>> wrote:
>
> Thanks, I guess should explain some more. First, I'm using Jython
> 2.5 RC4
> if that makes a difference. Also, the files do not exist on the
> webserver
> nor do I want them to be there, the .class and .py files (along with all
> of jython) are included in the .jar file and I expect it to just
> find and
> load those. I don't want to see any HTTP requests like I'm seeing
> because
> it is unbearably slow to load the applet that way.
>
> I changed the way the factory gets called, for example I do this to
> get a
> class:
>
> JythonFactory jf = JythonFactory.getInstance();
> Downloader eType = (Downloader) jf.getJythonObject(
> "jyinterface.Downloader", "JDownloader");
>
>
> There is a corresponding Downloader.class and JDownloader.py file
> included
> in the .jar.
>
> So it should just be looking in classpath and sys.path to import things?
> I don't understand why it is hitting the webserver to do this. I figure
> it must be a classpath or pythonpath issue?
>
> Neil
>
> > Neil-
> >
> > It seems from your example like you are passing a string
> representation of
> > the path to the Python modules. That is one way of performing
> this task.
> > Another way is to place the modules somewhere in your sys.path and
> pass
> > just
> > the name of the module instead of the complete path. You can take
> a look
> > at
> > an article submitted to Jython Monthly by Charlie Groves for more
> > information:
> >
http://wiki.python.org/jython/JythonMonthly/Articles/October2006/3> on this
> > technique. You'd have to modify your code a bit, but this may be
> one way
> > to
> > get around these errors.
> >
> > I am not exactly sure why you are receiving the errors unless the
> modules
> > are not available to the web server in the designated path that
> you are
> > sending to the factory.
> >
> > Hope this gets you headed in the right direction for resolving the
> errors.
> >
> > Josh Juneau
> >
juneau001@... <mailto:
juneau001@...>
> >
http://jj-blogger.blogspot.com> > Twitter ID: javajuneau
> >
> >
> > On Mon, Jun 15, 2009 at 12:16 PM, Neil M. <
nabber00@...
> <mailto:
nabber00@...>> wrote:
> >
> >> Hi, I'm trying to run a Java Applet with a Java Swing GUI but using a
> >> python library as a backed. I've packed it all into a .jar that runs
> >> fine as a standalone Java app. When I move it to the webserver
> it seems
> >> to be issuing HTTP requests (see attached log) for various
> imports and I
> >> have no idea why. Something with the classpath or pythonpath? Any
> >> ideas?
> >>
> >> Neil
> >>
> >> --------------- modified jython factory ----------------------
> >> public static Object getJythonObject(String interfaceName,
> >> String pathToJythonModule){
> >>
> >> Object javaInt = null;
> >> PythonInterpreter interpreter = new PythonInterpreter();
> >> //interpreter.execfile(pathToJythonModule);
> >> interpreter.exec("import " + pathToJythonModule);
> >> //String tempName =
> >> pathToJythonModule.substring(pathToJythonModule.lastIndexOf("/")+1);
> >> String tempName =
> >> pathToJythonModule.substring(pathToJythonModule.lastIndexOf(".")+1);
> >> //tempName = tempName.substring(0, tempName.indexOf("."));
> >> //System.out.println(tempName);
> >> String instanceName = tempName.toLowerCase();
> >> String javaClassName = tempName.substring(0,1).toUpperCase() +
> >> tempName.substring(1);
> >> //String objectDef = "=" + javaClassName + "()";
> >> String objectDef = "=" + pathToJythonModule + "." +
> javaClassName
> >> + "()";
> >> interpreter.exec(instanceName + objectDef);
> >> //System.out.println(instanceName + objectDef);
> >> try {
> >> Class JavaInterface = Class.forName(interfaceName);
> >> javaInt =
> >>
> interpreter.get(instanceName).__tojava__(JavaInterface);
> >> } catch (ClassNotFoundException ex) {
> >> ex.printStackTrace(); // Add logging here
> >> }
> >>
> >> return javaInt;
> >> }
> >>
> >>
> >> -------------------- HTTP Log --------------------
> >>
> >> [Sun Jun 14 18:50:40 2009] [error] [client X] File does not exist:
> >> /download_test/stat$py.class
> >>
> >> [Sun Jun 14 18:50:41 2009] [error] [client X] File does not exist:
> >> /download_test/stat$py.class
> >> [Sun Jun 14 18:50:42 2009] [error] [client X] File does not exist:
> >> /download_test/java
> >> [Sun Jun 14 18:50:45 2009] [error] [client X] File does not exist:
> >> /download_test/java
> >> [Sun Jun 14 18:50:46 2009] [error] [client X] File does not exist:
> >> /download_test/java
> >> [Sun Jun 14 18:50:46 2009] [error] [client X] File does not exist:
> >> /download_test/java
> >> [Sun Jun 14 18:50:47 2009] [error] [client X] File does not exist:
> >> /download_test/org.class
> >> [Sun Jun 14 18:50:47 2009] [error] [client X] File does not exist:
> >> /download_test/org.class
> >> [Sun Jun 14 18:50:48 2009] [error] [client X] File does not exist:
> >> /download_test/org
> >> [Sun Jun 14 18:50:48 2009] [error] [client X] File does not exist:
> >> /download_test/org
> >> [Sun Jun 14 18:50:49 2009] [error] [client X] File does not exist:
> >> /download_test/org
> >> [Sun Jun 14 18:50:50 2009] [error] [client X] File does not exist:
> >> /download_test/org
> >>
> >>
> >>
> ------------------------------------------------------------------------------
> >> Crystal Reports - New Free Runtime and 30 Day Trial
> >> Check out the new simplified licensing option that enables unlimited
> >> royalty-free distribution of the report engine for externally facing
> >> server and web deployment.
> >>
http://p.sf.net/sfu/businessobjects> >> _______________________________________________
> >> Jython-users mailing list
> >>
Jython-users@...
> <mailto:
Jython-users@...>
> >>
https://lists.sourceforge.net/lists/listinfo/jython-users> >>
> >
>
>
>
> ------------------------------------------------------------------------------
> Crystal Reports - New Free Runtime and 30 Day Trial
> Check out the new simplified licensing option that enables unlimited
> royalty-free distribution of the report engine for externally facing
> server and web deployment.
>
http://p.sf.net/sfu/businessobjects> _______________________________________________
> Jython-users mailing list
>
Jython-users@...
> <mailto:
Jython-users@...>
>
https://lists.sourceforge.net/lists/listinfo/jython-users>
>