How do I go from embedded Jetty web project to standalone server? - java

I build restful web service using maven on Eclipse and test with embedded server. All of this succeeds, now I want to deploy on a standalone Jetty server.
I was able to get Jetty running but when I go http://host:8080/my-war-file/ I see only directory with META-INF and WEB-INF, which Jetty thinks are both empty.
I do not believe there is a problem with my war file
/my-war-file
/META-INF
/WEB-INF
/classes
/lib
web.xml
How can I access resource classes through browser running Jetty standalone?

Related

Is it possible to deploy Angular app on IBM Websphere Application Server?

We're using IBM RAD for development and IBM Websphere Application Server as our web app server here at work. Give these constraints, would it still be possible to develop and deploy Angular SPAs? Like install a Typescript plugin for RAD probably, but how will you deploy it to WAS if there are no EAR files generated?
You'll need to create a web module (if you haven't already) and package the result of the Angular build (the contents of the dist/ directory, by default in Angular 2) into the root of your web module, so that it can be served as static content. In Eclipse, the contents of the WebContent folder are placed in the root of the war. Then let RAD package up your web module into a war and possibly ear and deploy it.
That web module should have the following in web.xml in your web module, in order to allow deep links to be redirected back to the SPA so the router can route them properly:
<error-page>
<error-code>404</error-code>
<location>/</location>
</error-page>

Hot depoyment in Jetty Application Server

We are migrating from Jboss-as to Jetty. As of now as part of the continuous build and deployment process, Jenkins/Maven is being used to build and deploy the WAR to remote Jboss using the management native port(hot deployment). No physical WAR file is placed under the deployments folder. Below maven plugin is being used.
org.jboss.as.plugins:jboss-as-maven-plugin:7.6.Final:deploy-only -Djboss-as.hostname=server name -Djboss-as.port=server port
We cannot copy the WAR to webapps folder due to some restrictions. I am looking for a solution similar to jboss-as-maven-plugin, since Chef/Puppet/Ant Script/Shell Script, is not feasible for us.
Is there any similar process for hot deploying to remote jetty server without physically copying the WAR file?
You could write a Servlet which does this.
It only needs to accept a POST request, which contains some additional parameter headers required for the deplyoment (for example the file name), and the WAR in the request body.
Then upload the the WAR by POSTing it to the Servlet URL.
The Servlet would just write the binary data to the Jetty webapps directory.

OpenShift deploy java configured web project

I try to deploy webproject which do not have web.xml and WEB-INF, and fully configured using spring mvc java configuration. .war file works perfectly on local machine in tomcat 7. But when I put war on the openshift application using winscp and then trying to connect to it, I get throws 404 notfaund response. Maybe someone can explain me what can be wrong. Also I use html not jsp for web content.
Should I install additionaly java to application?
Should projects be always configured with web.xml?
You can either deploy war or can add project folder like:
$TOMCAT_HOM/your-project-directory/.html,.jsp/WEB-INF/class (all java files) and WEB-INF/lib (your all jars) + WEB-INF/web.xml
make sure java is installed and all variable sets on the system
you must add all your java files in web.xml

Deploying a Dynamic Web Project with Tomcat

I currently have a working servlet created in Eclipse. When running it from the Tomcat plugin, everything works, and my app shows up at localhost:8080/project_name/. However, when I package the project into a .war file and place it in the /webapps directory of Tomcat and start the server, the servlet cannot be accessed. In Terminal, I can see Tomcat loading my project, and a temporary folder of the unarchived project is also created in /webapps. However, I simply cannot access my servlet.
Note:
I'm using Tomcat 7 and I don't have a web.xml file in my project.
How are you creating the war file? Check if your war files contain jar files under WEB-INF/lib folder and if the class files are not missing. You can easily verify it under tomcat/webapps/[project name] folder.

Deploying GWT RPC app in Tomcat

As per the Google tutorial, I have developed the basic StockWatcher application, that makes an RPC call to the server, which sends some data, which is displayed on the client.
I now want to deploy it in Tomcat, such that if call something like localhost/StockWatcher, I should get the same experience as when running the app from GWT in development mode.
How do I do this? There is a similar topic here, but I couldn't much understand it. If I only copy the compiled war folder, what happens to the GreetingServiceImpl class which handles the RPC? And how do I do the mapping such that localhost/StockWatcher maps to localhost:8080 (something like Mod_Rewrite)?
Steps to deploy war on TOMCAT
1)Compile you gwt web application
2)Copy the war file
3)Add all libraries(jar files) in lib folder of war file
4)Rename your war as "myapp"
5)create a .war file with that "myapp" folder
6)start tomcat with catalina.bat run.
For step5 (generating .war file ):Preparing .war file from command line
Normally if you deploy well your war directory and you are able to start tomcat you have done everything. If you access your page using this url : localhost:8080/StockWatcher gwt will know that it must use that url as a baseURL for all gwt/rpc requests.
To generate the war using Eclipse : right click on the project -> export -> war. You will have the war exported with all the dependencies inside. just unzip it in the ROOT directory

Categories