troubleshooting Question

class not found exception

Avatar of priyapratheep
priyapratheep asked on
JavaJSPJava EE
33 Comments1 Solution1707 ViewsLast Modified:
i have one jsp program when i run that program i am getting error of class not found exception...

all classes are there and when i run the program as stand alone java program it is working fine.i ried to call from a jsp or as a jsp program i am getting following error'


javax.servlet.ServletException
      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:848)
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
      org.apache.jsp.bar15_jsp._jspService(org.apache.jsp.bar15_jsp:118)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


root cause

java.lang.NoClassDefFoundError
      mySAP.SapConnectionBean.getSAPConnection(SapConnectionBean.java:23)
      org.apache.jsp.bar15_jsp._jspService(org.apache.jsp.bar15_jsp:61)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

my program
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%>
<%@page language="java"
      import="java.sql.*,java.io.*,mySAP.*,java.net.URL;"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%
out.println("Starts");
      try {
            
            SapConnectionBean mysap = new SapConnectionBean();
            com.sap.mw.jco.JCO.Client client = mysap.getSAPConnection();
            com.sap.mw.jco.JCO.Repository mRepository = new com.sap.mw.jco.JCO.Repository(
                        "ARAsoft", client);

            StringBuffer stringbuffer = new StringBuffer();

            com.sap.mw.jco.JCO.Function function = mysap.createFunction(
                        mRepository, "Z_BC_LABEL");

            out.println("SUCC YOU GOT CONN");
            com.sap.mw.jco.JCO.Table  tableList = function.getTableParameterList().getTable("ZBAR");
             
            String s3 = "\t";
            
            stringbuffer.append("vbeln" + s3);
            stringbuffer.append("uecha" + s3);
            stringbuffer.append("kdmat" + s3);
            stringbuffer.append("lifmg" + s3);
            stringbuffer.append("bstkd" + s3);
            stringbuffer.append("groes" + s3);
            stringbuffer.append("name1" + s3);
            stringbuffer.append("lfdat" + s3);

            stringbuffer.append("posnr" + s3);
            stringbuffer.append("lifmg  bstkd " + "\n");
            //stringbuffer.append("\t");
            
      if (tableList.getNumRows() > 0)
                  do {
                        com.sap.mw.jco.JCO.Field tabField;
                        for (com.sap.mw.jco.JCO.FieldIterator fI = tableList.fields(); fI.hasMoreElements();
                        
                        stringbuffer.append(tabField.getString()+ s3))
                        {  
                              tabField = fI.nextField();
                        }

                        stringbuffer.append("\n");
                  } while (tableList.nextRow());
            else
                  System.out.println("sorry no records...better luck next time");
      out.println(stringbuffer);
            
            
      } catch (Exception e) {
            out.println("error" + e);
      }

%>
</body>
</html>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 33 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 33 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros