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
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" />
We are migrating our Web application from WAS5.1 (Java 1.4) to WAS8.5(Java 7) using Eclipse Oxygen and WAS Migration Toolkit plug in.
We are able to build and publish application successfully on WAS8.5 local server but while accessing home page of application, we are getting below error. We don't have any special setting at container level for WAS5.1 but not sure what is missing here.
Error 404: SRVE0190E: File not found: {0}.
I was getting this error when trying to run an EAR on the server using Eclipse. I couldn't find an answer so I deleted the EAR and the project from my computer and re-cloned the project and made a new EAR. Somehow everything worked fine after doing that.. not going to question it. The old "unplug and plug back in".
Please check the web.xml file. I faced same issue and found that web.xml was got overritten with some default values.Not sure how it happened.but changing it to old values was working fine.
Check the jsp pages and if any errors for jsp in web.xml also can cause issues
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.
I created a Netbeans Platform Application using Netbeans 7.0.1 and the JDK 1.7.
I implemented my own Web Application on a normal module using Embedded Jetty 7.4.5 (consisting of a Web Service and a couple of servlets), and I created a Library Wrapper Module including all the Jetty jar files and the "jetty-j2sehttpspi-7.4.5.v20110725.jar" that I needed to be able to publish the Web Service's Endpoint. The Web module has a dependency on the Jetty module.
The code I'm using is this:
System.setProperty("com.sun.net.httpserver.HttpServerProvider",
"org.mortbay.jetty.j2sehttpspi.JettyHttpServerProvider");
server = new Server();
JettyHttpServerProvider.setServer(server);
//We read the config file
String[] configFiles = {"etc/jetty.xml"};
for(String configFile : configFiles) {
XmlConfiguration configuration =
new XmlConfiguration(new File(configFile).toURI().toURL());
configuration.configure(server);
}
// Web Services
QueryWeb qWS = new QueryWeb();
Endpoint.publish("http://0.0.0.0:" +
(server.getConnectors()[0].getPort()) + "/ws", qWS);
// Servlets
HandlerCollection hc = (HandlerCollection)server.getHandler();
ServletContextHandler sch =
new ServletContextHandler(ServletContextHandler.SESSIONS);
sch.setContextPath("/web");
sch.addServlet(stream.class, "/stream");
// We add the servlet handler to the server's context handler collection
// because it's the one used by the Web Service Endpoint
ContextHandlerCollection chc = (ContextHandlerCollection)hc.getHandlers()[0];
chc.addHandler(sch);
server.start();
When I try and run the application, I get the following error after the "Endpoint.publish" call:
Exiting C:\Program Files (x86)\NetBeans 7.0\harness\run.xml.
Exiting C:\Program Files (x86)\NetBeans 7.0\harness\run.xml.
C:\Program Files (x86)\NetBeans 7.0\harness\suite.xml:500:
The following error occurred while executing this line:
C:\Program Files (x86)\NetBeans 7.0\harness\run.xml:225:
The following error occurred while executing this line:
C:\Program Files (x86)\NetBeans 7.0\harness\run.xml:193:
The application is already running within the test user directory.
You must shut it down before trying to run it again.
As far as I understand, this is happening because the system can't find the "org.mortbay.jetty.j2sehttpspi.JettyHttpServerProvider" class. Therefore it defaults back to the web server included in the JDK, which causes a conflict since we get both web Servers (Jetty and the JDK's) trying to run on the same port (in this case it's 8081).
The only way I managed to fix this problem was by copying all the Jetty jar files into the JRE's "lib/ext" folder (copying only the "jetty-j2sehttpspi-7.4.5.v20110725.jar" results in no errors, but the server won't start). In this way the system can find the class it needs and all it's dependencies.
I suppose that what's going on is that even if NetBeans uses it's own classpath loader, the System.setProperty method is ignoring this and trying to access the standard classpath, and since a NetBeans Platform Application doesn't actually let you change the classpath directly (that would beat the whole purpose of having modules administered by the NetBeans platform), I don't really know how to make it use the library included in the wrapper module.
I can keep developing the application with the temporary solution I found, but honestly, copying stuff into the JRE folders is not an acceptable solution and will eventually result in distribution and installation problems in client machines (already tried it in a Mac OS machine and I didn't even know where the JRE kept it's libraries to try and do the same dirty trick).
Therefore I want to ask you guys if there is any solution to this particular problem or if anyone has a better explanation of what's going on and how I might fix it without having to recreate the whole architecture of my project (which actually works OK except for this little inconvenient).
Thanks in advance!
Write your question to the mailing list, dev#platform.netbeans.org, and you're more likely to get an answer.
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!