Until I am a Java guru, I must remain modest :)

My server has no problem loading the resource when I do the code you gave as
an example:

URL mletURL = getClass.getResource( "myserver.conf" );

In my server, and in jBoss' startup code.  It adds an MLet class to the
server this way, then sets the class loader:

MLet mlet = new MLet();
server.registerMBean( mlet, new ObjectName( server.getDefaultDomain(),
"service", "MLet"));
Thread.currentThread().setContextClassLoader(mlet);

It then calls:

URL mletURL = getClass().getClassLoader().getResource( "myserver.conf" );

This doesn't work for me.  I don't understand where the configuration file
should be loaded, and more importantly, I don't understand how jBoss finds
its configuration in the jBoss\conf directory using this bit of code.

<sigh>

Perhaps a pilgramage to Mount Telkel is in order :)  Thanks for helping.

Wes

-----Original Message-----
From: Tom Cook [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 03, 2000 1:16 AM
To: jBoss
Subject: [jBoss-User] Stupid Question


There are no stupid questions, just stupid people...

Wes Mckean writes:
 > Ok, so this isn't exactly a jBoss question, but...
 > 
 > I am patterning a JMX server on jBoss' architecture, and I can't get my
 > server to find the MLet configuration file when I do the following:
 > 
 >      URL mletURL =
 > getClass().getClassLoader().getResource("myserver.conf");
 > 
 > It does work with:
 > 
 >      URL mletURL = getClass().getResource("myserver.conf");
 > 
 > Any insight is appreciated.

>From the API doc for java.lang.Class.getResource:

  This method delegates the call to its class loader, after making these
  changes to the resource name: if the resource name starts with "/", it
  is unchanged; otherwise, the package name is prepended to the resource
  name after converting "." to "/". If this object was loaded by the
  bootstrap loader, the call is delegated to ClassLoader.getSystemResource.

So

  getClass.getResource( "myserver.conf" );

is equivalent to

  getClass.getResource( "com.myorg.myproject.myserver.conf" );

Tom

P.S. The stupid people are the ones who don't ask questions.
-- 
Tom Cook - Software Engineer

"We rarely find that people have good sense unless they agree
 with us."
                - Francois, Duc de la Rochefoucauld

LISAsoft Pty Ltd - www.lisa.com.au

--------------------------------------------------
38 Greenhill Rd.          Level 3, 228 Pitt Street
Wayville, SA, 5034        Sydney, NSW, 2000

Phone:   +61 8 8272 1555  Phone:   +61 2 9283 0877
Fax:     +61 8 8271 1199  Fax:     +61 2 9283 0866
--------------------------------------------------


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]


--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to