aspose file tools*
The moose likes Spring and the fly likes Spring Tomcat Application - Startup Problems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Spring Tomcat Application - Startup Problems" Watch "Spring Tomcat Application - Startup Problems" New topic
Author

Spring Tomcat Application - Startup Problems

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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?

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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 Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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 Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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 Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

So here it is with the context.xml added to the META-INF folder of my webapp:

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

Any suggestions guys? It seems perplexing to me to get this one solved.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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 Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

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 Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

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
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

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 Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

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 Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9502
    
    2

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
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spring Tomcat Application - Startup Problems