Link to home
Start Free TrialLog in
Avatar of stefanaichholzer
stefanaichholzerFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Kiranhk, I still need you help, please...

Continued from question: https://www.experts-exchange.com/questions/21201663/Problems-with-JSP.html

I need to know how to make changes to my .jsp pages. When I first start the server (Tomcat) it all works fine, but as soon as I change the pages I get the same errors as on question Q_21201663.html (Compiler not found, etc.) I only can get around this problem if I run the startup.bat file and leave the DOS window alive all the time, then it will allow me to modify and run my .jsp files...

When Tomcat starts isn't it supposed to run startup.bat and allow me to change my .jsp pages as needed??

OK, basically that's the question, how can I run, modify & run my .jsp pages without having to restart the server all te time and also not to have the startup.bat file window alive all the time??

Thank you, hope to hear from you ASAP

;)

P.S. Why can't they make something as easy and fast as PHP?, there you never have to restart the server... ;)
Avatar of Mick Barry
Mick Barry
Flag of Australia image

you shouldn't need to touch the startup scripts.

what exactly did u move in the 1st place?
tomcat 5 can run as a windows service so u should not need to start bat manually
> P.S. Why can't they make something as easy and fast as PHP?, there you never have to restart the server... ;)

Because it's a scripting language... ;-)
ASKER CERTIFIED SOLUTION
Avatar of kiranhk
kiranhk

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kiranhk
kiranhk


Also add this in your %CATALINA_HOME%\conf\web.xml where you have   <!-- The JSP page compiler and execution servlet, which is the mechanism  -->
and put the following after this line

<servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
<init-param>
            <param-name>compiler</param-name>
            <param-value>your path to JAVAC.exe</param-value>
</init-param>


also pl tell clearly what u r doing with Tomcat moitor and if you have made any changes.
Avatar of stefanaichholzer

ASKER

1) I did not change the startup fils

2) Tomcat is already installed and running as a Windows service, I don't need to start the server using startup.bat

3) Isn't PHP a scripting language as well??

4) I added following to the %CATALINA_HOME%\conf\web.xml file:
     <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
       <init-param>
            <param-name>compiler</param-name>
            <param-value>C:\Global\Java\jdk1.4\bin\javac.exe</param-value>
       </init-param>

5) I use Tomcat monitor only to "monitor" my server and to stop and start it. I haven't made any changes on it

--> Still not working, when I start the computer, Windows starts Tomcat as a service, and all works, fine, for example I get my pages at http://localhost/jsp/test.jsp - Works all good. As soon as I make any changes to the test.jsp page I get errors (compiler not found and so on).

Now, when I don't have Windows to start the service and I start it manually using the startup.bat I can make as many changes as I want to the test.jsp page and I never get errors.

What's going on there?, it seems to me that Tomcat run as a service is making something wrong and I don't know what it is, do you experts know?, if you do, please tell me as it's driving me nuts...

;)
did you check if there is anything in the logs. since tomcat is started as a windows service it will be writing all the output to the logs. can you check out and post if there is any details in the logs when u get this error
Nothing at all in the logs :(
what exactly do you mean by nothing?  
I was reading the wrong log file.

I started Tomcat, actually Windows did, then went to my .jsp file and all was working fine. Changed the .jsp file, reloaded the browser and got errors as usual (Can't find compiler and so on). There log file ( localhost_log.2004-11-13.txt ) was created and here are the contents:

2004-11-13 10:21:50 StandardContext[/stefan]SessionListener: sessionCreated('1F0F1C0537A584FB1339124A5FF0BCAE')
2004-11-13 10:22:42 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
      at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:106)
      at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:935)
      at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:764)
      at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
      at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      at java.lang.Thread.run(Unknown Source)

I wonder why it says "JAVA_HOME does not point to the JDK" after I change a .jsp page, if JAVA_HOME does point to the JDK when the server is started why would it change after? strange :(

Thanx
For starting the server it doesnt require JDK, if you just have a JRE installed it will start the server. but when you are accessing the jsp pages which have been modified then it requires a javac.exe on its path which is available in JDK installation. so pl check out again whether you have put the path to the JDK properly.

also pl check out in your windows PATH environment variable if it has JDK path before any of your JRE path.
The JDK path needs to be first!!!!!!!!!!!!!!!!!

check this out and try again. The PATH env variable might be pointing to a JRE first and then your JDK.
I have the JDK in the path and the path variable in the system does not have a JRE path, only the JDK one.

Drives me nuts... ;)
I guess it's not a PATH issue. When I start the server using the startup.bat all works fine, I can change all my .jsp pages without any problems, all works as it has to.

The problem is when Windows start the server, as a service...

Why is this happening and how can I solve it?

Paths are all fine because if it was a path issue no .jsp could be changed at all, but as I said, it works just fine when I launch the server using the startup.bat

Thanx ;)
>>>>I guess it's not a PATH issue. When I start the server using the startup.bat all works fine
this is becoz you have set the JAVA_HOME to the JDK path in your startup.bat.

can you post your path variable contents here

open a command prompt and execute this command and post the  contents here

set path


also can you check out your Registry and see where your java is pointing to.

To get more into go thro' this Thread

https://www.experts-exchange.com/questions/21157924/java-installation.html
set path produced:

Path=C:\Global\Java\jdk1.4;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Control Panel;C:\Global\Apache\Oracle\bin
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH

From regedit:

you can type regedit  from start->run.
from the Registry editor u can check out the HKEY_LOCAL_MACHINE-->SOFTWARE-->JavaSoft-->Java Development Kit
you can check out where this is pointing to, if it is wrong you can change the same and try running java -version on your command prompt.

I don't have the "Java Development Kit" folder in my JavaSoft folder in the registry
OK, I fixed it, following link: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/setup.html

It said that if the path is wrong in the installation, the server won't be able to compile .jsp files at runtime, so it suggested to copy the lib\tools.jar file from a JDK installation to the common\lib path of the Tomcat installation, that's what I did and the problem is fixed.

Still is there any way to change the path the installer created?

Point go to kiranhk for the link

Thanx

;)
Was JAVA_HOME set correctly when you did the install?
Well, that I don't know, I know PATH was set right:

Path=C:\Global\Java\jdk1.4;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\ATI Control Panel;C:\Global\Apache\Oracle\bin

But I guess I had a mistake in the PATH as well, because I had a previous JDK installation...

Thank you for your time