I have an application which is being deployed in Tomcat 8. This application needs to be the context root.
To do this, I put a root.xml file in conf\Catalina\localhost folder and it worked.
Now, the problem is that when i debug through IntelliJ idea (Remote host) it is not being deployed as the root application.
Seems like the only way to fix this problem is to add context.xml file in META-INF folder and specify the configuration there.
Now, when I do this, context root configuration from context.xml file is not being picked up.
Any thoughts on this? Ultimately, I just need to debug the application through a remote server.
Related
I deployed spring boot war file on ec2 instance under tomcat's webapps folder (ROOT.war) and extract file but in webapps folder WEB-INF folder created instead of ROOT,I rename WEB-INF to ROOT and try to access API via postman that time 404 error showing
Dont try to rename the Web-INF directory. Also, what port are you trying to access the application?
I have a Spring/React webapp. In my application.properties file I defined spring.data.rest.base-path = /apiso when running the app locally, everything is accessible on localhost:8080/api. If I deploy this to my tomcat, the all the stuff goes to localhost:8080/warname/api.
I can easily define my warname in my properties file. And in React,
path: '/api/myStuff'
I can access my data.
Also I can change that to
path: '/warname/api/myStuff'
and everything will work. But to make things easier, it would be better to read the warname from my pom.xml so I wouldn't have to change every path in my .js. How to get that done?
If you have a directory named ROOT in your Tomcat directory, you have to remove it and change the name of your war to ROOT.war so that when Tomcat explodes the war it will be the main root project.
I cannot figure out how to deploy a website (not app) on Tomcat on my mac. I just want to have Tomcat serve the file index.html. I tried creating the file myapp.xml in library/Tomcat/conf/Catalina/localhost with the content:
<Content path="/myapp" docBase="/Users/jerryk/Development/myapp" />
But when I attempt to access the site with
"http://localhost:8080/myapp" or "localhost:8080/myapp/index.html"
I get a resource not found error.
http://localhost:8080 brings up the Tomcat control panel.
Any thoughts on what I am doing wrong? FWIW, this works fine on windows.
Thanks,
Jerry
I'm not sure what's going on with Windows, but theoretically, the docBase must point either to a .war file, or a directory that has the same layout as a war file.
So, you can't just have an index.html in that directory, you also need at least a WEB-INF directory with a minimal web.xml in it.
See, for example, http://oreilly.com/java/archive/tomcat.html
I have developed a Dynamic Java Project with Eclipse which involves web services(RESTful). After completion I tried to run my project Tomcat 7 runtime of Eclipse IDE, it works fine. I am able to access all my web services.
But, when I created a WAR file out of my project by right-clicking on project and exporting it to WAR file and placed .war file in Tomcat 7's webapps folder. Started the tomcat by running startup.bat, it throws below exceptions and I am not able t access any web service:
I have placed all the required jar files in lib folder of Tomcat.
Exception fixing docBase for context [/Books] (Books is my war file name)
Failed to create work directory [{CATALINA_HOME}\work\Catalina\localhost\Books]
Failed to create destination directory to copy resources.
Could anyone please let me know what I am missing??
Thanks in advance.
Regards,
Piyush
The failed to create "work directory" error can occur if the work folder does not exist in the tomcat7 folder.
Also this error can be caused by tomcat not having sufficient permissions to read, write and execute in the tomcat7 directory.
The issue is because, tomcat is not finding your web.xml location in the classpath.
Do below steps:
Right click on web project-->Properties-->Deployment Assembly--> Add your classpath to web.xml(src/main/webapp) in my case.
I have a Spring App, and I would like change the session cookie path. I know this can be done in the server's context.xml file, but I don't have permission to edit that file on my server. Is there another way to do this, maybe by adding another context.xml file somewhere?
Btw, I added a context.xml file to my project's META-INF folder, but it didn't work.
Bundle your context.xml with your war file.