- This topic has 3 replies, 3 voices, and was last updated 18 years, 11 months ago by Ghazalawahid.
-
AuthorPosts
-
GhazalawahidMemberHi,
I am trying to access a servlet from a html page in a Web project.
(Using Tomcat 5 as app server)
1) Project name is userregistration.
2) Servlet name is displayname which is in a package userpackage under src folder.
3) HTML file name is welcome which is accessing a servlet when submit button is clicked. The command for accessing servlet is :FORM ACTION = “displayusername” method = post
WEB-INF/web.xml setting is :
<servlet>
<description>This is the description of my J2EE component</description>
<display-name>This is the display name of my J2EE component</display-name>
<servlet-name>Displayusername</servlet-name>
<servlet-class>userservlets.displayname</servlet-class>
</servlet><servlet-mapping>
<servlet-name>Displayusername</servlet-name>
<url-pattern>/displayusername</url-pattern>
</servlet-mapping></web-app>
The problem is when I press save buttom in html form ,it gives message “Internal server error” in browser.
The log for the localhost in Tomcat server says :
SEVERE: Allocate exception for servlet Displayusername
java.lang.UnsupportedClassVersionError: userservlets/displayuser (Unsupported major.minor version 49.0)Am i missing any setting regarding classpath in MyEclipse environment?Because i have not updated anything in Eclipse/MyEclipse after installation.
Thanks.
GregMemberSEVERE: Allocate exception for servlet Displayusername
java.lang.UnsupportedClassVersionError: userservlets/displayuser (Unsupported major.minor version 49.0)This is a Java5 vs Java1.4.X problem. What version of Tomcat are you using? I believe if you are wanting to develop/deploy with java5 you must use Tomcat 5.5. Give that a try if you are using Tomcat5.0.x at the moment.
Riyad KallaMemberMoving to OT > Soft Dev
Greg is right, the problem seems like you are compiling your code with Java5 support enabled, then running it under Tomcat with JDK 1.4, and the 1.4 VM is barfing on it “I don’t understand this, wrong bytecode version”.
GhazalawahidMemberThanks a lot guys for all your support.
As I changed the jdk version from 4 to 5 ,it found the servlet .
Thanks again.
-
AuthorPosts