Eclipse: Glassfish and Tomcat don't work - eclipse

I have reinstalled java JDK 6.0.25,(after some problems installing java, finally succeeded). I have set paths (JAVA_HOME points to C:\Program Files\Java\jdk1.6.0_25 and in Path also added C:\Program Files\Java\jdk1.6.0_25\bin).
In eclipse I have pointed everything to this new JDK, also in servers. When I have installed Glassfish 3.1, after installation the domain wasn't created. So when I add this server in Eclipse, the domain wasn't found.
So I did extract an ZIP version of Glassfish and in Eclipse configure the server to this ZIPPED Glassfish. Also I have installed tomcat 7.0.14 again and add to eclipse but both did not work.
Main problem: When I start Tomcat or Glassfish in Eclipse they don't start. Tomcat is starting but after 45 seconds it says, that the time is run out. I have read the forums to increase starting time, I have putted it to 240 sec, but it does not work, because it pop out error in which sazs, that the port is already used by a different server.
By Glassfish, when I start it, its starting, but after few minutes gives me error: Failed to start. It looks like some ports or something is blocking this servers. I have turned off firewall also and antivirus but nothing.
I have looked all the forum about "not starting Glassfish or Tomcat" but didn't found the solution. I don't want to reinstall windows for this.
So if anyone know anything about this problem, please HELP.
Update:
I've tried to change the ports in domain.xml and checked with netstat -b (everything was established), but the server (Glassfish) didn't start. It shows an error "Server GlassFish Server Open Source Edition 3 (Java EE 6) at localhost failed to start.". I've also tried install "built in Eclipse" Glassfish from marketspace and from "Install new software" from eclipse, but it comes out with the same error. Currently, for needs I'm using XP Mode in Windows 7, there servers work, without any problems.

It seems your installation odyssey messed up your system.
But you should get it working without reinstalling Windows. Maybe the fragment of an old server installation blocks the ports Glassfish and Tomcat need for operation.
Try the following:
Check which ports your "new" servers try to access (should be something like 8080 and should be written in server logs during startup)
Use netstat -b (from cmd started with admin rights) to check which application blocks this / these ports (could be java.exe if there is an old installation still hanging)
Remove the old installation (uninstall or disable service)
Try again to start your new server(s).

Try tell to GF or TC to bind the default web listener other port than 8080, because this is a root of problem.
I doesn't know well TC, but in GF case, this is very easy. Simply edit $GLASSFISH_HOME/domains/domain1/config/domain.xml and find something similar:
<network-listener port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"></network-listener>
And replace 8080 with other port (but not same with TC). In your case I could choose 8888 which is easy to remember but you can pretty sure this is differs from TC's port.
Note: Edit this file before you start GF!

Related

FAIL - Failed to deploy application at context path

Before I explain the problem, I just want to point out that I am completely new to NetBeans and Tomcat and I am doing a school project. That being said, the problem is exactly what the title says. Here is the output when I try to run a simple Hello World jsp:
In-place deployment at
C:\Users\lostl\OneDrive\Documents\NetBeansProjects\Project3\build\web
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Flostl%2FAppData%2FLocal%2FTemp%2Fcontext7180600714574256491.xml&path=/Project3
FAIL - Failed to deploy application at context path [/Project3]
C:\Users\lostl\OneDrive\Documents\NetBeansProjects\Project3\nbproject\build-impl.xml:1058: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 0 seconds)
I am using Apache NetBeans 11.2 and Tomcat 9 if it is relevant.
Here is what I tried:
I checked the server log and it displays absolutely nothing.
I tried setting the context path directly to Project3 (i.e. including the -C:/... before Project3) in the context.xml file under META-INF folder.
I tried restarting NetBeans and cleaning and building the project.
I tried running NetBeans under admin privileges.
I might seem like such an idiot for not knowing how to fix this since no one else seems to have this problem, but please help me out.
If you have installed the Apache Tomcat appart from Netbeans, maybe your apache service is already running and it conflicts with Netbeans. You may stop the apache service and then run the application in Netbeans.
Because Netbeans start the apache service in a diffent way, so you don´t need to install the aplication on apache´s folder.
Check out the Windows Services (Services App) and stop the Apache Tomcat if running, then from Netbeans menu select Run->Run Project. Netbean will start Tomcat and deploy your web app onto the Tomcat server.
I fixed it. All I had to do was restart my computer. I feel so dumb.
clean your project if clean project failed to delete some file then,
Just check there must be a java process running at background.
If you are using windows 10 then follow these steps
open command prompt and type below commands
tasklist | findstr java (hit enter now you can see a task list with pid number )
taskkill /F /PID "PID_OF_JAVA_PROCESS" (where PID_OF_JAVA_PROCESS--> task pid hit enter)
now run the project again
I faced this problem and found a solution. It is very simple. All you need to do is stop the Tomcat services or restart your computer and run your program.

Debug Eclipse Wildfly from IntelliJ

I have a local application running in local Wildfly that is configured using eclipse. I also have IntelliJ running in local. Now I want to run the application in Eclipse and connect remote debugger to it from my IntelliJ which is also running in the same machine. How do I do that?
In eclipse, I can see that the checkbox of Attach remote debugger is ticked and the port is 8787.
I try remote configuration in IntelliJ with Host as localhost and Port as 8787, I get error Error running 'Eclipse': Unable to open debugger port (localhost:8787): java.net.ConnectException "Connection refused: connect"
Can some one help me with this?
Why I need this setup:
I have this application that is been setup on Eclipse since ages. As I am used to IntelliJ, I don't want to use eclipse. It will take some time for me to identify how to migrate it to intellij, so for now going with this work around.
Ah, never mind. I added -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787 to launch configuration and it worked. I thought it appends these arguments automatically. But that is only when we use the bat file to start. Doesn't seem to be the way with eclipse.
PN: I am not deleting this post as there may be others who would have similar requirement.

CREDENTIAL_ERROR Starting GLASSFISH Internal Server

SOLVED - See bottom of post
Firstly, I will state that I have read all the existing posts regarding this problem and none of the suggested solutions have worked.
After upgrading eclipse to Indigo SR2 and to java 7, I was not able to start Glassfish, either embedded or separate installation.
After a week of this and because my PC was getting sluggish, I decided a full rebuild of my PC was required, so I reset the PC back to factory settings and started again.
My spec now looks like this...
Windows XP SP3 - Firewall Disabled as 3rd Party solution installed
Java 7 - jdk1.7.0_03 + jre
Eclipse Indigo SR2
hosts file...
127.0.0.1 localhost
I installed the latest Glassfish Plugin from: http://download.java.net/glassfish/eclipse/indigo
However, just as before the rebuild, when I try and start the server, I get the CREDENTIAL_ERROR.
I'm now super frustrated as I would have expected this completely clean install to just work.
I disabled the firewall, but that made no difference.
I then tried to start the embedded server manually. e.g. asadmin start-domain, and it started fine. I can stop it from Eclipse, but as soon as I try and start it again I get the CREDENTIAL_ERROR. Grrrrhhh!!!
I also spotted this entry in the eclipse .log file...
!MESSAGE GlassFish: error reading one jmx portjava.lang.NumberFormatException: For input string: "${JMX_SYSTEM_CONNECTOR_PORT}"
...which may be relevant as the final line of a verbose manual startup of the server looks like this...
[#|2012-04-09T15:33:16.625+0100|INFO|glassfish3.1.2|javax.enterprise.system.jmx.org.glassfish.admin.mbeanserver|_ThreadID=41;_Thre
adName=Thread-23;|JMX005: JMXStartupService had Started JMXConnector on JMXService URL service:jmx:rmi://HOME:8686/jndi/rmi://HOME
:8686/jmxrmi|#]
Many thanks
Chris
SOLVED
Darn it. Just after posting this, I stumbled upon this link...
http://java.net/jira/browse/GLASSFISHPLUGINS-72
...which suggested that the Anti-Virus (not the firewall) being the culprit and lo and behold, it was. I removed port 8080 from scanning and the server fired up without a problem.
Now I need to work out if I've opened up a security hole.
UPDATE
I decided to install a separate Glassfish instance and the problem started over again. In then end I discovered that I had to disable the NOD32 HTTP Scanner entirely to allow the server to start. Re-enabling it got the CREDENTIAL_ERROR again. There didn't seem to be any configuration setting that would get around this. I'll have to fire an email off to ESET to see what they suggest.
I'm working with about the same configuration. Only my eclipse is Version: Indigo Service Release 1, and I work in an environment where it isn't allowed to disable a firewall.
In my case it helped to switch to a previous version of Java (jdk6-u30), which wasn't what I intended. So I installed the newest version of the JDK at this moment: jdk1.7.0_04, and used this as the -vm value in de eclipse.ini.
This still left some complains about a Currentversion of 1.7 when 1.6 was expected by our version of Glassfish's asadmin. Which were worked around by changing the registry back to 1.6, instead of the 1.7 version added by the installation of the jdk1.7.0_04.
After these changes I could start and stop Glassfish from within eclipse without the CREDENTIAL_ERROR.

Getting Websphere v7.0 Running with eclipse seems to not see the server start

So I created a Websphere Application Server in Eclipse and pointed it at my WAS_HOME and the profile I created. Whenever I try to start the server, it starts fine and according to the log I see...
[2/22/12 14:16:25:037 EST] 00000000 WsServerImpl A WSVR0001I: Server server1 open for e-business
However, Eclipse says it is still waiting to start, typically it sticks at 23%. Eventually it times out saying it couldn't start, however, the instance is still up and running fine.
How do I get it to recognize the running instance?
Your workspace folder/name could be the issue.
or for me it was the WAS installation itself. When I moved it to C:\was8 everything started to work properly. The default puts it into c:\Program Files... and that was hanging at 23%
a. Please use websphere jre to replace sun hotspot vm to launch the eclipse, like below setting in the eclipse.ini
-vm
D:/IBM/WebSphere/AppServer/java/bin/javaw.exe
b. Please make sure there is not a specail character (like 23%) in the websphere path or eclipse workpsace.
Recently, I've got the same problem with Eclipse Luna and Websphere Developer Tools... The problem was the eclipse proxy configuration
Increase the initial and max heap sizes of the VM that is loading Eclipse.

Installing Tomcat 7 as Service on Windows Server 2008

I want to install my tomcat v7.0.12 as a service on my Windows 2008 Server.
On the tomcat page I found this tutorial. But there isn't a service.bat file in my installation dir.
In the service overview of WS2008 it isn't possible easily create a new service like new->service ...
To Start Tomcat7 Service :
Open cmd, go to bin directory within "Apache Tomcat 7" folder. You will see some this like C:\..\bin>
Enter above command to start the service: C:\..\bin>service.bat install. The service will get started now.
Enter above command to start tomcat7w monitory service. If you have issue with starting the tomcat7 service then remove the service with command : C:\..\bin>tomcat7 //DS//Tomcat7
Now the service will no longer exist. Try the install command again, now the service will get installed and started: C:\..\bin>tomcat7w \\MS\tomcat7w
You will see the tomcat 7 icon in the system tray. Now, the tomcat7 service and tomcat7w will start automatically when the windows get start.
You can find the solution here!
Install the service named 'Tomcat7'
C:\>Tomcat\bin\service.bat install
There is a 2nd optional parameter that lets you specify the name of the service, as displayed in Windows services.
Install the service named 'MyTomcatService'
C:\>Tomcat\bin\service.bat install MyTomcatService
Looks like now they have the bat in the zip as well
note that you can use windows sc command to do more
e.g.
sc config tomcat7 start= auto
yes the space before auto is NEEDED
I just had the same issue and could only install tomcat7 as a serivce using the "32-bit/64-bit Windows Service Installer" version of tomcat:
http://tomcat.apache.org/download-70.cgi
I have spent a couple of hours looking for the magic configuration to get Tomcat 7 running as a service on Windows Server 2008... no luck.
I do have a solution though.
My install of Tomcat 7 works just fine if I just jump into a console window and run...
C:\apache-tomcat-7.0.26\bin\start.bat
At this point another console window pops up and tails the logs
(tail meaning show the server logs as they happen).
SOLUTION
Run the start.bat file as a Scheduled Task.
Start Menu > Accessories > System Tools > Task Scheduler
In the Actions Window: Create Basic Task...
Name the task something like "Start Tomcat 7" or something that makes sense a year from now.
Click Next >
Trigger should be set to "When the computer starts"
Click Next >
Action should be set to "Start a program"
Click Next >
Program/script: should be set to the location of the startup.bat file.
Click Next >
Click Finish
IF YOUR SERVER IS NOT BEING USED: Reboot your server to test this functionality
There are a lot of answers here, but many overlook a few points. I ran into the same issue and it was likely due to a combination of being a complete neophyte when it comes to tomcat. Even more I am rather new to web servers in general. I consider myself somewhat proficient user of windows, but I guess not proficient enough. In particular I don't work with services too much.
I did not have a startup.bat or any bat files. I only downloaded the 32-bit/64-bit Windows Service Installer. The bin that is created for that download is small - only 4 files. My colleagues were surprised that I did not have a catalina.bat etc... and I was too. Only the below four files in the bin. And no %CATALINA_HOME% or %TOMCAT_HOME% etc...
bootstrap.jar
tomcat-juli.jar
Tomcat7.exe
Tomcat7w.exe
With this setup I had some frustrations as setting parameters is done via the gui widget - very helpful I might add.
So nearly all the answers I have perused were not immediately applicable as many said, "go to bin and issue the startup.bat file" I am a neophyte but not so much to not be able to look into the bin and start such a file it is existed!
For my simple purposes (again remember that I am a neophyte at tomcat and even web servers) all I wanted to do was to be able to startup and shutdown the tomcat server from a cmd prompt window. Nothing too heavy duty. I am embarrassed to say how simple it is. It is probably evident to anyone with a shred of experience with services and such.
To Start server: <Tomcat Root>/bin>Tomcat7.exe start
To Stop server: <Tomcat Root>/bin>Tomcat7.exe stop
Found here - http://crunchify.com/how-to-start-stop-apache-tomcat-server-via-command-line-setup-as-windows-service/
I did not realize there was a separate download the 64-bit Windows zip file that has a tomcat server and all the standard array of cmd line tomcat management tools. This zip file has all the common startup/shutdown scripts, batch files for windows, including catalina.bat/.sh etc... Then all the above answers make sense and are rather trivial.
Remember I am a neophyte when it comes to tomcat and web servers. It appears these two downloads are somewhat mutually exclusive in the sense that if I download and install the 32-bit/64-bit Windows Service Installer version and the 64-bit Windows zip file the startup.bat file in the 64-bit Windows zip file version will not run or interact with the 32-bit/64-bit Windows Service Installer tomcat instance. But I am not sure about this point.
Edit service.bat – Swap two lines so that they appear in following order:
if not “%JAVA_HOME%“ == ““ goto got JdkHome
if not “%JRE_HOME%“ == ““ goto got JreHome
Open cmd and run command service.bat install
Open Services and find Apache Tomcat 7.0 Tomcat7. Right click and Properties. Change its startup type to Automatic (with delay).
Reboot machine to verify if the service started automatically
its done through service.bat file in apache tomcat7
visit this blog ..
install tomcat7 on windows
I had a similar problem, there isn't a service.bat in the zip version of tomcat that I downloaded ages ago.
I simply downloaded a new 64-bit Windows zip version of tomcat from http://tomcat.apache.org/download-70.cgi and replaced my existing tomcat\bin folder with the one I just downloaded (Remember to keep a backup first!).
Start command prompt > navigate to the tomcat\bin directory > issue the command:
service.bat install
Hope that helps!