ubuntu 13.04があり、openjdk-6をインストールしました。Tomcat で Web アプリケーションの 1 つを実行し (IDE を使用せずに直接)、ページをロードすると、次のエラーが発生します。
8 Jul, 2013 2:32:55 PM org.apache.catalina.core.StandardWrapperValve invoke
INFO: org.apache.jasper.JasperException: Unable to compile class for JSP
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:97)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:346)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:414)
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:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.arvind.filters.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.arvind.filters.SessionFilter.doFilter(SessionFilter.java:73)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:679)
Caused by: 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)
... 31 more
~/.bashrc に次の変数を設定しました。
export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-i386
export PATH=$PATH:/usr/lib/jvm/java-6-openjdk-i386/bin
jdkのJava代替を追加し、それをデフォルトとして設定しました
Selection Path Priority Status
------------------------------------------------------------
0 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 auto mode
1 /usr/bin/gij-4.7 1047 manual mode
* 2 /usr/lib/jvm/java-6-openjdk-i386/bin/java 1 manual mode
3 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 manual mode
実行java -version
すると、次のようになります
java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.5) (6b27-1.12.5-1ubuntu1)
OpenJDK Server VM (build 20.0-b12, mixed mode)
実行javac -version
すると、次のようになります
javac 1.6.0_27
Tomcat を起動すると、これらの変数が使用されていることが示されます。
Using CATALINA_BASE: /home/arvind/tomcat1
Using CATALINA_HOME: /home/arvind/tomcat1
Using CATALINA_TMPDIR: /home/arvind/tomcat1/temp
Using JRE_HOME: /usr/lib/jvm/java-6-openjdk-i386
この問題を解決する方法を教えてもらえますか?