• Post Reply Bookmark Topic Watch Topic
  • New Topic

URGENT:unable to compile class for JSP:Error  RSS feed

 
karthik mahalingam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
i tried to create a EJB component(Entity Bean)and deploy it in the J2EE APP SERVER....
the deployment process is a success...
when i tried to run my client program written in JSP i get the following
error:
---------------------------
org.apache.jasper.JasperException:Unable to compile class for JSP

No java compiler was found to compile the generated source for the JSP
This can usually be solved by copying manually $JAVA_HOME/lib/tools.jar from the JDK to the common/lib directory of the TOMCAT server.....
---------------------------

i have also tried the procedure given above i.e.,by copying the tools.jar to the specified location but still i am getting the same error ...

my client program is:
---------------------------
<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="javax.ejb.*" %>
<%@page import="javax.naming.*" %>
<%@page import="javax.naming.InitialContext" %>
<%@page import="javax.rmi.PortableRemoteObject" %>
<%@page import="java.rmi.RemoteException" %>
<%@page import="Account" %>
<%@page import="AccountHome" %>




<%!
private Account account=null;

public void jspInit()
{

try
{
String name=request.getParameter("name");
String id=request.getParameter("id");

InitialContext initial=new InitialContext();
Object obj=initial.lookup("java:comp/env/ejb/AccountJSP");
AccountHome accountHome=(AccountHome)PortableRemoteObject.narrow(obj,AccountHome.class);

account=accountHome.create(name,id);



} catch (RemoteException ex) {
System.out.println("RemoteException: Couldn't create Account bean."+ ex.getMessage());
} catch (CreateException ex) {
System.out.println("CreateException: Couldn't create Account bean."+ ex.getMessage());
} catch (NamingException ex) {
System.out.println("Unable to lookup home: "+ "AccountHome "+ ex.getMessage());
} catch(Exception ex) {
System.out.println("Exception:"+ex.getMessage()); }
}

public void jspDestroy() {
account= null;
}

%>

<html>
<head><title>Account Insert JSP Page</title></head>
<body>
<form method="get">
<table border='0'>
<tr>
<td>Enter Name:</td><td><input type="text" name="name"></td>
</tr>
<tr>
<td>Enter Id:</td><td><input type="text" name="id"></td>
</tr>
<tr>
<td><input type="submit" value="Insert"></td>
</tr>
</table>
</form>

<%=account.getName() %>
<%=account.getId() %>


</body>
</html>
----------------------------------------------

please help me in solving it out at the earliest..
regards
karthik
 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing I ever do when I set up a servlet/JSP server environment is to create a short JSP with the simplest of Java code inside, just to make sure it is working; e.g.

I would start with a page like that and then go from there.
 
karthik mahalingam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave..

I have tried out the code which you had sent.. Its working fine.
But when i try writing my client program using JSP its giving the same error
that is "Unable to compile class for jsp " that i have already posted....

Please get me a solution soon..

Regards
Karthik
 
dave taubler
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, then the next step is to break it down by parts to see what is failing. Try removing all of the EJB code, and slowly adding it back in to see where the failure occurs.

One question... when it fails now, does it still give the error message that it can't find the compiler?
 
karthik mahalingam
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Dev,

Thanx for your suggestion...

It works fine...

regards
Karthik
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!