First of all thank you to read me and try to help me!
I'm working for the first time with Tomcat 9. I have a WAR file of my project and I want to deploy it in my domain. But I'm having some problems. I have been looking for different tutorials and reading here differents solutions but I cant get one that works for me.
I can deploy my WAR file in http://localhost:8080/myProjectMed/ but I would like to deploy it in my domain: www.getInfo.ue.com/spyInv ... How can I do this with Tomcat 9?
Thank you guys :)
Go to apache-tomcat\conf folder and open the server.xml.
Change the following lines in that :
Example : if you have domain "www.mycompany.com" :
<Host name="www.mycompany.com" ...>
...
<Alias>mycompany.com</Alias>
...
</Host>
Look this url for more information on server configuration :
https://tomcat.apache.org/tomcat-9.0-doc/config/host.html
Related
I want to deploy a Spring boot application in an external Tomcat server version 9. I am able to deploy it and working the endpoints also. But properties I have set in application.properties file those are not working. Like server.servlet.context-path=/myapp is is not working instead the context path which I am getting is http://localhost:8080/myapp-0.0.1-SNAPSHOT/api/ping.
I am using 2.3.10.RELEASE and Java 1.8 and Tomcat version 9.0.46 Can anyone please help me out with this.
But everything is perfectly working on embedded tomcat. Thanks in advance and any suggestion, comment is highly appreciated.
Can anyone please help me with how I can do this - My war file name would be myapp-0.1.war but the context path of the application would be like this localhost:8080/myapp/api/ping
Use finalName property in your build file (pom.xml for maven)
<finalName>myapp</finalName>
When you run a Spring Boot application in an external servlet container, the server.* properties do not apply.
If you are willing to change the naming convention you can drop a WAR file named myapp##0.1.war in the $CATALINA_BASE/webapps directory and benefit from parallel deployment (cf. parallel deployment).
If you want to stick to your naming convention, you can create a folder for your WAR files (e.g. $CATALINA_BASE/webapps-available) and create a deployment descriptor $CATALINA_BASE/conf/<engine_name>/<host_name>/<context_path>.xml (in your case probably $CATALINA_BASE/conf/Catalina/localhost/myapp.xml) with the following content:
<Context docBase="${catalina.base}/webapps-available/myapp-0.1.war" />
I am new to spring development so i am stuck here. Is there any configuration while switching spring + maven project from linux to windows. I am running on tomcat server 7. The project is initially developed in linux. I have moved all the file from linux to wondows. While running on server, i get error The requested resource (/myproject/login/) is not available. Do i need to make any changes or add add in configuation.
Thanks in advance.
I think you have missed something.
Try this.but i'am not sure this is working or not.
Tomcat, by default invoker servlet disabled (commented out in the web.xml file). You have to create a 'servlet' and a 'servlet-mapping' entry in your web.xml.
Once you do, you can get rid of the "servlet/" part of your url.
Check out the following URL for more information regarding the invoker servlet:
http://faq.javaranch.com/view?InvokerServlet
I am using Java API (maven project) for elastic search. I configured elasticsearch.yml for path.data field as one of the directories. But when I run my code for indexing, in addition to the folder mentioned in config yml file, it also creates a /data/ directory inside the root of the project folder. I am unable to understand why it do so. Can someone please help.
In elasticsearch.yml
path.data: /data/servers/es.data
Thanks.
I also got this issue. In my case (I use Spring Boot) I think the issue is, I forgot to define a bean of org.elasticsearch.client.Client. So I think Spring generated a Client bean and 'made' an elasticsearch DB in my project folder.
Hope this helps someone! Cheers
I have installed tomcat with eclipse and I have a project with a servlet. Here I put the structure of both:
Until this day the steps followed to run the servlet were:
1.Press button right above the following and give "Start"
Tomcat
2.Once booted, press right button over "UsuarioServlet.java" / Run as / Run on server
Done that everything worked properly but suddenly today when doing so I get the following:
What happened?.
I had this problem recently.
Here is what helped me.
Start tomcat and search in the console the real path where your tomcat is running.
Go there and open conf/server.xml. The plug-in that integrates tomcat and eclipse adds one long line there. Scroll down to see it. Here is how this line looks on my machine.
<Context docBase="C:\workspaces\work7\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\ROOT" path="" reloadable="false"/><Context debug="0" docBase="C:\workspaces\work7\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\webapp" path="/mycompany-webapp-0.9-SNAPSHOT" reloadable="true" source="org.eclipse.jst.jee.server:webapp">
<Valve className="org.apache.catalina.valves.AccessLogValve" pattern="common" prefix="access_log." suffix=".txt"/>
Please pay attention on path attribute. It used to be /webapp but now it became /mycompany-webapp-0.9-SNAPSHOT. So, this is the real URL where the application is deployed.
I used to surf to my application using url http://localhost:8080/webapp.
Now I have to use http://localhost:8080/mycompany-webapp-0.9-SNAPSHOT.
Alternatively I can stop server, fix the path in server.xml manually, start server and use the "old" URL.
The point is that this behavior is not consistent. Sometimes (when project settings are being changed) this problem is fixed "automatically" but sometimes it returns. It happened not only on my machine but on computers of 2 other team members in company where I work.
I hope this information will help you. Good luck.
I m trying to deploy a web application using netbeans to glassfish 3.01 but i m not able to do so
Glassfish says
Inconsistent Module State
the web app has some jars and a ejb jar for a local ejb
Open the domain.xml file that you will find in this folder:
"your glassfish installation"/domains/"your domain"/config
In this file look for your application deployment configuration to manually remove it:
1) Remove the web-module tag
<applications>
...
<web-module availability-enabled="false" context-root="yourapplicatoinContext" ... />
...
</applications>
2) Also remove the application-ref to your application:
<server config-ref="server-config" lb-weight="100" name="server">
...
<application-ref ... ref="your application name" ... />
...
</server>
Just try this:
undeploy
stop Glassfish
start Glassfish
deploy
If you can't undeploy, try the other steps anyway. If you don't have any luck, you could try it this way:
stop Glassfish
edit domain.xml (probably in domains/domain1/config)- back it up first; remove all references to your app (probably under application / application-ref); just make sure it's still valid xml
start Glassfish
deploy
It should have solved it. If still no luck anyway, remove every file or directory related to your app, probably under domains/domain1/generated and domains/domain1/applications/....
You could always recreate a new domain, but above steps will solve your problem.
You could be in such a situation after stopping Glassfish middle in a deploiyment, for example.
The other answers are really extreme. There is no need to create a new domain or re-install if you cannot redeploy your web application during development.
If you app is very complex, then consider scripting any clean up needed in a Production environment. The below steps will keep you up and working in the short term.
To re-deploy a web app to a single domain on Glassfish 3.1, do the following:
Stop Glassfish from the command line.
Delete all the files in the following directories:
glassfish\domains\domain1\generated
glassfish\domains\domain1\applications
Start Glassfish from the command line.
Deploy your app via the Admin Tool or command line.
In Glassfish 5, I searched for my app name in the domain.xml and deleted all the tags mentioning it. There was one occurence in the beginning (<system-applications>) and one at the end at approx. line 460 (<applications>). Then redeploy worked!