Error in running a Web project via Eclipse (deployed to tomcat) - java

I am trying run a Spring MVC based project via eclipse, but each time I try to access the app, getting following error:
WARN PageNotFound:947 - No mapping found for HTTP request with URI [] in DispatcherServlet with name ''
The strange part is, if I manually generate the WAR and copy over to the SAME tomcat installation and start the server manually, it works without any problem.
I have tried to "clean", "publish" again, change the tomcat webapps directory in "Servers" configuration, but no luck.
Any suggestion/idea in this regard highly appreciated.
Thanks!

properties -> deployment assembly -> make sure you have declared all the dependencies here to be included in the deployment war.
If you use maven, choose to include all maven dependencies.
And you need to add all projects you have in your workspace and used by your web project if any.

Related

How to configure Apache tomcat with Intellij IDEA?

Can someone tell me steps and permissions that are required for running maven project in intellij idea with tomcat to debug server project in windows? I have tried but intellij failed to deploy the war file. I guess there are some certain steps and permissions which I am missing.
Im afraid that you built artifact failed. You can check tomcat's logs in the folder path like:
C:\Users\user\.IntelliJIdea2017.1\system\tomcat\Unnamed_tomcat\logs
Normally, I will create tomcat as below (of course, it run well)
1. Create local tomcat
2. Config tomcat home
Click Configure button, browse to tomcat_home where you installed tomcat
3. add artifact (Deployment tab)
Ok, done. Now you can start tomcat. If building artifact is correct, your application will be up (let's check tomcat's log as I pasted above).

Is it possible to add multiple war files to deployment for run/debug configuration in IntelliJ IDEA?

I try to debug my web app by IntelliJ IDEA Ultimate. My app have multiple WARs. At Run/Debug Configuration I add new Tomcat Server. At the Deployment tab I have:
If I add more than one WAR artifact I get error Duplicate context path '/'.
Question for this context is not answered here for a long time: Which application context set in IntelliJ IDEA for Tomcat?
So, let's clear: Is it possible to add multiple war files to deployment for run/debug configuration in IntelliJ IDEA?
You Must add each WAR file in separate tomcat server that created in servers in Intellij IDEA and set a different port for each one.
After that run both of them.

Deploying from intellij to local web logic

I am new to weblogic and have joined a team that has a number of projects. These projects have a master ant build that creates the associated ear, war, jar files and places them in a shared folder. This makes it handly to deploy to weblogic via the weblogic console. However, I have not found a way to make this process work with intellij's weblogic server integration.
I created a server instance in intellij and a run configuration that triggers the master build prior to running the weblogic server. I am not sure how to get the resources from this shared file and deploy them. Any guidance is greatly appreciated,
Ant build should not be used in local server deployment for weblogic. They just create deployable files.
In order to deploy the project to weblogic on IDEA, you must first create an artifact. Hit Ctrl+Shift+Alt+S(Project Structure Screen) and on the artifacts section, click "+" to create a new artifact. In the dropdown, you shuld see different kinds of deployable artifact types. Choose the appropriate type and it will create an artifact for you. If your configuration is correct, it should gather all the files needed in that artifact by itself. After that, you must go in the Run/Debug configuration screen for your local weblogic server and on the "Deployment" tab, choose the artifact you created.
Here
Run/Debug Configurations Screen:
Notice the "Before launch" section. You must see your newly created artifact there. If not, simply click "+" and choose your artifact.
Take a look: Packaging the application in a JAR
It explains a jar deployment, but the process is really the same. You just have to choose web application or JavaEE application. Remember;
choose JavaEE Application for ear packaging.
choose Web Application for war packaging.
Exploded means it will deploy the extracted content of the war/ear. You should stick with exploded.

Deploying external wars in Tomcat via IntelliJ Idea

I have a project that is dependent on two war files being deployed to Tomcat. So every time I want to test it, I need to build an artifact and manually deploy it alongside the two wars. Is there a way to somehow add those war files to my Idea project so they can be deployed automatically by pressing Shift+F10.
I would deploy it manually, but I have several people working on the project and it would greatly simplify the communication.
Wars are external and they have no sources, so creating new modules/artifacts out of their source is out of the question.
Could you help me?
Since the link on the accepted answer is dead, here is the process, step by step (I'm using Intellij 14):
1) Select Run/Edit Configuration
2) If no Tomcat Run Config exists yet, create one
3) Select the Tomcat run config just created, on Deployment tab, under Deploy at server startup section, click the "+" (right sidebar), select External source, and select your war file.
You can add external webapps to deploy at startup at the Deployment-Tab of your tomcat runtime configuration page.
https://www.jetbrains.com/idea/help/run-debug-configuration-tomcat.html?search=tomcat#d884440e708

Why Tomcat library folder WEB-INF/lib is empty?

I deploy my Maven webapp using Spring MVC in Eclipse Tomcat. Everything works OK for quite a week. Suddenly, today I modify a properties file, rebuild and redeploy the webapp. There's a class not found error:
SEVERE: Error configuring application listener of class org.jasig.cas.client.session.SingleSignOutHttpSessionListener
java.lang.ClassNotFoundException: org.jasig.cas.client.session.SingleSignOutHttpSessionListener
Look at publish folder (tmp0) of Tomcat server plugin located in workspace folder, there are no jars in WEB-INF/lib any more. I don't know why? I have rebuilt/deployed it many times today, and have found no problem.
Could someone give an advice? Thanks very much.
EDIT:
I can't find a right solution for this problem, though I temporarily bypass it by removing the web app from Tomcat Server, do a clean up, then add it back again.
Do you have m2eclipse WTP integration installed? There are few things you could try:
Maven->Update project configuration
Close and open project
Remove project from Tomcat instance in WTP, Clean up and add it back.
Depending on your version of Eclipse and m2eclipse/m2e and WTP the integration could be finicky sometimes.
Is this option enabled? ProjectName (right-click) > Maven > Enable Dependency Management
You should have in ProjectName > properties > Java Build Path > Libraries an item called Maven2 Dependencies
Is your M2_REPO variable set? Window > Preferences > Java > Build Path > Classpath Variables
If it's all ok, check the war that Maven is creating to see if the libs are there and in the correct folder (web-inf\libs). Check the maven output when generating the war.

Categories