简体   繁体   English

JSP代码未在服务器上运行

[英]JSP Code not running on server

I have recently started learning jsp and have chosen eclipse as my working IDE, and Glassfish 4 as server. 我最近开始学习jsp,并选择eclipse作为我的工作IDE,并选择Glassfish 4作为服务器。 After finishing all the necessary setups I created my first jsp script and after running it on glassfish localhost server I got an error stating 完成所有必要的设置后,我创建了我的第一个jsp脚本,并在glassfish localhost服务器上运行后,我收到一个错误说明

org.apache.jasper.JasperException: PWC6345: There is an error in invoking javac. A full JDK (not just JRE) is required

After trying almost everything available on the internet for about 3-4 hours I gave up and downloaded apache-Tomcat. 在互联网上尝试几乎所有可用的东西大约3-4个小时后,我放弃并下载了apache-Tomcat。 After starting tomcat by running the startup.bat it started. 通过运行startup.bat启动tomcat后启动它。 But when I tried loading localhost:8080 the same old glassfish page opened. 但是当我尝试加载localhost:8080时,同样的旧glassfish页面打开了。 Even after I stopped glassfish using asadmin stop-domain domain1 甚至在我使用asadmin stop-domain domain1停止glassfish之后

Still I kept getting the same localhost page opened whenever I tried opening the localhost:8080 每当我尝试打开localhost时,我仍然会打开相同的localhost页面:8080

And when I started to run the dynamic web project in a new apache tomcat server inside eclipse it kept saying 当我开始在eclipse中的一个新的apache tomcat服务器中运行动态Web项目时,它一直在说

Several ports (8005, 8009) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).

I guess its glassfish which is using them still but I don't know how to stop it. 我猜它正在使用它们的玻璃鱼,但我不知道如何阻止它。 Yeah, everything is messed up here. 是的,这里的一切都搞砸了。

After that I deleted everything inside eclipse the dynamic web project and all other servers(inside eclipse). 之后,我删除了eclipse中的所有动态Web项目和所有其他服务器(在eclipse中)。 And created both tomcat and glassfish seperately one after one to run the jsp. 并且一个接一个地创造了tomcat和glassfish来运行jsp。 After running it the console window gave the following messages 运行后,控制台窗口显示以下消息

Mar 13, 2014 12:12:39 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in             production environments was not found on the java.library.path: C:\Program      Files\Java\jdk1.7.0_51\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program    Files/Java/jre7/bin/client;C:/Program Files/Java/jre7/bin;C:/Program   Files/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\    System32\WindowsPowerShell\v1.0\;C:\Program   Files\Java\jdk1.7.0_51\bin;C:\glassfish4\bin;C:\eclipse;;.
Mar 13, 2014 12:12:39 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source'        to 'org.eclipse.jst.jee.server:DemoJSP' did not find a matching property.
Mar 13, 2014 12:12:39 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Mar 13, 2014 12:12:39 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Mar 13, 2014 12:12:39 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 476 ms
Mar 13, 2014 12:12:39 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Mar 13, 2014 12:12:39 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52
Mar 13, 2014 12:12:40 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Mar 13, 2014 12:12:40 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Mar 13, 2014 12:12:40 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 474 ms

And the eclipse web browser opened a window which said HTTP Status 404 - Not Found The requested resource is not available. 并且eclipse Web浏览器打开了一个窗口,其中显示HTTP Status 404 - Not Found The requested resource is not available.

And when I tried running it on glassfish nothing happened just nothing. 当我尝试在玻璃鱼上运行时,没有任何事情发生。 However when I opened the admin page in glassfish server page there was the jsp file i tried to run using eclipse. 然而,当我在glassfish服务器页面中打开管理页面时,我尝试使用eclipse运行jsp文件。 when I tried launching it, a new webpage opened with HTTP Status 404 - Not Found The requested resource is not available. 当我尝试启动它时,打开了一个使用HTTP Status 404 - Not Found The requested resource is not available.打开的新网页HTTP Status 404 - Not Found The requested resource is not available. And when I stopped glassfish and ran the jsp again the console window of eclipse flowed with almost 3-4 pages of texts of which I was unable to figure out a single thing. 当我停止玻璃鱼并再次运行jsp时,日食的控制台窗口流了大约3-4页的文本,其中我无法弄清楚一件事。

Now I am absolutely new in this field. 现在我在这个领域绝对是新手。 I don't have much idea about setting up servers in a system. 我对在系统中设置服务器没有太多了解。 I was just following tutorials available in the internet. 我只是按照互联网上提供的教程。 Now though I have already stopped glassfish several times but still when I try to open localhost:8080 虽然我已经多次停止了玻璃鱼,但仍然在我尝试打开localhost时:8080

the same glassfish server page opens, not the tomcat one which is currently active. 打开相同的glassfish服务器页面,而不是当前活动的tomcat。 Its all messed up. 一切都搞砸了。 I don't even know how to uninstall these servers. 我甚至不知道如何卸载这些服务器。 I think I have made a mistake by chosing eclipse and setting these up manually. 我想通过选择日食并手动设置它们我犯了一个错误。 The netbeans JavaEE with Glassfish server package would have been better. 使用Glassfish服务器包的netbeans JavaEE会更好。

Please somebody get me out of this mess. 请有人让我摆脱这个烂摊子。 It is simply painful. 这简直太痛苦了。 And thanks in advance. 并提前感谢。

EDIT : The problem is solved partially, the tomcat is working under eclipse. 编辑:问题部分解决,tomcat正在eclipse下工作。 I don't know how and why but after I deleted the glassfish servers and and stopped it via the command prompt and created new tomcat servers in eclipse it worked. 我不知道如何以及为什么但是在我删除了glassfish服务器并通过命令提示符停止它并在eclipse中创建了新的tomcat服务器它起作用了。 Whenever I try to run the whole Dynamic web project it gives me a 404 HTTP error. 每当我尝试运行整个Dynamic web项目时,它都会给我一个404 HTTP错误。 But if I select the jsp file and run it separately on server it runs. 但是如果我选择jsp文件并在服务器上单独运行它就会运行。 But still whenever I try going to localhost:8080 through my web browser it still brings me to the glassfish page, which I have already stopped several times and deleted from eclipse. 但是每当我尝试通过我的网络浏览器访问localhost:8080时,它仍然会将我带到glassfish页面,我已经停止了几次并从eclipse中删除了。

在此输入图像描述在此输入图像描述 It will be good to use Apache tomcat with the eclipse but for that you need not to install that separately it may cause dangerous situation as some ports already remains in use.tomcat by default uses 8080 to which you can change from eclipse also. 将Apache tomcat与eclipse一起使用会很好,但为此您不需要单独安装它可能会导致危险的情况,因为一些端口已经在使用中。默认情况下,tomcat使用8080也可以从eclipse更改。

  1. go to services and stop all the Apache services running and set them to manual start. 转到服务并停止运行所有Apache服务并将其设置为手动启动。

2.In eclipse create a new server by specifying the location of your server directory 2.在eclipse中,通过指定服务器目录的位置来创建新服务器

3.start you project in it. 3.启动你的项目。 also if you want to run that in browser use window ->run on default system browser. 如果你想在浏览器使用窗口中运行它 - >在默认系统浏览器上运行。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM