From: Marcos S. P. <msa...@gr...> - 2009-03-23 11:01:39
|
Hello I am trying to use rome to read rss from jython from tomcat, but I find a problem: * I am not including rome.jar in the java classpath. * Dynamic code (a user plugin) adds rome.jar to sys.path. * Some internal module needs a properties file that gets loaded (if I put rome.jar in the classpath) by a call to classLoader.getResourceAsStream * The resource is not found. Is there some way to trick this classloader to look in the jars added to sys.path? |
From: Alan K. <jyt...@xh...> - 2009-03-23 16:13:34
|
[Marcos] > * I am not including rome.jar in the java classpath. > * Dynamic code (a user plugin) adds rome.jar to sys.path. > * Some internal module needs a properties file that gets loaded (if I > put rome.jar in the classpath) by a call to > classLoader.getResourceAsStream > * The resource is not found. > > Is there some way to trick this classloader to look in the jars added to > sys.path? Which class loader? Adding to sys.path only affects the jython class loader. This will not affect any other class loader in effect, e.g. a web application class loader, which will go through the usual mechanisms, e.g. loading from WEB-INF/lib, etc. If the resource is in rome.jar, then you're going to have to put rome.jar in the classpath, where the (non-jython) class loader can find it. Is there any reason why you can't put rome.jar in the classpath? Alan. |
From: Marcos S. P. <msa...@gr...> - 2009-03-23 16:39:56
|
Thank you very much for taking interest. The application accepts user plugins (both .py files and java .jars). It usually works fine until the library in the jar tries to use resources. It would really be useful if I could use this kind of libraries. If I find no other solution, I'll have to modify rome.jar from the sources (which is not very complex for what I want I guess). Any other idea? El lun, 23-03-2009 a las 16:13 +0000, Alan Kennedy escribió: > [Marcos] > > * I am not including rome.jar in the java classpath. > > * Dynamic code (a user plugin) adds rome.jar to sys.path. > > * Some internal module needs a properties file that gets loaded (if I > > put rome.jar in the classpath) by a call to > > classLoader.getResourceAsStream > > * The resource is not found. > > > > Is there some way to trick this classloader to look in the jars added to > > sys.path? > > Which class loader? > > Adding to sys.path only affects the jython class loader. > > This will not affect any other class loader in effect, e.g. a web > application class loader, which will go through the usual mechanisms, > e.g. loading from WEB-INF/lib, etc. > > If the resource is in rome.jar, then you're going to have to put > rome.jar in the classpath, where the (non-jython) class loader can > find it. > > Is there any reason why you can't put rome.jar in the classpath? > > Alan. > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Alan K. <jyt...@xh...> - 2009-03-23 16:56:22
|
[Marcos] > Thank you very much for taking interest. > > The application accepts user plugins (both .py files and java .jars). It > usually works fine until the library in the jar tries to use resources. > It would really be useful if I could use this kind of libraries. If I > find no other solution, I'll have to modify rome.jar from the sources > (which is not very complex for what I want I guess). > > Any other idea? Yes, copy the rome.jar file, containing the properties file, into WEB-INF/lib, and your problems should be at an end. Alan. P.S. I think Apache Abdera is a far superior RSS and Atom library, although it's been a year since I did an extensive comparison. |
From: Marcos S. P. <msa...@gr...> - 2009-03-24 16:11:33
|
Of course, but... The advantage of this plugin mechanism is that the users of my application can extend their sub-application without writing anything outside of their sub-application directory. If I am forced to put their stuff in WEB-INF, the whole thing is pretty useless (I know, I can trust rome.jar since it is open source and I can review it, but it is not what I had thought of). It all worked quite well until I found jars using internal resources. I suppose if tomcat is the application container, mine is a sub-application container as well. El lun, 23-03-2009 a las 16:56 +0000, Alan Kennedy escribió: > [Marcos] > > Thank you very much for taking interest. > > > > The application accepts user plugins (both .py files and java .jars). It > > usually works fine until the library in the jar tries to use resources. > > It would really be useful if I could use this kind of libraries. If I > > find no other solution, I'll have to modify rome.jar from the sources > > (which is not very complex for what I want I guess). > > > > Any other idea? > > Yes, copy the rome.jar file, containing the properties file, into > WEB-INF/lib, and your problems should be at an end. > > Alan. > > P.S. I think Apache Abdera is a far superior RSS and Atom library, > although it's been a year since I did an extensive comparison. > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |
From: Alan K. <jyt...@xh...> - 2009-03-24 17:28:33
|
[Marcos] > The advantage of this plugin mechanism is that the users of my > application can extend their sub-application without writing anything > outside of their sub-application directory. If I am forced to put their > stuff in WEB-INF, the whole thing is pretty useless (I know, I can trust > rome.jar since it is open source and I can review it, but it is not what > I had thought of). It all worked quite well until I found jars using > internal resources. I think I'm beginning to see what your issue is. You're only informing the jython class loader about rome.jar, by adding it to sys.path. And you're not adding rome.jar to the Tomcat web application class loader, because you don't want to put rome.jar in WEB-INF/lib. But you're trying to call getResourceAsStream() on the web application class loader, not the jython class loader? http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html Have you tried to call getResourceAsStream() directly on the jython class loader? E.g. import sys sys.classLoader.getResourceAsStream() Alan. |
From: Marcos S. P. <msa...@gr...> - 2009-03-25 09:49:48
|
All right, I think that you are beginning to understand the problem more than I do (that is good :-) The funny thing is that jython classloader loads the class but rome tries to load the resource from other classloader. Shouldn't be both be the same? I am going to try to inform rome that it should use the jython class loader to get the resource. I'll tell you all the results, for the curious. More later... El mar, 24-03-2009 a las 17:28 +0000, Alan Kennedy escribió: > [Marcos] > > The advantage of this plugin mechanism is that the users of my > > application can extend their sub-application without writing anything > > outside of their sub-application directory. If I am forced to put their > > stuff in WEB-INF, the whole thing is pretty useless (I know, I can trust > > rome.jar since it is open source and I can review it, but it is not what > > I had thought of). It all worked quite well until I found jars using > > internal resources. > > I think I'm beginning to see what your issue is. > > You're only informing the jython class loader about rome.jar, by > adding it to sys.path. And you're not adding rome.jar to the Tomcat > web application class loader, because you don't want to put rome.jar > in WEB-INF/lib. But you're trying to call getResourceAsStream() on the > web application class loader, not the jython class loader? > > http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html > > Have you tried to call getResourceAsStream() directly on the jython > class loader? E.g. > > import sys > sys.classLoader.getResourceAsStream() > > Alan. > > ------------------------------------------------------------------------------ > Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are > powering Web 2.0 with engaging, cross-platform capabilities. Quickly and > easily build your RIAs with Flex Builder, the Eclipse(TM)based development > software that enables intelligent coding and step-through debugging. > Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com > _______________________________________________ > Jython-users mailing list > Jyt...@li... > https://lists.sourceforge.net/lists/listinfo/jython-users > |