• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Spring Tomcat Application - Startup Problems

 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I have an application built using Spring / Struts / Tomcat and uses Maven to build it. When I tried to build my app using the Maven Tomcat plugin by issuing the following command,



I get the following error:


I thought that it might have been because of the mising jars which I explicitly added as a lib folder in my web app. But even then the problem persists. Any suggestions?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This does not seem to happen when I build the project as mvn clean install and deploy to Tomcat. Any ideas? I would like to know the cause of a NamespaceHandlerException as in the case above with respect to spring.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
After adding all the necessary jars to the lib folder of my web app source structure (which would be done in the resulting war file automagically by Maven when I build the project), I managed to get rid of the error above. But now getting a new one as below:


Any ideas on what could this mean?
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no such reference to any properties file in any of my applicationContext-xxx.xml file. I really do not know from where it references this. For he sake of getting rid of this error, I had to provide a dummy one and now facing another error as below:



It looks like I need to have the TomcatInstrumentableClassLoader in my classpath but when I added it to my lib folder of my webapp it gave me a class not found exception.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So here it is with the context.xml added to the META-INF folder of my webapp:

 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any suggestions guys? It seems perplexing to me to get this one solved.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using the Spring instrumentation jars? That is always fun trying to get all the jars that you need and you need a bunch of them. Especially since they aren't in a Maven repository to get, you have to download them and make sure they all get copied into your war file.

It looks like some of those jars aren't in your classpath.

Mark
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you mean that the jar file (spring-tomcat-weaver.jar) should be placed in the system classpath so that when I execute mvn from the command line it is available automatically? So far I have been trying to place it under the lib folder of my Tomcat but looks like it does not make any sense as the mvn tomcat:run creates an embedded Tomcat with its own set of folder structure and filles in the target folder. So placing the jar file in the Tomcat folder did not work. I would now try to add this jar to the path entry and see if it works.
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I assumne that mvn tomcat:run first creates an embedded Tomcat in my target folder and then deploys my web app but even if the jar is present in the lib folder of my webapp it first needs the TomcatInstrumentableClassLoader to load the classes in first place.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was more saying include that jar in your war file. The deployment file in your WEB-INF/lib directory. If you are truly using them.

Mark
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark Spritzler wrote:I was more saying include that jar in your war file. The deployment file in your WEB-INF/lib directory. If you are truly using them.

Mark



It is included but even then I get this Class not found exception.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joe Harry wrote:

Mark Spritzler wrote:I was more saying include that jar in your war file. The deployment file in your WEB-INF/lib directory. If you are truly using them.

Mark



It is included but even then I get this Class not found exception.



And it is one of the jars listed here?

http://www.findjar.com/class/org/springframework/instrument/classloading/tomcat/TomcatInstrumentableClassLoader.html

Thanks

Mark
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also just found this, maybe it has to be in the Tomcat lib directory.

http://stackoverflow.com/questions/4615164/java-lang-classnotfoundexception-org-springframework-instrument-classloading-tom

Mark
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess the problem lies with the mvn tomcat:run maven goal. When I use mvn clean:install and deploy my app to Tomcat, I have no problems. As you mentioned in your post above I have included the spring-tomcat weaver jar in the Tomcat's lib folder. The problem here is that when I say mvn tomcat:run, it creates an embedded Tomcat container in my target folder and it tries to load the files from there and it is here where it is not able to find the speing-tomcat weaver jar. I have tried all possible ways. I tired putting the jar in my classpath but no use.
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joe Harry wrote:I guess the problem lies with the mvn tomcat:run maven goal. When I use mvn clean:install and deploy my app to Tomcat, I have no problems. As you mentioned in your post above I have included the spring-tomcat weaver jar in the Tomcat's lib folder. The problem here is that when I say mvn tomcat:run, it creates an embedded Tomcat container in my target folder and it tries to load the files from there and it is here where it is not able to find the speing-tomcat weaver jar. I have tried all possible ways. I tired putting the jar in my classpath but no use.



Yeah, I never run Tomcat through Maven. I like being in manual control over Tomcat. So I run MVN to create the war file, then I either have a batch script that will copy that file to my TOmcat directory. Or I have my context.xml in Tomcat point to the file directly in the target directory, so no copying needed.

Usually though, the CATALINA_BASE stays on the Tomcat directory even with an "embedded Tomcat" so in the CATALINA_BASE lib directory even the embedded Tomcats would load those jars.

Mark
 
Joe San
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mark Spritzler wrote:

Joe Harry wrote:

Usually though, the CATALINA_BASE stays on the Tomcat directory even with an "embedded Tomcat" so in the CATALINA_BASE lib directory even the embedded Tomcats would load those jars.

Mark



I did not quite get this. You mean to say I should set the CATALINA_BASE or TOMCAT_HOME to point to my embedded Tomcat directory?

 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Joe Harry wrote:I did not quite get this. You mean to say I should set the CATALINA_BASE or TOMCAT_HOME to point to my embedded Tomcat directory?



No not at all, I am saying that CATALINA_BASE always points to your Tomcat installation directory, and CATALINA_HOME would point to the embedded Tomcat directory.

Mark
 
reply
    Bookmark Topic Watch Topic
  • New Topic