Hello, I am trying to deploy Servlet in Websphere Application Server V4.0 AES.I created MyServlet.ear using AAT.Created Servlet web component.I have added only one servlet.Context root is /webapp/MyServlet.In Servlet mapping URL Pattern is /MyServlet.I installed the Application.When I try to view MyServlet using http://localhost:9080/webapp/MyServlet/MyServlet I am getting following error. Error 500: Failed to load target servlet [MyServlet] In the log file it is saying Failed to load servlet�java.lang.NoClassDefFoundError: MyServlet (wrong name: webapp/MyServlet)Can anybody please help in solving this? Your help is greatly appreciated.
I'm sorry, but I can't recommend you follow Bhiku's idea -- it doesn't solve the real problem, which is that your EAR (and WAR) are somehow misconstructed. Make sure you did the following: (1) That you really included the .class file inside the WAR file (it's easy to forget that step -- often you select the file and forget to hit "add" in the add new file dialog) (2) That the fully-qualified class name in the web.xml file matches the fully-qualified class name of your servlet. Kyle
Hi, I have added MyServlet.claass while creating WAR file.My class file was in c:\data\classes.I chose this as root directory when I created WAR file.I can see this in AAT when I go to webmodules>MyServlet>class>Files>class Files. Name: MyServlet.class path:WEB-INF/classes. MyServlet.class is in wbsphere\Appserver\installedapps\MyServlet.ear\MyServlet.war\WEB-INF\classes\MyServlet.class. web.xml is <?xml version="1.0" encoding="UTF-8"?> < !DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd"> <web-app id="WebApp_ID"> <display-name>MyServlet</display-name> <servlet id="Servlet_1"> <servlet-name>MyServlet</servlet-name> <display-name>MyServlet</display-name> <servlet-class>MyServlet</servlet-class> </servlet> <servlet-mapping id="ServletMapping_1"> <servlet-name>MyServlet</servlet-name> <url-pattern>/MyServlet</url-pattern> </servlet-mapping> </web-app> I am new to websphere.What else I need to add?
posted 17 years ago
This is going to sound odd, but we've seen strange problems when you place classes in the default package -- the classloaders don't seem to like them very much. Please try putting your servlet in a package, then updating the web.xml and the class location with the new information. Kyle