tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Stiegler <bstieg...@novomind.com>
Subject jar-files
Date Sat, 30 Sep 2000 16:40:45 GMT
Hi

i have some problems with a jar file. I want to load my jar file from a
servlet with the following code:

line xxx  String pathToServlet =
( this.getClass().getResource( "my.jar" ).getFile() ).substring( 1 );
line yyy File jarServlet = new File( pathToServlet );

this results in an exception which i can see in the
$TOMCAT_HOME/log/tomcat.log


Context log: path="/mypath" Exception in init servlet null
java.lang.NullPointerException
	at com.myorg.myControlServlet.<init>(myControlServlet.java:xxx)
	at java.lang.Class.newInstance0(Native Method)
	at java.lang.Class.newInstance(Class.java, Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.initServlet(ServletWrapper.java,
Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:559)
	at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:160)
	at
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:338
)
	at java.lang.Thread.run(Thread.java:479)
Context log: path="/mypath" Can't find servet ControlServlet

i tried to copy my.jar to all kind of places on my system. i even included a
FileWriter in my code to see where he is excepting my jar ( in the
$TOMCAT_HOME/bin ). it still does not work. the url returned by
etResource( "my.jar" ) is not null ( != null ), but seems to be empty
( "" ).

anyone got an idea?
i would appreciate it very much ( otherwise the other one testing
ServletExec will win and i would have to work with ServletExec :( )

yours

björn

--
Björn Stiegler
mailto: stiegler@topmail.de
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),unpack(c,H)-2,oct(115),10);'


Mime
View raw message