在使用ssh执行远程重启脚本重启resin时,会出现一下报错:
com.caucho.jsp.JspParseException: Resin can‘t load com.sun.tools.javac.Main. Usually this means that the JDK tools.jar is missing from the classpath, possibly because of using a JRE instead of the JDK. You can either add tools.jar to the classpath or change the compiler to an external one with <java compiler=‘javac‘/> or jikes. java.lang.ClassNotFoundException: com.sun.tools.javac.Main at com.caucho.jsp.JspCompilerInstance.compile(JspCompilerInstance.java:421) at com.caucho.jsp.JspManager.compile(JspManager.java:233) at com.caucho.jsp.JspManager.createPage(JspManager.java:177) at com.caucho.jsp.JspManager.createPage(JspManager.java:157) at com.caucho.jsp.PageManager.getPage(PageManager.java:248) at com.caucho.jsp.PageManager.getPage(PageManager.java:166) at com.caucho.jsp.QServlet.getSubPage(QServlet.java:292) at com.caucho.jsp.QServlet.getPage(QServlet.java:210) at com.caucho.server.dispatch.PageFilterChain.compilePage(PageFilterChain.java:206) at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:133) at com.caucho.server.webapp.DispatchFilterChain.doFilter(DispatchFilterChain.java:115) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229) at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:277) at com.caucho.server.webapp.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:106) at com.iheyday.base.cgi.CGIServlet.dispatchPage(CGIServlet.java:204) at com.iheyday.base.cgi.CGIServlet.disposeActionResult(CGIServlet.java:159) at com.iheyday.base.cgi.CGIServlet.invokeAction(CGIServlet.java:108) at com.iheyday.base.cgi.CGIServlet.service(CGIServlet.java:90) at javax.servlet.http.HttpServlet.service(HttpServlet.java:92) at com.caucho.server.dispatch.ServletFilterChain.doFilter(ServletFilterChain.java:106) at com.iheyday.web.filter.CampaignPromotionFilter.doFilter(CampaignPromotionFilter.java:115) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.iheyday.web.filter.AntiXSSFilter.doFilter(AntiXSSFilter.java:116) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.iheyday.web.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:54) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:70) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:173) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:229) at com.caucho.server.hmux.HmuxRequest.handleRequest(HmuxRequest.java:420) at com.caucho.server.port.TcpConnection.run(TcpConnection.java:511) at com.caucho.util.ThreadPool.runTasks(ThreadPool.java:516) at com.caucho.util.ThreadPool.run(ThreadPool.java:442) at java.lang.Thread.run(Thread.java:662) Caused by: com.caucho.java.JavaCompileException: Resin can‘t load com.sun.tools.javac.Main. Usually this means that the JDK tools.jar is missing from the classpath, possibly because of using a JRE instead of the JDK. You can either add tools.jar to the classpath or change the compiler to an external one with <java compiler=‘javac‘/> or jikes. java.lang.ClassNotFoundException: com.sun.tools.javac.Main at com.caucho.java.InternalCompiler.compileInt(InternalCompiler.java:77) at com.caucho.java.AbstractJavaCompiler.run(AbstractJavaCompiler.java:101) ... 1 more
这个问题的原因很简单:
在使用ssh执行远程脚本是,没有继承完整的环境变量,也就是JDK的环境变量没有加载上!
所以只需要实现设置好JDK环境变量:
vi /etc/profile.d/java.sh export JAVA_HOME=/usr/java/jdk1.6.0_38 export PATH=$PATH:$JAVA_HOME/bin
并且在你的重启脚本中添加:
. /etc/profile.d/java.sh
生产resin报错之Resin can't load com.sun.tools.javac.Main
时间: 2024-10-23 21:12:19