• 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

tomcat servlet deployment on a mac

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tomcat 6 does not support annotations.
 
Edward Young
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic