I'm using IntelliJ Ultimate to develop a SpringBoot App (+ maven). When i hit run, tomcat still serves a old vaadin project. How can i remove it? I already cleared my browsers cache, tried to load the side in a private browser window and removed the project from the tomcats webapp folder
I think you should try these things:
Change the port number in the application.properties file.
server.port = [port number]
Edit the project's configuration and explicitly add the #SpringBootApplication containing class or just go to the file and run the main() method.
Few things can be checked.
If you are using your local tomcat then verify the tomcat if that is the one you are actually using. Better remove the tomcat and import a fresh one.
or
close the project from IntelliJ and reimport.
clean build maven project and run again.
Related
My team is working on a Java application that runs on Jboss WildFly, using Maven to resolve dependencies and Primefaces.
We're using Eclipse to build, deploy and run the server. Eclipse does most of the work, building the WAR file, deploying it to server and running it.
Now we need to create an script that performs all those steps because it has to run on remote server.
.
The steps would be something like this...
1 Run Maven:
$M2_HOME/bin/mvn clean install
2 Build project to a war file
3 Deploy war file into the WildFly deployment folder
$WILDFLY_HOME/bin/jboss-cli.sh --connect --command="deploy --force [PATH_TO_WAR]"
4 Start server
$WILDFLY_HOME/bin/standalone.sh
.
I can perform every step but once the server is running it don't seem to be any changes in the application. I think this is because the WAR file has to be built optimizing it for JBoss. Eclipse has a way to do this when exporting the project. I need to know how to do that from command.
EDIT:
The real problem is that Jboss is not updating the published project when i run it from bash script. I thought it was because i had to build it on a specific way. I was wrong. The build is fine, just running Maven the deploy is done. The thing is that even if i rebuild project and redeploy it, server doesn't seem to notice at all.
I've tried deleting tmp, lib and data folders from standalone folder, and nothing happens. I also deleted standalone/deployed sub files and folders and got the same result.
The only way i achieve the result i'm expecting is getting into Eclipse, go to Servers tab, right click on JBoss Wildfly and click on 'Clean...'. This options seems to clean cache, rebuild and re publish the application in a right way that i don't know. I didn't find any answers on google.
eclipse server clean option
Give a look on Eclipse war export: optimize for a specific server runtime.
Quoting from #Konstantin Komissarchik's answer :
Eclipse itself doesn't do anything with that option. What happens is
dependent on a particular server adapter. Many of the adapters don't
do anything with this option either, but they might in the future.
If a server adapter does support export optimization, it has the
option of displaying custom options beneath that pop-up list of
runtimes, so that's a good cue to use to see if something will
actually happen.
So taking in consideration that in your provided image there is no custom options below Wildfly 9 selection, I am pretty sure that this option does not perform any optimization at your exported war so you can totally omit it in your new build-deploy process.
How can i build the war file from command, knowing it will have to run on Wildfly?
We are also deploying applications for a long time on several versions of Widlfy with the same approach as you are planning to, without the optimization thing. I can ensure you that we have not faced any performance issue.
I have a maven project on eclipse, but when i restart the tomcat server inside eclipse, changes are not reflected on my app.
I´d try to do two tests:
First - make some changes on a single javascript file and restart tomcat, and works great.
Second - make some changes on a java class and restart tomcat, and nothing has change on my browser.
Anyone could help me?
you need to configure your tomcat to hot deploy your application.
http://www.mkyong.com/eclipse/how-to-configure-hot-deploy-in-eclipse/
Follow this tut.
I'm trying to run a multi-module Maven web app in Eclipse (EE Helios SR 1). In NetBeans one have just to click the run button. But here it's probably a little more complicated.
I've added Tomcat 7.0.26 as a server for the war module of the project. When I try running the app, in the Servers part of the window I see Apache Tomcat v.7.0.26 at localhost [Started, Synchronized], but browser doesn't react. Does the system browser need to show the page when the app is running?
I tried to move to localhost:8080 and localhost:8080/welcome.html (the second one should be processed by the app) when the server was started, but I got 404 error both times. I also didn't see the new folder in the apache-tomcat-7.0.26/webapps/. Should Eclipse place the project there when running the application? I'd be really grateful if someone tells me what I'm missing here.
If not specified, tomcat integration with eclipse deploy by default war to a specific folder in .metadata, in my case somethings like: ~/workspace/<my_project_workspace_name>/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/
Every war are then unzipped to a folder. If your maven pom.xml you'll find a
<build>
<finalName>myapp</finalName>
</build>
Then it'll deployed to tomcat as :
localhost:8080/myapp/welcome.html
I have had a lot of bad experience with running web servers in Eclipse. Most of the time, this was related to unreliable class/resource reloading.
My solution was to add Jetty to my app in a new module (see Embedding Jetty). This basically turns my web app into a Java application, avoiding most of the problems. It also allows me to specify a filter (written in Java) when the app should reload.
This solves all the problems with class reloading (classes and resources are never copied anywhere; they are loaded from Eclipse's bin folders), startup is much faster (we got the startup time from several minutes down to 15s) and reliable.
Maven Projects are different from the ones with Web Application Facets, You cannot directly run a Maven App as a web app because the folder structure is different. In order to run your application directly from eclipse, try to add Web Application nature to your maven project [A complex modification involving modification of .project and .classpath files along with addition of few other files]. I would recommend modifying your pom.xml file accordingly
I use tomcat with eclipse in 'Use tomcat installation' mode. My problem is, that eclipse overwrites tomcats server.xml every time, and deletes my crossContext="true" elements.
Should I use custom location? Or the eclipse setup is wrong?
Thanks!
You can edit the equivalent configuration files inside your "Server" project/folder in the eclipse workspace. Those are the configuration files with which eclipse is overwriting the ones found under your Tomcat installation.
I have experienced a lot of pain getting Eclipse to interact nicely with Tomcat. I recently switched over to Jetty and I will never go back! It's especially easy to use if you use Maven as your build manager. If you use Jetty for development, you can still use Tomcat for deployment.
If you want to preserve Tomcat artifacts then you can choose "Use Workspace Metadata" option. This option will copy all configuration files to "{workspace}/.metadata/.plugins/org.eclipse.wst.server.core" directory but still use the installed Tomcat Binaries for starting and stopping server. This is a neat way to have multiple server configs using a single tomcat.
I am trying to use tomcat with eclipse. I have installed it all and got the tomcat plugin installed. I have put a .war file in the webapps folder of tomcat and have made sure autodeploy is set to true. The problem I am having is that I can't get tomcat to run this .war file. The tomcat server is started and running as it tells me under the servers tab at the bottom of eclipse. It also shows the name of my .war file under it and says synchronized meaning it at least knows its there. But I can't get it to work at all. Even when I go to the local host page it shows the title of apache tomcat but does not show the file. I want it to show me the .war file. It has the correct xml files and everything in it. Any help is much appreciated.
You may try to check whether the application is deployed or not. You can directly go to the Tomcat directory to see this.
Another possible thing could be, you might be typing the incorrect url.
http://localhost:8080/[your_application]
where 8080 is the port you have specified for tomcat.
You need to let Eclipse publish your web project for you when using the Eclipse Tomcat plugin instead of trying to manually deploy it youself.
The Tomcat plugin for Eclipe supports hot deployment whereby you can change jsp's etc without having to manually redeploy your web application.
If you have a valid web project in eclipse then you can check that it is being deployed by looking at the Server View.
Window, Show View, Other, Server
This window should contain details of your Apache server. (If no server is listed then you'll need to right click on the list and set one up.)
To check that your application is being deployed right click on your server and select Add/Remove projects. Check that your web project is listed. If it is not listed under Configured Project then add it.
If your project does not appear in the list then it probably wasn't setup as a Dynamic Web Project. You can fix this by by right clicking on the project to bring up project properties and then clicking on facets and then enabling Dynamic Web Project.
It is also worth having the Console view visible when starting/stopping Tomcat so that you can see the server output.
Start tomcat from the command line (not eclipse) and see if your webapp shows up. It should if you have indeed created a valid war file. If it doesn't work, check the logs.
You shouldn't be manually deploying the war file if you are using eclipse to launch tomcat. Running tomcat from eclipse does not necessarily use the same default workspace as the standalone tomcat. Check the configurations for the 'server': it may be that the eclipse launched server's webapp folder is empty.
If for some reason your webapp failed to initialize properly (error in the descriptor, an uncaught exception in a context listener, ...) tomcat will unload it and you won't see anything at http://localhost:8080/yourwebapp.
Is it there in the list of applications in tomcat manager?
if you havent done this...then follow the steps...
Go to http://localhost:8080/
Go to Tomcat manager and check if your application is there in the list of deployed applications. Try redeploying or starting the application if running=false. It usually tells you what is wrong when you do that.