FAIL - Failed to deploy application at context path - netbeans

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.

Related

Question on Tomcat Server not starting via Eclipse

Please follow Getting error while starting Tomcat Server 9 in Eclipse though command line run is successfull for my query.
I would appreciate an early response.
Best,
Arushi
Here are screens:
Change the directory to WEB-INF. It worked fine after that. Which is after tomcat/../web-inf/
Before that check
whether the tomcat folder have root access.
In cmd, you will run as a user. But eclipse can't.
I had the same problem in Linux.
After giving the access permission, no error message.
If it is running in cmd, then it might be due to permission.
Did you stopped Tomcat before deploying in eclipse?
Stop tomcat using cmd and run in eclipse.
Restart the server again.
If same persists then reinstall it.
I hope these steps will solve your problem.
Update: I installed 201912 version of Eclipse, deleted Tomcat folder from /usr/local/. Followed all steps in https://wolfpaulus.com/tomcat/ and am able to access Tomcat Server without any issue. Thanks to all for the great help!! Will mark this as solved.

JBossEAP / Wildfly error renaming temporary file

for the past several days I've been experiencing this error, while publishing to either JBoss EAP 6.3 or Wildfly 8.2 from Eclipse.
Error renaming D:\Servers\wildfly-8.2.0.Final\standalone\tmp\tmp9064011157118650757.jar
to D:\Servers\wildfly-8.2.0.Final\standalone\deployments\BusinessService.war\WEB-INF\lib\spring-web-4.2.3.RELEASE.jar.
This may be caused by incorrect file permissions, or your server's temporary deploy
directory may be on a different filesystem than the final destination. You may adjust
these settings in the server editor.
The problem occurs when I "Add and Remove..." projects from the server, then try to publish them, so the server can start.
I've experienced this issue on two different machines (home (Wildfly) and work (JBoss EAP)).
I'm using:
Windows 7 / 10
Eclipse Mars / Luna
JBoss Tools plugin 4.3 / 4.2
JDK 1.8.0.66 / 1.8.0.65
Maven
Building with maven from Eclipse and from the command line makes no difference. The server is configured to deploy projects as compressed archives. On both machines my user has administrator rights and has full rights on the server directory.
So far I've tried:
recreating the server multiple times with different configurations
using a newly created workspace
reinstalling JBoss Tools
reinstalling Eclipse
using different JDK versions
I'm really at a loss here and I don't know how to proceed in resolving this issue. Please help.
If you are using Windows, the path could get too long and can cause this error. A simple fix is to move WildFly closer to the root.
I had the same problem and solved it like this:
First of all, stop Server (Servers->WildFly(rigth click)->Stop), than clean. So you can run server again.
I had this problem several times in my new windows 10 machine that my employer gave me. Since I did not have admin rights it was a hectic process to troubleshoot this issue. Simple fix would be moving JBOSS_HOME closer to root. However, you need to do a proper restart of your eclipse. I rather recommend a complete restart of your computer because after all you are going to change JBOSS_HOME in windows environmental variables.
This is related to permissions issue on wildfly folder. Allow full control to the wildfly folder.
https://issues.jboss.org/browse/JBIDE-18697
I have moved the wildfly home to reduce the overall path length, and also removed any non-alphanumeric characters from the folder name (like "-" and "." ) . This worked for me, everything else (removing tmp, deployment, rebooting wildfly, rebooting eclipse, rebooting computer) failed.
I also suspect that the issue was stemming from running Wildfly from a ConEmu and/or git bash shell. Running from a plain CMD shell seems more robust.
I also got stuck with the same problem. I tried the below steps and it worked:
Clear the deployments and tmp folder in standalone folder in wildfly folder.
Delete the server and again add the server
Make a build of the project and start the server after successful build.
This is a terribly annoying error that either the Eclipse team or Redhat need to fix.
The solution is to close Eclipse, right click on the icon -> Run As Administrator. This solved it for me.

Need help setting up a (Tomcat) web app in Eclipse for debugging

I've been using both eclipse and tomcat for years but have always deployed my web apps externally and never had a problem. Now I'd like to use eclipse to debug my web app and I can't figure out how to make it work. I started by trying to get my existing web app to deploy through eclipse but after hours of trying different things I decided to start fresh. Unfortunately, I didn't get much further. I'm hoping if I can figure out how things work with a fresh webapp I can get things to work on my existing. Sorry, this will be long, but here are the steps I tried on the latest eclipse (Juno):
Installed new version of tomcat 7.0.34 at /usr/java.
In eclipse, used "servers" view to add server, pointing to the new install (I didn't add any resources because there weren't any available yet). Starting the server worked and got a 404 as expected at http://localhost:8080/ ... then I stopped it.
Created a new "dynamic web project", named it TomcatDebug, set the location to ~/tomcat-debug, chose the server just created above (the only one), chose default config, tomcat-debug is empty so chose defaults for build paths, defaults for module settings and had it generate web.xml.
In the "tomcat-debug" folder it creates WebContent, build, and src. I throw a sample "hello, world" index.html into WebContent.
Now the project TomcatDebug is created so I try to run it, tell it to "run on server", and it goes to http://localhost:8080/TomcatDebug/ but gives a 404. I even try to add index.html but it still gives a 404.
This is about as basic as it can possibly get so what did I do wrong?
Continuing to try and figure this out I stop the server, change the server setting to "use tomcat installation", but still get a 404 in the same way when I restart. I tried changing my module context path and still 404.
I'm completely stumped. I believe I followed all the wizards as basically as possible. Where did I go wrong?
Thanks for taking a look.
I haven't run tomcat through eclipse in a while, so can't answer that aspect of the question. But, to get at the heart of what you're trying to do (debug a webapp in eclipse through tomcat), you shouldn't necessarily need to. This may serve you instead:
EDIT: Eh, look here for instructions ("Debugging" section). The below is how I did it (JUNO and TC 7) and has an annoying quirk in point #1.
edit the startup.sh (assuming *NIX/OS X) - the last line will probably be
exec "$PRGDIR"/"$EXECUTABLE" start "$#"
change this to
exec "$PRGDIR"/"$EXECUTABLE" jpda start "$#"
to activate debugging. (there are other ways to do this that may be better - i think tomcat/the VM may pause for listeners before proceeding, so when you aren't debugging this is not ideal)
Create a Debug Configuration in eclipse, under the "Remote Java Application" set. Default port should be fine, and presumably host. Choose your project.
Add sources of relevance to your debugging in the Source tab.
Start server and run your new debug configuration. App should stop at breakpoints you've set.
Right Click your index.html Run As -> Run On Server you will see Tomcat will automatically run the page.

Eclipse: Glassfish and Tomcat don't work

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!

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!