Re: funky classpath issues?

From: Donald Dietrick <dietrick@bbn.com>
Date: Mon Aug 13 2001 - 19:30:46 EDT

Hi Jeff,

On Monday, August 13, 2001, at 07:06 PM, Jeff Mathis wrote:

> Don -
>
> thanks for your response.
>
> In reading suns documentation, it may be a security policy issue.
> Nothing to do with OpenMap at all
>
> So, to be explicit, I place openmap.jar inside JAVA_HOME/jre/lib/ext.
> my class files reside elsewhere, say in /home/myfiles. The /home/myfiles
> directory has a com/mycompany/main.java class. main.java fires up my
> version of OpenMap, using some of my classes in the com/mycompany
> directory and its subdirectories. I am using the MapHandler and the
> properties file.
>
> I then issue the commands:
>
> CLASSPATH="/home/myfiles";export CLASSPATH
> $JAVA_HOME/bin/java -cp $CLASSPATH com.mycompany.main -p
> file:/home/myfiles/myprops.properties
>
> I use the ArgParser, and it verifies that it can successfully find the
> properties file, and LayerUtils.getResourceOrFileOrURL returns a valid
> URL which I feed to the PropertyHandler.
>
> In this scenario, OpenMap classes are created, but classes in my
> CLASSPATH cannot be found (a ClassNotFoundException is thrown), and the
> application does not initialize (even though com.mycompany.main CAN be
> found!)

That's something I would not have expected.

> Now, I remove openmap.jar from $JAVA_HOME/jre/lib/ext. I issue the
> following:
>
> CLASSPATH="/home/myfiles:/home/openmap/openmap.jar";export CLASSPATH
> $JAVA_HOME/bin/java -cp $CLASSPATH com.mycompany.main -p
> file:/home/myfiles/myprops.properties
>
> All works as expected.
>
>
> This behavior is new to me since I've never put stuff in
> $JAVA_HOME/jre/lib/ext. However, one of our users does.

I've never messed around with that directory, either. It just feels
like asking for trouble, but then again, I don't know what the intent of
the directory is. It also seems like it shouldn't be messing up your
classpath settings.

> So, the question is: is something in OpenMap resetting the classpath at
> runtime to ignore the command line flag (yea right!), or, do we need to
> define a security policy if we insist on putting things in both
> jre/lib/ext and our own directories?

OpenMap doesn't do anything with classpath settings. :) I don't know
if a security policy would help, either. It would be nice if you were
getting something more explicit for error messages to let you know
what's really going on with the classpath. Maybe you can play around
with the ClassLoader a bit to see what it thinks is going on.

Good Luck,

Don

> (actually, I'd vote to not put anything in $JAVA_HOME/jre/lib/ext, but
> you know how pesky users can be!)
>
> Jeff
>
>
>
> Donald Dietrick wrote:
>>
>> Hi Jeff,
>>
>> I may be reading this wrong, but it looks like the jre is acting the
>> way
>> I would expect it to. I would assume that anything in the
>> JAVA_HOME/jre/lib/ext would be prepended to the CLASSPATH, and any
>> classes found in those directories/jar files would be used before
>> anything else in the CLASSPATH.
>>
>> - Don
>>
>> On Monday, August 13, 2001, at 04:35 PM, Jeff Mathis wrote:
>>
>>> Hello,
>>>
>>> We've noticed something very interesting.
>>>
>>> If we put the openmap.jar file into a directory other than
>>> JAVA_HOME/jre/lib/ext, the openmap package seems to pay attention to
>>> the
>>> CLASSPATH environment variable specified on the jvm command line.
>>>
>>> However, if openmap.jar gets put into JAVA_HOME/jre/lib/ext, it
>>> ignores
>>> any classpath specified in the users environment or on the jvm command
>>> line, and therefore any classes I have written cannot be found by the
>>> MapHandler. Compilation happens under either scenario.
>>>
>>> Have you seen this before?
>>>
>>> thanks
>>>
>>> jeff
>>>
>>> --
>>> Jeffrey Mathis, PhD FAX: 505-988-2229
>>> Senior Scientist email: jeff.mathis@biosgroup.com
>>> Bios Group, Inc. phone 505-992-6737
>>> 317 Paseo de Peralta http://www.biosgroup.com
>>> Santa Fe, NM 87501
>>>
>>> --
>>> [To unsubscribe to this list send an email to "majdart@bbn.com"
>>> with the following text in the BODY of the message "unsubscribe
>>> openmap-users"]
>>>
>>
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Donald F. Dietrick, dietrick@bbn.com
BBN Technologies, 10 Moulton Street, Cambridge, MA 02138
617.873.3031 FAX 2794
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
> --
> Jeffrey Mathis, PhD FAX: 505-988-2229
> Senior Scientist email: jeff.mathis@biosgroup.com
> Bios Group, Inc. phone 505-992-6737
> 317 Paseo de Peralta http://www.biosgroup.com
> Santa Fe, NM 87501
>

--
[To unsubscribe to this list send an email to "majdart@bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Mon Aug 13 19:30:53 2001

This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:31 EDT