You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Faisal <f_...@hotmail.com> on 2007/12/14 14:00:00 UTC
problem in loading class file
Hello,
I can execute the following java code in a standalone application very well
but when i put the same code in a web service and deploy it on the Tomcat
5.5 then it gives error:
exception classNotFoundException: can not find the class
cib.expserver.plugin.basics.ExpressServer
Some one please help me out in this regard.
The code is following:
mport java.io.*;
import java.net.*;
public class WebService {
public byte[] run(byte[] inputFile) throws Exception
{
URL url = new URL("file:/c:Tud/Server/program/bin");
System.out.println("successfully created the url");
URL[] pluginURLs = new URL[1];
pluginURLs[0]=url;
URLClassLoader pluginClassLoader = new
URLClassLoader(pluginURLs);
System.out.println("The class loader has been created successfully ");
String pluginClassName =
"cib.expserver.plugin.basics.ExpressParser";
// The following line of code gives the Exception when run
// under Tomcat but runs fine in a standalone application
Class pluginClass =
pluginClassLoader.loadClass(pluginClassName);
// The following line of code is not executed under Tomcat
System.out.println("successfully loaded the class");
return inputFile;
}
--
View this message in context: http://www.nabble.com/problem-in-loading-class-file-tp14335434p14335434.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: problem in loading class file
Posted by Tim Funk <fu...@joedog.org>.
Try using:
URLClassLoader pluginClassLoader =
new URLClassLoader(pluginURLs,
Thread.currentThread().getContextClassLoader());
-Tim
Faisal wrote:
> Hello,
> I can execute the following java code in a standalone application very well
> but when i put the same code in a web service and deploy it on the Tomcat
> 5.5 then it gives error:
>
> exception classNotFoundException: can not find the class
> cib.expserver.plugin.basics.ExpressServer
>
> Some one please help me out in this regard.
>
> The code is following:
>
> mport java.io.*;
> import java.net.*;
>
> public class WebService {
> public byte[] run(byte[] inputFile) throws Exception
> {
> URL url = new URL("file:/c:Tud/Server/program/bin");
> System.out.println("successfully created the url");
> URL[] pluginURLs = new URL[1];
> pluginURLs[0]=url;
> URLClassLoader pluginClassLoader = new
> URLClassLoader(pluginURLs);
> System.out.println("The class loader has been created successfully ");
> String pluginClassName =
> "cib.expserver.plugin.basics.ExpressParser";
>
> // The following line of code gives the Exception when run
> // under Tomcat but runs fine in a standalone application
> Class pluginClass =
> pluginClassLoader.loadClass(pluginClassName);
> // The following line of code is not executed under Tomcat
> System.out.println("successfully loaded the class");
>
>
> return inputFile;
> }
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: problem in loading class file
Posted by Pid <p...@pidster.com>.
David Smith wrote:
> I mean the path to cib.expserver.plugin.basics.ExpressServer, which your
> tomcat is complaining about not being able to find.
>
> Anyway... taking a closer look at the code you posted, I think the URI
> you are using won't work
>
> file:/c:Tud/Server/program/bin should probably be more like
> file:///c:/Tud/Server/program/bin.
>
> --David
also, where have you put the jar which contains the class
"cib.expserver.plugin.basics.ExpressServer" ?
p
> Faisal wrote:
>
>> Thank you very much for replying. The tomcat version is 5.5 and Java
>> version
>> is 1.5.0_14 and platform is Windows XP.
>>
>> The class is located in webapps/axis/WEB-INF/classes/WebService.class
>>
>> Thanking you,
>> Faisal
>>
>> David Smith-2 wrote:
>>
>>
>>> Hi Faisal.
>>>
>>> Could you post a few very important additional details?
>>>
>>> Tomcat version
>>> Platform
>>> Tomcat relative path to the class/jar you're having trouble with.
>>>
>>> --David
>>>
>>> Faisal wrote:
>>>
>>>
>>>> Hello,
>>>> I can execute the following java code in a standalone application very
>>>>
>> well
>>
>>
>>>> but when i put the same code in a web service and deploy it on the
>>>> Tomcat
>>>> 5.5 then it gives error:
>>>>
>>>> exception classNotFoundException: can not find the class
>>>> cib.expserver.plugin.basics.ExpressServer
>>>>
>>>> Some one please help me out in this regard.
>>>>
>>>> The code is following:
>>>>
>>>> mport java.io.*;
>>>> import java.net.*;
>>>>
>>>> public class WebService {
>>>> public byte[] run(byte[] inputFile) throws Exception
>>>> {
>>>> URL url = new URL("file:/c:Tud/Server/program/bin");
>>>> System.out.println("successfully created the url");
>>>> URL[] pluginURLs = new URL[1];
>>>> pluginURLs[0]=url;
>>>> URLClassLoader pluginClassLoader = new
>>>> URLClassLoader(pluginURLs);
>>>> System.out.println("The class loader has been created successfully ");
>>>> String pluginClassName =
>>>> "cib.expserver.plugin.basics.ExpressParser";
>>>>
>>>> // The following line of code gives the Exception when run
>>>> // under Tomcat but runs fine in a standalone application
>>>> Class pluginClass =
>>>> pluginClassLoader.loadClass(pluginClassName);
>>>> // The following line of code is not executed under Tomcat
>>>> System.out.println("successfully loaded the class");
>>>>
>>>>
>>>> return inputFile;
>>>> }
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To start a new topic, e-mail: users@tomcat.apache.org
>>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>> For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: problem in loading class file
Posted by Faisal <f_...@hotmail.com>.
Thanks David,
I have used this form of the url as well but with the same
result.
Thanks any way,
Faisal
David Smith-2 wrote:
>
> I mean the path to cib.expserver.plugin.basics.ExpressServer, which your
> tomcat is complaining about not being able to find.
>
> Anyway... taking a closer look at the code you posted, I think the URI
> you are using won't work
>
> file:/c:Tud/Server/program/bin should probably be more like
> file:///c:/Tud/Server/program/bin.
>
> --David
>
> Faisal wrote:
>
>>Thank you very much for replying. The tomcat version is 5.5 and Java
version
>>is 1.5.0_14 and platform is Windows XP.
>>
>>The class is located in webapps/axis/WEB-INF/classes/WebService.class
>>
>>Thanking you,
>>Faisal
>>
>>David Smith-2 wrote:
>>
>>
>>>Hi Faisal.
>>>
>>>Could you post a few very important additional details?
>>>
>>>Tomcat version
>>>Platform
>>>Tomcat relative path to the class/jar you're having trouble with.
>>>
>>>--David
>>>
>>>Faisal wrote:
>>>
>>>
>>>
>>>>Hello,
>>>>I can execute the following java code in a standalone application very
>>>>
>>>>
>>well
>>
>>
>>>>but when i put the same code in a web service and deploy it on the
Tomcat
>>>>5.5 then it gives error:
>>>>
>>>>exception classNotFoundException: can not find the class
>>>>cib.expserver.plugin.basics.ExpressServer
>>>>
>>>>Some one please help me out in this regard.
>>>>
>>>>The code is following:
>>>>
>>>>mport java.io.*;
>>>>import java.net.*;
>>>>
>>>>public class WebService {
>>>>public byte[] run(byte[] inputFile) throws Exception
>>>>{
>>>>URL url = new URL("file:/c:Tud/Server/program/bin");
>>>>System.out.println("successfully created the url");
>>>>URL[] pluginURLs = new URL[1];
>>>>pluginURLs[0]=url;
>>>>URLClassLoader pluginClassLoader = new
>>>>URLClassLoader(pluginURLs);
>>>>System.out.println("The class loader has been created successfully ");
>>>>String pluginClassName =
>>>>"cib.expserver.plugin.basics.ExpressParser";
>>>>
>>>>// The following line of code gives the Exception when run
>>>>// under Tomcat but runs fine in a standalone application
>>>>Class pluginClass =
>>>>pluginClassLoader.loadClass(pluginClassName);
>>>>// The following line of code is not executed under Tomcat
>>>>System.out.println("successfully loaded the class");
>>>>
>>>>
>>>>return inputFile;
>>>>}
>>>>
>>>>
>>>>
>>>>
>>>---------------------------------------------------------------------
>>>To start a new topic, e-mail: users@tomcat.apache.org
>>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>>For additional commands, e-mail: users-help@tomcat.apache.org
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/problem-in-loading-class-file-tp14335434p14336136.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: problem in loading class file
Posted by David Smith <dn...@cornell.edu>.
I mean the path to cib.expserver.plugin.basics.ExpressServer, which your
tomcat is complaining about not being able to find.
Anyway... taking a closer look at the code you posted, I think the URI
you are using won't work
file:/c:Tud/Server/program/bin should probably be more like
file:///c:/Tud/Server/program/bin.
--David
Faisal wrote:
>Thank you very much for replying. The tomcat version is 5.5 and Java version
>is 1.5.0_14 and platform is Windows XP.
>
>The class is located in webapps/axis/WEB-INF/classes/WebService.class
>
>Thanking you,
>Faisal
>
>David Smith-2 wrote:
>
>
>>Hi Faisal.
>>
>>Could you post a few very important additional details?
>>
>>Tomcat version
>>Platform
>>Tomcat relative path to the class/jar you're having trouble with.
>>
>>--David
>>
>>Faisal wrote:
>>
>>
>>
>>>Hello,
>>>I can execute the following java code in a standalone application very
>>>
>>>
>well
>
>
>>>but when i put the same code in a web service and deploy it on the Tomcat
>>>5.5 then it gives error:
>>>
>>>exception classNotFoundException: can not find the class
>>>cib.expserver.plugin.basics.ExpressServer
>>>
>>>Some one please help me out in this regard.
>>>
>>>The code is following:
>>>
>>>mport java.io.*;
>>>import java.net.*;
>>>
>>>public class WebService {
>>>public byte[] run(byte[] inputFile) throws Exception
>>>{
>>>URL url = new URL("file:/c:Tud/Server/program/bin");
>>>System.out.println("successfully created the url");
>>>URL[] pluginURLs = new URL[1];
>>>pluginURLs[0]=url;
>>>URLClassLoader pluginClassLoader = new
>>>URLClassLoader(pluginURLs);
>>>System.out.println("The class loader has been created successfully ");
>>>String pluginClassName =
>>>"cib.expserver.plugin.basics.ExpressParser";
>>>
>>>// The following line of code gives the Exception when run
>>>// under Tomcat but runs fine in a standalone application
>>>Class pluginClass =
>>>pluginClassLoader.loadClass(pluginClassName);
>>>// The following line of code is not executed under Tomcat
>>>System.out.println("successfully loaded the class");
>>>
>>>
>>>return inputFile;
>>>}
>>>
>>>
>>>
>>>
>>---------------------------------------------------------------------
>>To start a new topic, e-mail: users@tomcat.apache.org
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>>
>>
>>
>
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: problem in loading class file
Posted by Faisal <f_...@hotmail.com>.
Thank you very much for replying. The tomcat version is 5.5 and Java version
is 1.5.0_14 and platform is Windows XP.
The class is located in webapps/axis/WEB-INF/classes/WebService.class
Thanking you,
Faisal
David Smith-2 wrote:
>
> Hi Faisal.
>
> Could you post a few very important additional details?
>
> Tomcat version
> Platform
> Tomcat relative path to the class/jar you're having trouble with.
>
> --David
>
> Faisal wrote:
>
>>Hello,
>>I can execute the following java code in a standalone application very
well
>>but when i put the same code in a web service and deploy it on the Tomcat
>>5.5 then it gives error:
>>
>>exception classNotFoundException: can not find the class
>>cib.expserver.plugin.basics.ExpressServer
>>
>>Some one please help me out in this regard.
>>
>>The code is following:
>>
>>mport java.io.*;
>>import java.net.*;
>>
>>public class WebService {
>>public byte[] run(byte[] inputFile) throws Exception
>>{
>>URL url = new URL("file:/c:Tud/Server/program/bin");
>>System.out.println("successfully created the url");
>>URL[] pluginURLs = new URL[1];
>>pluginURLs[0]=url;
>>URLClassLoader pluginClassLoader = new
>>URLClassLoader(pluginURLs);
>>System.out.println("The class loader has been created successfully ");
>>String pluginClassName =
>>"cib.expserver.plugin.basics.ExpressParser";
>>
>>// The following line of code gives the Exception when run
>>// under Tomcat but runs fine in a standalone application
>>Class pluginClass =
>>pluginClassLoader.loadClass(pluginClassName);
>>// The following line of code is not executed under Tomcat
>>System.out.println("successfully loaded the class");
>>
>>
>>return inputFile;
>>}
>>
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/problem-in-loading-class-file-tp14335434p14335821.html
Sent from the Tomcat - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: problem in loading class file
Posted by David Smith <dn...@cornell.edu>.
Hi Faisal.
Could you post a few very important additional details?
Tomcat version
Platform
Tomcat relative path to the class/jar you're having trouble with.
--David
Faisal wrote:
>Hello,
>I can execute the following java code in a standalone application very well
>but when i put the same code in a web service and deploy it on the Tomcat
>5.5 then it gives error:
>
>exception classNotFoundException: can not find the class
>cib.expserver.plugin.basics.ExpressServer
>
>Some one please help me out in this regard.
>
>The code is following:
>
>mport java.io.*;
>import java.net.*;
>
>public class WebService {
>public byte[] run(byte[] inputFile) throws Exception
>{
>URL url = new URL("file:/c:Tud/Server/program/bin");
>System.out.println("successfully created the url");
>URL[] pluginURLs = new URL[1];
>pluginURLs[0]=url;
>URLClassLoader pluginClassLoader = new
>URLClassLoader(pluginURLs);
>System.out.println("The class loader has been created successfully ");
>String pluginClassName =
>"cib.expserver.plugin.basics.ExpressParser";
>
>// The following line of code gives the Exception when run
>// under Tomcat but runs fine in a standalone application
>Class pluginClass =
>pluginClassLoader.loadClass(pluginClassName);
>// The following line of code is not executed under Tomcat
>System.out.println("successfully loaded the class");
>
>
>return inputFile;
>}
>
>
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org