Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
    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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

NoClassDefFoundError

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Report post to moderator
how can I fix this error?
index.html code is
<html>
<head>
<title> weblogic 7 bibleapp </title>
<meta http-equiv="Content-Type" content="text/html">
</head>
<body>
welcome to BibleAPP

<form action="http://localhost:7001/BibleApp/Hello">;
<br> Name: <input type="text" name="stdname" value="pinky" >
<input type="submit" >

</form>

</body>
</html>

my servlet code is :
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class HelloServlet extends HttpServlet
{
public void doGet(HttpServletRequest req,HttpServletResponse resp) throws ServletException,IOException
{
resp.setContentType("text/html");
PrintWriter out = resp.getWriter();
String param = req.getParameter("stdname");
if(param == null )
{
out.println("<html>"+"<body>" + "no parameter"+"</body>" +"</html>");
}
else

out.println(
"<html>"+"<body>"+
"my name is"+ param +"</body>"+
"</html>"
);

}
}

my web.xml code is:

<?xml version="1.0" ?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">;
<web-app>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>

<servlet>
<servlet-name> servlet12 </servlet-name>
<servlet-class> servlet1 </servlet-class>
</servlet>

<servlet-mapping>
<servlet-name> servlet12 </servlet-name>
<url-pattern> /ser </url-pattern>
</servlet-mapping>

<servlet>
<servlet-name> Servlet2 </servlet-name>
<servlet-class>HelloServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name> Servlet2 </servlet-name>
<url-pattern> /Hello </url-pattern>
</servlet-mapping>

</web-app>

I deploy this application is in weblogic 8 platform.
when I click on submit button I got an error messaage:
Error 500--Internal Server Error
java.lang.NoClassDefFoundError: java/lang/StringBuilder
at HelloServlet.doGet(HelloServlet.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1006)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:419)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:315)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6718)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3764)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2644)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)my

why do I get this error message?How can I fix it?
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
  • Report post to moderator
Is the jdk version which the weblogic is using is below 1.5?
I guess yes as StringBuilder is from jdk1.5

While compiling the classes you have used jdk1.5 , but at runtime you are using jdk1.4.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
I think version 1.5xof Java is causing a naming conflict with them.
 
drifter
Posts: 1364
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question multiple times.

Over here I made the same suggestion that you are running into a problem with java versions since StringBuilder was added with java 5.

WebLogic 7.0 supports JDK 1.3/1.4
WebLogic 8.1 supports JDK 1.4
WebLogic 9.x supports JDK 1.5 aka 5

You can check the BEA documentation for yourself at http://edocs.bea.com
 
Every snowflake is perfect and unique. And every snowflake contains a very tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic