RE: Shark, Eclipse and the ClassLoader
"Neville van Deventer" <[email protected]>
| Newsgroups | gmane.comp.java.enhydra.shark |
|---|---|
| Message-ID | <[email protected]> |
Hi Josh,
I Hava a simular setup in my dev Environment,
Here is a Snippet from my SharkInitialize function (This configures the
server, and loads some other properties as well)
Properties props = new Properties();
String path = SharkServer.class.getResource(
"/za/gov/tshwane/config/shark" ).toString().replace("file:/","");
System.out.println("Path is " + path);
Properties sharkServerProperties = new Properties();
sharkServerProperties.load(new FileInputStream(path +
"/SharkServer.conf"));
props.load(new FileInputStream(path + "/Shark.conf"));
props.setProperty("enginename", SHARK_ENGINE_NAME);
props = utilReplaceInProperties( props, "@@BASE@@", path );
props = utilReplaceInProperties( props, "@@XPDL@@",
sharkServerProperties.getProperty( "SharkServer.XPDL.Location" ) );
props = utilReplaceInProperties( props, "@@LOGS@@",
sharkServerProperties.getProperty( "SharkServer.LOGS.Location" ) );
props = utilReplaceInProperties( props, "@@DBSV@@",
sharkServerProperties.getProperty( "SharkServer.Database.IP" ) );
Shark.configure(props);
Hope this helps you
Regards
Neville van Deventer
-----Original Message-----
From: Josh Zeidner [mailto:[email protected]]
Sent: 14 July 2005 01:01 AM
To: [email protected]
Subject: [shark] Shark, Eclipse and the ClassLoader
Hello,
I am currently trying to develop a simple application in Eclipse that
uses Shark. My app has one line:
org.enhydra.shark.Shark.configure( "conf/Shark.conf" );
This causes a nullPointerException when this code executes:
URL u=Shark.class.getClassLoader().getResource("Shark.conf.forJar");
because for some reason, the code tries to load the default .conf file
located in the .jar file even though I am supplying my own Shark.conf file.
The problem is that the getClassLoader() function returns null.
Sun offers some useful info:
******************************************
getClassLoader
public ClassLoader
<http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ClassLoader.html>
*getClassLoader*()
Returns the class loader for the class. Some implementations may use null to
represent the bootstrap class loader. This method will return null in such
implementations if this class was loaded by the bootstrap class loader.
******************************************
So when I use Eclipse, the getClassLoader() function returns null and throws
a fatal exception, but I can run Shark from the standard .bat files. Any
ideas? Anyone using Eclipse + Shark?
Thanks, Josh Zeidner
message-footer.txt
(text/plain, 271 B)
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws