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.
Related
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
Alternative title: Unable to find [main.SearchServlet], mapping my servlet in Tomcat whilst using annotations
I'm trying to migrate my web application from java netbeans glassfish jdk 1.8 to eclipse tomcat jdk 1.7.
I keep getting a 405 then 404 error when I try to perform my POST by pressing a button on my loaded index jsp.
javax.naming.NameNotFoundException: Name [main.SearchServlet/annj] is not bound in this Context. Unable to find [main.SearchServlet].
I thought that setting a <context root>/</context root> in web.xml would fix this. It did move my loading page from localhost/animelist/index and localhost/animelist down one level to localhost/ and localhost/animelist however it did not fix my error.
As it stands, my project does not run at http://localhost:8080/ or http://localhost:8080/index.jsp . It DOES run at http://localhost:8080/animelist1/ and http://localhost:8080/animelist1/index.jsp
The project works fine in my netbeans setup so my question is what do i need to do for my servlets to be mapped properly in tomcat?
Someone said that " Likely the only problem you have is that the application deployment in your secondary Eclipse isn't working properly yet. As in: the servlet class file is not deployed to the server at all." I'm not sure how to go about fixing this (or googling for it).
I have my classes instanced with
#EJB
private AnnJAXB annj;
and servlet with
#WebServlet(name = "SearchServlet", urlPatterns = { "/search" })
and like i said it all works in netbeans setup.
so do i have to do something with tomcat config or application properties, since deployment should be done automatically? why isn't mainClass.SearchServlet being found?
thankyou for reading. i am near the end i feel . it has been 15 hours trying to deploy this to a host and it is exhausting.
Hello i would like ask how it is possible configure jboss server for something like live, hot deploment:
every time when i change some code of my jsp,html,js or css file i always need to clean and build project than deploy project to jboss and again, agian and again. That cost alot of my time. I waste time for that. It will be easy when i could work on files which already use a started jboss (deployed). But this files is in WAR file "project.war" and throught my IDE (Netbeans) i cant edit this files (jsp,css,html or js). Netbeans made this file uneditable.
I Would glad for solution step by step how it is possible to avoid this boring process.
Edit Standalone.xml,change development to "true"
<configuration>
<jsp-configuration development="true"/>
</configuration>
Start JBoss.
Go to ServerLocation-> standalone\tmp\vfs
Sort by "Date Modified" descending
Open the first folder(something like deployment*******)
There will be your complete exploded war.
Go to the jsps,js,css location,edit & save the changes.
changes will be displayed live.
Follow this procedure to enable hot deployment enable in JBOSS
It will work on JBoos AS 7.0.1 and should work on other versions with slight changes
Go to JBoss administrative panel (by default localhost:9990)
Now in profile settings open Core - Deployment Scanners
Turn on Autodeploy-Exploded (set to true)
You can set scanner time (by default 5000 ms) to appropriate as
according to you your (I prefer to set 2000, for more fast incremental
publishing when I make changes in projects)
That it.
Now JBoss make HOT deploy for almost all kind of files
I think that you're looking for something like JRebel. For those who haven't had the chance to hear about it, it's a magic tool made to get rid of such annoying redeploys after every modification made in your source files.
As you're using Netbeans IDE, this a dedicated tuto explaining how to set up JRebel.
I have the same problem. My solution is to run the program on debug mode without editing config file. Once you are done, you can see the result without restarting.
If you are running JBoss EAP 7.x, add the following to your standalone XML:
<subsystem xmlns="urn:jboss:domain:undertow:7.0" default-server="default-server" default-virtual-host="default-host" default-servlet-container="default" default-security-domain="other">
...
<servlet-container name="default">
<jsp-config development="true" />
<websockets />
</servlet-container>
...
</subsystem>
Deploy the app as exploded (project.war folder), add in your web.xml:
<web-app>
<context-param>
<param-name>org.jboss.weld.development</param-name>
<param-value>true</param-value>
</context-param>
Copy class/jsp/etc,
update the web.xml time stamp every-time you deploy(append blank line):
set PRJ_HOME=C:\Temp2\MyProject\src\main\webapp
set PRJ_CLSS_HOME=%PRJ_HOME%\WEB-INF\classes\com\myProject
set JBOSS_HOME= C:\Java\jboss-4.2.3.GA-jdk6\server\default\deploy\MyProject.war
set JBOSS_CLSS_HOME= %JBOSS_HOME%\WEB-INF\classes\com\myProject
copy %PRJ_CLSS_HOME%\frontend\actions\profile\ProfileAction.class %JBOSS_CLSS_HOME%\frontend\actions\profile\ProfileAction.class
copy %PRJ_CLSS_HOME%\frontend\actions\profile\AjaxAction.class %JBOSS_CLSS_HOME%\frontend\actions\profile\AjaxAction.class
ECHO.>>%JBOSS_HOME%\WEB-INF\web.xml
I am using JBOSS AS 7.2
in http://127.0.0.1:9990/console/index.html#deployment-scanner
Configuration
⇒
Subsystems⇒
Subsystem
⇒
Deployment Scanners
Click on Edit, turn "Auto Deploy Exploded" to true.
You can change to JBoss see the deployments folder each ten seconds
<subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
<deployment-scanner path="deployments" relative-to="jboss.server.base.dir"
scan-interval="10000"/>
</subsystem>
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 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!