You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@wink.apache.org by bharathchinnadurai <bh...@gmail.com> on 2010/01/21 05:35:15 UTC
ClassNotFoundException & Class.forName
Hi All,
I am facing a very strange issue for quiet some time and have been doing
some work around in wink common/server or classpath settings.
When RestServlet is initialized I am getting the following error,
1095 [http-8080-1] ERROR
org.apache.wink.common.internal.application.ApplicationFileLoader -
com.test.TestResource is not a class. Ignoring.
The above message is because of a ClassNotFoundException thrown from
ApplicationFileLoader when it tries to load the resource classes defined in
the 'application' property file.
I am getting this issue in both Tomcat and WAS 6.1
Below is the source code which tries to load the resource classes,
//ApplicationFileLoader.java
...
Class<?> cls = null;
try {
cls = Class.forName(line);
....
I can get it working by modifying the above to,
//ApplicationFileLoader.java
...
Class<?> cls = null;
try {
cls =
Thread.currentThread().getContextClassLoader().loadClass(line);
....
The difference is in the class loaders used. In the later case the class
loader used is tomcats, WebappClassLoader were as in the former case it is
some default class loader. I guess WebappClassLoader knows where exactly to
look for its classes (/WEB-INF/classes) while the other doesnt, and requires
me to manually set the class path entry.
This is the same case where ever Class.forName is used in wink codebase.
RestServlet reads the deploymentConfiguration init param to load the handler
configuration class which againg throws CNFException.
PS:
I am also surprised how its only me who is facing this issue :), correct me
if i am missing some thing here.
--
View this message in context: http://n2.nabble.com/ClassNotFoundException-Class-forName-tp4431734p4431734.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.
Re: ClassNotFoundException & Class.forName
Posted by Michael Elman <el...@apache.org>.
I'm guessing that you put Wink in either common or shared folder of Tomcat.
Thus Class.forName classloader, that Wink uses, isn't aware of your web
application (war).
The easiest solution is putting Wink inside of your war.
On Thu, Jan 21, 2010 at 6:35 AM, bharathchinnadurai <
bharathchinnadurai@gmail.com> wrote:
> Hi All, I am facing a very strange issue for quiet some time and have been
> doing some work around in wink common/server or classpath settings. When
> RestServlet is initialized I am getting the following error, *1095
> [http-8080-1] ERROR
> org.apache.wink.common.internal.application.ApplicationFileLoader -
> com.test.TestResource is not a class. Ignoring.* The above message is
> because of a ClassNotFoundException thrown from ApplicationFileLoader when
> it tries to load the resource classes defined in the 'application' property
> file. I am getting this issue in both Tomcat and WAS 6.1 Below is the source
> code which tries to load the resource classes, *//ApplicationFileLoader.java ... Class cls = null; try { cls =
> Class.forName(line); ....* I can get it working by modifying the above to,
> * //ApplicationFileLoader.java ... Class cls = null; try { cls =
> Thread.currentThread().getContextClassLoader().loadClass(line); ....* The
> difference is in the class loaders used. In the later case the class loader
> used is tomcats, WebappClassLoader were as in the former case it is some
> default class loader. I guess WebappClassLoader knows where exactly to look
> for its classes (/WEB-INF/classes) while the other doesnt, and requires me
> to manually set the class path entry. This is the same case where ever
> Class.forName is used in wink codebase. RestServlet reads the
> deploymentConfiguration init param to load the handler configuration class
> which againg throws CNFException. PS: I am also surprised how its only me
> who is facing this issue :), correct me if i am missing some thing here.
> ------------------------------
> View this message in context: ClassNotFoundException & Class.forName<http://n2.nabble.com/ClassNotFoundException-Class-forName-tp4431734p4431734.html>
> Sent from the Apache Wink Users mailing list archive<http://n2.nabble.com/Apache-Wink-Users-f3471013.html>at Nabble.com.
>
Re: ClassNotFoundException & Class.forName
Posted by bharathchinnadurai <bh...@gmail.com>.
Yes,
I am looking forward for fixes of jira 226, 227 and 243 which i was hoping
to be available with release 1.1.
--
View this message in context: http://n2.nabble.com/ClassNotFoundException-Class-forName-tp4431734p4458846.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.
Re: ClassNotFoundException & Class.forName
Posted by Bryant Luk <br...@gmail.com>.
I would like to get to JAX-RS 1.1 full compliance for 1.1 at the least
to make the version numbers align I think we should also get the
basic JSR-250 stuff in.
Are there any features that you would like to see?
On Sat, Jan 23, 2010 at 10:32 PM, bharathchinnadurai
<bh...@gmail.com> wrote:
>
> Thanks bryant,
> I applied the patches 226 & 227 and that resolved the issue.
>
> BTW, any idea when 1.1 will be out officially?
> --
> View this message in context: http://n2.nabble.com/ClassNotFoundException-Class-forName-tp4431734p4448067.html
> Sent from the Apache Wink Users mailing list archive at Nabble.com.
>
Re: ClassNotFoundException & Class.forName
Posted by bharathchinnadurai <bh...@gmail.com>.
Thanks bryant,
I applied the patches 226 & 227 and that resolved the issue.
BTW, any idea when 1.1 will be out officially?
--
View this message in context: http://n2.nabble.com/ClassNotFoundException-Class-forName-tp4431734p4448067.html
Sent from the Apache Wink Users mailing list archive at Nabble.com.
Re: ClassNotFoundException & Class.forName
Posted by Bryant Luk <br...@gmail.com>.
Hi,
I believe Mike fixed this in
https://issues.apache.org/jira/browse/WINK-226 and
https://issues.apache.org/jira/browse/WINK-227 but if this is a
different issue, please let us know.
On Wed, Jan 20, 2010 at 10:35 PM, bharathchinnadurai
<bh...@gmail.com> wrote:
> Hi All, I am facing a very strange issue for quiet some time and have been
> doing some work around in wink common/server or classpath settings. When
> RestServlet is initialized I am getting the following error, 1095
> [http-8080-1] ERROR
> org.apache.wink.common.internal.application.ApplicationFileLoader -
> com.test.TestResource is not a class. Ignoring. The above message is because
> of a ClassNotFoundException thrown from ApplicationFileLoader when it tries
> to load the resource classes defined in the 'application' property file. I
> am getting this issue in both Tomcat and WAS 6.1 Below is the source code
> which tries to load the resource classes, //ApplicationFileLoader.java ...
> Class cls = null; try { cls = Class.forName(line); .... I can get it working
> by modifying the above to, //ApplicationFileLoader.java ... Class cls =
> null; try { cls =
> Thread.currentThread().getContextClassLoader().loadClass(line); .... The
> difference is in the class loaders used. In the later case the class loader
> used is tomcats, WebappClassLoader were as in the former case it is some
> default class loader. I guess WebappClassLoader knows where exactly to look
> for its classes (/WEB-INF/classes) while the other doesnt, and requires me
> to manually set the class path entry. This is the same case where ever
> Class.forName is used in wink codebase. RestServlet reads the
> deploymentConfiguration init param to load the handler configuration class
> which againg throws CNFException. PS: I am also surprised how its only me
> who is facing this issue :), correct me if i am missing some thing here.
> ________________________________
> View this message in context: ClassNotFoundException & Class.forName
> Sent from the Apache Wink Users mailing list archive at Nabble.com.
>