You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Björn Wilmsmann <bj...@wilmsmann.de> on 2008/01/29 00:39:32 UTC
Config file not found in class path when deploying WAR
Hello everybody,
I have run into a rather weird problem that occurs when deploying a
web app - which by the way is a Grails (http://grails.codehaus.org)
app - as a WAR file in Tomcat. My app makes use of Nutch and
instantiates a NutchDocumentAnalyzer during startup as a Spring
resource. The Nutch classes and config files are loaded from a JAR
inside the lib directory of the app.
All of this works fine when running the app via the 'grails run-app'
command supplied by Grails. However, when running the app under Tomcat
from a WAR I get the following stacktrace (excerpt):
Caused by: org.springframework.beans.BeanInstantiationException: Could
not instantiate bean class
[org.apache.nutch.analysis.NutchDocumentAnalyzer]: Constructor threw
exception; nested exception is java.lang.NullPointerException
at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:98)
at
org
.springframework
.beans
.factory
.support
.SimpleInstantiationStrategy
.instantiate(SimpleInstantiationStrategy.java:87)
at
org
.springframework
.beans
.factory
.support
.ConstructorResolver.autowireConstructor(ConstructorResolver.java:233)
... 63 more
Caused by: java.lang.NullPointerException
at java.io.Reader.<init>(Reader.java:61)
at java.io.BufferedReader.<init>(BufferedReader.java:76)
at java.io.BufferedReader.<init>(BufferedReader.java:91)
at org.apache.nutch.analysis.CommonGrams.init(CommonGrams.java:152)
at org.apache.nutch.analysis.CommonGrams.<init>(CommonGrams.java:52)
at org.apache.nutch.analysis.NutchDocumentAnalyzer
$ContentAnalyzer.<init>(NutchDocumentAnalyzer.java:64)
at
org
.apache
.nutch
.analysis.NutchDocumentAnalyzer.<init>(NutchDocumentAnalyzer.java:55)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun
.reflect
.NativeConstructorAccessorImpl
.newInstance(NativeConstructorAccessorImpl.java:39)
at
sun
.reflect
.DelegatingConstructorAccessorImpl
.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:83)
... 65 more
This is caused by the common-terms.utf8 file not being found in line
152 of org.apache.nutch.analysis.CommonGrams. However, this file is
located on the root level of the nutch.jar in the lib directory that
also contains the classes themselves. I have also tried copying the
file to TOMCAT/webapps/MY_APP/WEB-INF/classes, TOMCAT/webapps/MY_APP/
WEB-INF/ and TOMCAT/webapps/MY_APP/WEB-INF/lib, all to no avail.
Does anybody have an idea what this could possibly be caused by?
--
Best regards,
Bjoern Wilmsmann
---------------------------------------------------------------------
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: Config file not found in class path when deploying WAR
Posted by Björn Wilmsmann <bj...@wilmsmann.de>.
David Smith work:
> Then I think the path to your common-terms.utf8 probably should be /
> common-terms.utf8 in the config file. Otherwise the path spec is
> relative and it's hard to figure out what it's relative to. The
> hadoop class that generates the reader uses
> Classloader.getResource( path ) so an absolute path isn't absolute
> on the file system, but absolute in the jars or WEB-INF/classes
> directory.
I've tried changing the path to /common-terms.utf8 now.
Unfortunately, it didn't work either.
--
Best regards,
Bjoern Wilmsmann
Re: Config file not found in class path when deploying WAR
Posted by David Smith <dn...@cornell.edu>.
Then I think the path to your common-terms.utf8 probably should be
/common-terms.utf8 in the config file. Otherwise the path spec is
relative and it's hard to figure out what it's relative to. The hadoop
class that generates the reader uses Classloader.getResource( path ) so
an absolute path isn't absolute on the file system, but absolute in the
jars or WEB-INF/classes directory.
--David
Björn Wilmsmann wrote:
> Hi David,
>
> thanks for the advice. In my nutch-0.9.jar common-terms.utf8 is
> located at the root level, but then again, I've built the JAR from
> source.
>
> David Smith wrote:
>
>> Funny ... I downloaded the 0.9 release of nutch and common-terms.utf8
>> is not in the nutch.jar file (just to be helpful -- I don't actually
>> use it). I couldn't find common-terms.utf8 anywhere in the .jar
>> file. I would recommend asking on a nutch user list and be specific
>> with regard to what version you are using. Mailing lists for nutch
>> can be found at http://lucene.apache.org/nutch/mailing_lists.html
>
> --
> Best regards,
> Bjoern Wilmsmann
>
>
>
---------------------------------------------------------------------
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: Config file not found in class path when deploying WAR
Posted by Björn Wilmsmann <bj...@wilmsmann.de>.
Hi David,
thanks for the advice. In my nutch-0.9.jar common-terms.utf8 is
located at the root level, but then again, I've built the JAR from
source.
David Smith wrote:
> Funny ... I downloaded the 0.9 release of nutch and common-
> terms.utf8 is not in the nutch.jar file (just to be helpful -- I
> don't actually use it). I couldn't find common-terms.utf8 anywhere
> in the .jar file. I would recommend asking on a nutch user list and
> be specific with regard to what version you are using. Mailing
> lists for nutch can be found at http://lucene.apache.org/nutch/mailing_lists.html
--
Best regards,
Bjoern Wilmsmann
Re: Config file not found in class path when deploying WAR
Posted by David Smith <dn...@cornell.edu>.
Funny ... I downloaded the 0.9 release of nutch and common-terms.utf8 is
not in the nutch.jar file (just to be helpful -- I don't actually use
it). I couldn't find common-terms.utf8 anywhere in the .jar file. I
would recommend asking on a nutch user list and be specific with regard
to what version you are using. Mailing lists for nutch can be found at
http://lucene.apache.org/nutch/mailing_lists.html
--David
Björn Wilmsmann wrote:
> Hello everybody,
>
> I have run into a rather weird problem that occurs when deploying a
> web app - which by the way is a Grails (http://grails.codehaus.org)
> app - as a WAR file in Tomcat. My app makes use of Nutch and
> instantiates a NutchDocumentAnalyzer during startup as a Spring
> resource. The Nutch classes and config files are loaded from a JAR
> inside the lib directory of the app.
> All of this works fine when running the app via the 'grails run-app'
> command supplied by Grails. However, when running the app under Tomcat
> from a WAR I get the following stacktrace (excerpt):
>
> Caused by: org.springframework.beans.BeanInstantiationException: Could
> not instantiate bean class
> [org.apache.nutch.analysis.NutchDocumentAnalyzer]: Constructor threw
> exception; nested exception is java.lang.NullPointerException
> at
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:98)
> at
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87)
>
> at
> org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:233)
>
> ... 63 more
> Caused by: java.lang.NullPointerException
> at java.io.Reader.<init>(Reader.java:61)
> at java.io.BufferedReader.<init>(BufferedReader.java:76)
> at java.io.BufferedReader.<init>(BufferedReader.java:91)
> at org.apache.nutch.analysis.CommonGrams.init(CommonGrams.java:152)
> at org.apache.nutch.analysis.CommonGrams.<init>(CommonGrams.java:52)
> at
> org.apache.nutch.analysis.NutchDocumentAnalyzer$ContentAnalyzer.<init>(NutchDocumentAnalyzer.java:64)
>
> at
> org.apache.nutch.analysis.NutchDocumentAnalyzer.<init>(NutchDocumentAnalyzer.java:55)
>
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>
> at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> at
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:83)
> ... 65 more
>
> This is caused by the common-terms.utf8 file not being found in line
> 152 of org.apache.nutch.analysis.CommonGrams. However, this file is
> located on the root level of the nutch.jar in the lib directory that
> also contains the classes themselves. I have also tried copying the
> file to TOMCAT/webapps/MY_APP/WEB-INF/classes,
> TOMCAT/webapps/MY_APP/WEB-INF/ and TOMCAT/webapps/MY_APP/WEB-INF/lib,
> all to no avail.
>
> Does anybody have an idea what this could possibly be caused by?
>
> --
> Best regards,
> Bjoern Wilmsmann
>
>
>
>
> ---------------------------------------------------------------------
> 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