aspose file tools*
The moose likes Tomcat and the fly likes tomcat servlet deployment on a mac Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "tomcat servlet deployment on a mac" Watch "tomcat servlet deployment on a mac" New topic
Author

tomcat servlet deployment on a mac

Edward Young
Greenhorn

Joined: Jan 21, 2011
Posts: 6
I wrote a java servlet and the webpage which accesses them using Eclipse and tomcat 7 compiled in java 1.6. I love how the latest servlet spec allows you to use annotation and buypass the need for web.xml. My servlet contains the following line to tell tomcat about itself:



But now comes the painful part: deployment. I have a Mac 10.5 Server with tomcat 6 running on it. When I first made the war file, I dumped it into the webapp directory and it unpacked (autodeploy is set to true) and yet when I went to access the url, it gave me first some 404 errors and then later on some 503 errors. After deleteing and redploying things several times now to try and get it right, it no longer autodeploys when I put the war file in.

So how do I get Tomcat to see this servlet and host it on this mac server?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Tomcat 6 does not support annotations.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Edward Young
Greenhorn

Joined: Jan 21, 2011
Posts: 6
Yes, I'm aware of that. I mentioned that merely so that you would know I did not have it set up originally with a web.xml file.

I did write one after the fact, but it's been a while since I've done anything with tomcat so I may have gotten it wrong:



The classes are located in my WEB-INF/classes directory. When I deployed I got the following errors:

WARNING: Error while removing context [/MyApp]
java.lang.NullPointerException ContainerBase.java:915 (removeChild)
WARNING: Error during context [/MyApp] destroy
java.lang.NullPointerException HostConfig.java:1180 (checkResources)
java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class serv.Authenticate)
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class serv.Authenticate)

This means that you compiled the class with a later version of Java than is being used to execute.

You should be developing in an identical environment to which you are deploying.
Edward Young
Greenhorn

Joined: Jan 21, 2011
Posts: 6
Bear Bibeault wrote:
java.lang.UnsupportedClassVersionError: Bad version number in .class file (unable to load class serv.Authenticate)

This means that you compiled the class with a later version of Java than is being used to execute.


Java 1.6 = Java 1.6

Sorry I forgot to mention that. They are the same.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

The JRE disagrees with you. The Tomcat Manager list page will show the version of the JRE Tomcat is using, what does it say?
Edward Young
Greenhorn

Joined: Jan 21, 2011
Posts: 6
Actually, I chased this rabbit before making my original post. I compiled it in Java 1.5 when I saw the bad version number and it still choked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: tomcat servlet deployment on a mac