allocated
allocated

Reputation: 1355

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. 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

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. After starting tomcat by running the startup.bat it started. But when I tried loading localhost:8080 the same old glassfish page opened. Even after I stopped glassfish using asadmin stop-domain domain1

Still I kept getting the same localhost page opened whenever I tried opening the localhost:8080

And when I started to run the dynamic web project in a new apache tomcat server inside eclipse it kept saying

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). And created both tomcat and glassfish seperately one after one to run the 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.

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. when I tried launching it, a new webpage opened with 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.

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

the same glassfish server page opens, not the tomcat one which is currently active. 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.

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. 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. Whenever I try to run the whole Dynamic web project it gives me a 404 HTTP error. But if I select the jsp file and run it separately on server it runs. 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.

Upvotes: 0

Views: 2714

Answers (1)

Divya
Divya

Reputation: 1487

enter image description hereenter image description hereIt 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.

  1. go to services and stop all the Apache services running and set them to manual start.

2.In eclipse create a new server by specifying the location of your server directory

3.start you project in it. also if you want to run that in browser use window ->run on default system browser.

Upvotes: 2

Related Questions