skip1000
asked on
Unable to compile class for JSP
Hi,
I'm new to jsp and when I tried to create a jsp page w/ ejb. After I deployed the app, I get this error message when I'm trying to access the page from IE:
org.apache.jasper.JasperEx ception: Unable to compile class for JSP
No Java compiler was found to compile the generated source for the JSP.
Also where is the tomcat server located? What exe does tomcat run? I need this to copy the tools.jar file to the tomcat server directory.
Thanks.
entire error message:
-------------------------- ---------- ---------- ---------- ---------
org.apache.jasper.JasperEx ception: 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, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.
org.apache.jasper.compiler .DefaultEr rorHandler .javacErro r(DefaultE rrorHandle r.java:87)
org.apache.jasper.compiler .ErrorDisp atcher.jav acError(Er rorDispatc her.java:3 11)
org.apache.jasper.compiler .Compiler. generateCl ass(Compil er.java:37 8)
org.apache.jasper.compiler .Compiler. compile(Co mpiler.jav a:421)
org.apache.jasper.compiler .Compiler. compile(Co mpiler.jav a:402)
org.apache.jasper.JspCompi lationCont ext.compil e(JspCompi lationCont ext.java:5 12)
org.apache.jasper.servlet. JspServlet Wrapper.se rvice(JspS ervletWrap per.java:2 62)
org.apache.jasper.servlet. JspServlet .serviceJs pFile(JspS ervlet.jav a:263)
org.apache.jasper.servlet. JspServlet .service(J spServlet. java:210)
javax.servlet.http.HttpSer vlet.servi ce(HttpSer vlet.java: 861)
sun.reflect.GeneratedMetho dAccessor7 2.invoke(U nknown Source)
sun.reflect.DelegatingMeth odAccessor Impl.invok e(Delegati ngMethodAc cessorImpl .java:25)
java.lang.reflect.Method.i nvoke(Meth od.java:32 4)
org.apache.catalina.securi ty.Securit yUtil$1.ru n(Security Util.java: 246)
java.security.AccessContro ller.doPri vileged(Na tive Method)
javax.security.auth.Subjec t.doAsPriv ileged(Sub ject.java: 500)
org.apache.catalina.securi ty.Securit yUtil.exec ute(Securi tyUtil.jav a:268)
org.apache.catalina.securi ty.Securit yUtil.doAs Privilege( SecurityUt il.java:16 2)
I'm new to jsp and when I tried to create a jsp page w/ ejb. After I deployed the app, I get this error message when I'm trying to access the page from IE:
org.apache.jasper.JasperEx
No Java compiler was found to compile the generated source for the JSP.
Also where is the tomcat server located? What exe does tomcat run? I need this to copy the tools.jar file to the tomcat server directory.
Thanks.
entire error message:
--------------------------
org.apache.jasper.JasperEx
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, followed by a Tomcat restart.
If using an alternate Java compiler, please check its installation and access path.
org.apache.jasper.compiler
org.apache.jasper.compiler
org.apache.jasper.compiler
org.apache.jasper.compiler
org.apache.jasper.compiler
org.apache.jasper.JspCompi
org.apache.jasper.servlet.
org.apache.jasper.servlet.
org.apache.jasper.servlet.
javax.servlet.http.HttpSer
sun.reflect.GeneratedMetho
sun.reflect.DelegatingMeth
java.lang.reflect.Method.i
org.apache.catalina.securi
java.security.AccessContro
javax.security.auth.Subjec
org.apache.catalina.securi
org.apache.catalina.securi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Then copy $JAVA_HOME/lib/tools.jar to $TOMCAT_HOME/common/lib directory
ASKER
what is $TOMCAT_HOME directory? I have no idea what the directory is named by default. I don't see any directory called tomcat per se. Any suggestions?
it can be called jakarta-tomcat-x.x.xx where x.x.xx should be substituted by tomcat version number
Do you know where startup.bat file of Tomcat is ???
then you will find common:lib directory easily:
$Tomcat_home
bin
startup.bat
common
lib
then you will find common:lib directory easily:
$Tomcat_home
bin
startup.bat
common
lib
ASKER
I should mention I'm using J2ee 1.4 and the command for "start default server" is
"C:\Sun\AppServer\lib\asad min-pause. bat start-domain domain1". I've search high and low for any directory named common and the only ones found are in the sample directories (which can't be right). I've copied the file in several lib directories w/in AppServer directory and that did not do the trick.
"C:\Sun\AppServer\lib\asad
then check your c:\sun\appserver\config\as env.bat file. Find AS_JAVA variable and check that it points correctly to your JDKhoem directory. On ly PC it is:
set AS_JAVA=C:\j2sdk1.4.2
set AS_JAVA=C:\j2sdk1.4.2
ASKER
I've changed it from
set AS_JAVA=C:\Sun\AppServer\j dk
to
set AS_JAVA=C:\j2sdk1.4.2_05
I'm wondering if it could be a problem w/ the jsp file I am testing. The tutorial example all worked, but my first attempt to create a jsp test app gave the error you saw earlier. I don't know if the J2EE tutorial example even requires compiling the JSP's before running them. I was able to deploy my project files earlier, but now I can't b/c I overwrote the ear file accidentally. I need to retrace my steps.
set AS_JAVA=C:\Sun\AppServer\j
to
set AS_JAVA=C:\j2sdk1.4.2_05
I'm wondering if it could be a problem w/ the jsp file I am testing. The tutorial example all worked, but my first attempt to create a jsp test app gave the error you saw earlier. I don't know if the J2EE tutorial example even requires compiling the JSP's before running them. I was able to deploy my project files earlier, but now I can't b/c I overwrote the ear file accidentally. I need to retrace my steps.
ASKER
I managed to get past that error, and a few things happened along the way. I can't quite remember exactly what happened. Among the errors encountered, I was missing package in my bean, resource ref for my ejb, and I think that the log viewer in admin console actually displayed the correct jsp error message.
The message I first displayed was bogus. It was not the real error. The real error was something else. Look at the log viewer and you will see all the messages logged. Look at the detail message of the severe errors. I believe they will show compile errors. They should be the 2nd or 3rd error message in the log viewer that's the real source of the problem. The error I printed above is the topmost error message in the log viewer that is why it is displayed. It's deceiving b/c there is nothing wrong w/ my environment variable settings.
The message I first displayed was bogus. It was not the real error. The real error was something else. Look at the log viewer and you will see all the messages logged. Look at the detail message of the severe errors. I believe they will show compile errors. They should be the 2nd or 3rd error message in the log viewer that's the real source of the problem. The error I printed above is the topmost error message in the log viewer that is why it is displayed. It's deceiving b/c there is nothing wrong w/ my environment variable settings.
ASKER
I am awarding points, but pls read my last comment. It is important.
ASKER