简体   繁体   English

我的webapplication在IDE中测试时工作正常,但在webserver(tomcat)上不起作用

[英]My webapplication works fine when testing it in IDE, but doesnt work on webserver (tomcat)

I`ve created my first webapplication. 我创建了我的第一个webapplication。 I set up my webserver (tomcat+apache2) and tried to deploy the app on it. 我设置了我的网络服务器(tomcat + apache2)并尝试在其上部署应用程序。 When I tested the app it worked fine with my test environment, but when created the war and deployed it the following error (exception) showed up: 当我测试应用程序时,它在我的测试环境中运行良好,但是当创建战争并部署它时,出现以下错误(异常):

HTTP Status 500 - HTTP状态500 -

type Exception report 类型异常报告

message 信息

description The server encountered an internal error () that prevented it from fulfilling this request. description服务器遇到内部错误(),导致无法完成此请求。

exception 例外

org.apache.jasper.JasperException: Unable to compile class for JSP: org.apache.jasper.JasperException:无法为JSP编译类:

An error occurred at line: 14 in the generated java file Only a type can be imported. 生成的java文件中第14行发生错误只能导入类型。 bitcoin.BitcoinHandler resolves to a package bitcoin.BitcoinHandler解析为一个包

An error occurred at line: 16 in the jsp file: /Balance.jsp BitcoinHandler cannot be resolved 13: double yourcoins=0.0; 在jsp文件中的行:16处发生错误:/ Balance.jsp BitcoinHandler无法解析13:double yourcoins = 0.0; 14: Random rand=new Random(); 14:随机rand = new Random(); 15: 15:
16: balance=new Double(BitcoinHandler.getBalance("give")); 16:balance = new Double(BitcoinHandler.getBalance(“give”)); 17: 17:
18: 18:
19: if(balance>2.5) 19:如果(余额> 2.5)

Stacktrace: org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:469) org.apache.jasper.compiler.Compiler.compile(Compiler.java:378) org.apache.jasper.compiler.Compiler.compile(Compiler.java:353) org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) javax.servlet.http.HttpServlet.service(HttpServlet.java:722) Stacktrace:org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:331)org.apache.jasper.compiler.JDTCompiler.generateClass( JDTCompiler.java:469)org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)org.apache.jasper.compiler。 Compiler.compile(Compiler.java:340)org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)org.apache.jasper。 servlet.JspServlet.serviceJspFile(JspServlet.java:390)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs. note备注根本原因的完整堆栈跟踪在Apache Tomcat /7.0.27日志中。 Apache Tomcat/7.0.27 Apache Tomcat / 7.0.27

The application just cant find my classes which are inside the WEB-INF/classes folder. 应用程序无法找到WEB-INF / classes文件夹中的类。 I dont know why!?? 我不知道为什么!?? Could someone please help me? 有人可以帮帮我吗?

Code provided in comment 评论中提供的代码

<%@page import="bitcoinmonitor.BitcoinHandler"%>
<%@page import="java.util.Random"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<% 
double balance=0.0;
double yourcoins=0.0;
Random rand=new Random();
balance=new Double(BitcoinHandler.getBalance("give"));

Actually you have some information in exception report, look carefully here line: 16 in the jsp file: /Balance.jsp also you may place here code from this file to give us more information. 实际上你在异常报告中有一些信息,仔细看一下这line: 16 in the jsp file: /Balance.jsp你也可以在这里放置来自这个文件的代码来给我们提供更多信息。 As far as i can see you have a problem with BitcoinHandler object, may be you don't imported this class to your Balance.jsp 据我所知,你有BitcoinHandler对象的问题,可能是你没有将这个类导入你的Balance.jsp

This tells me that your test and production environments are not the same. 这告诉我你的测试和生产环境不一样。 There's a dependency or assumption that you're making that isn't addressed properly in the environment that's failing. 有一种依赖或假设,即你所做的那些在失败的环境中没有得到妥善解决。

You're using scriptlet code in your JSPs, which is asking for trouble. 你在JSP中使用了scriptlet代码,这就是在寻找麻烦。 I'd recommend learning JSTL and writing servlets to validate and bind requests, fulfill use cases, and pass the information needed by the JSP to display. 我建议学习JSTL并编写servlet来验证和绑定请求,完成用例,并传递JSP所需的信息来显示。 Your design was proven to scale poorly and be a maintenance nightmare back in the 90s. 事实证明,您的设计规模很小,并且在90年代成为维护噩梦。

问题是JSP子目录..我现在把JSP放到根目录中,它最终像魅力一样工作。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VirtualWebAppLoader可以正常工作。 但是当包含在tomcat / lib /中时,同一组罐子不起作用 - VirtualWebAppLoader works fine. But same set of jars doesnt work when included in tomcat/lib/ 将.war文件部署到tomcat 8在IDE中工作正常,但是当我部署到我的VPS时,我丢失了所有的JS和CSS - Deploying .war file to tomcat 8 works fine in IDE but I lose all my JS and CSS when I deploy to my VPS 我的代码适用于 IntelJ,但不适用于测试系统 - My code works at IntelJ, but it doesnt work at testing system 与Firebase数据库集成的Spring代码在IDE上可以正常工作,但在Tomcat上却不能 - Spring code integrated with Firebase database works fine on IDE but NOT on Tomcat 为什么我的 android 程序在 4.4.3 版本上运行良好,但在 10.0 上不起作用 - Why my android program works fine on 4.4.3 version but doesnt work on 10.0 在Eclipse中播放视频效果很好,但是当将Java项目导出为可运行的JAR文件时,它不再起作用 - Playing videos works fine in Eclipse but when exporting the java project as an runnable JAR file it doesnt work anymore 在Tomcat上部署时SOAPFaultException但在GlassFish中工作正常 - SOAPFaultException when deployed on Tomcat but works fine in GlassFish 为什么我的tomcat取消部署任务不起作用 - why doesnt my tomcat undeploy task work 战争在本地独立的tomcat 7(无月食)上运行良好,上传到ec2时不起作用 - War works fine on local standalone tomcat 7 (no eclipse), does not work when uploaded to ec2 Android 应用程序在 Android Studio 中运行良好,但在设备上无法运行 - Android App works fine in Android Studio but doesnt work on device
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM