I usually use Eclipse and Google Cloud Tools plugin for Eclipse so I'm not really familiar with the command line tools. Now I have some deployment issues and I'd like to try to deploy using "gcloud app deploy".
I installed Google Cloud SDK and managed to run this:
cd D:\path-to-eclipse-workspace\my-project
C:\path-to-google-cloud\gcloud app deploy src\main\webapp\WEB-INF\appengine-web.xml -v v1
The deployment seems to work, but when I check on appspot.com my servlets are not there - I get: Error: Not Found. The requested URL /hello was not found on this server.
Thanks!
Update:
It looks like Eclipse is not putting .class files in WEB-INF/classes folder, but it creates a build/classes folder in the root of the project.
So, should I just copy the classes folder to WEB-INF before deployment or is there a better way to do it?
I ended up doing this:
Configure Eclipse to put .class files in WEB_INF/classes folder:
Project Properties -> Java Build Path -> Source -> configure Default output folder to be WEB_INF/classes
Deploy to App Engine:
cd D:\path-to-eclipse-workspace\my-project
gcloud app deploy src\main\webapp\WEB-INF\appengine-web.xml -v v1
Related
Am using IntellIJ IDEA Ultimate Edition 2020.1.2 and Tomcat 8.5.55 on macOS Catalina 10.15.5
Have setup a run configuration inside IntelliJ for Tomcat.
Am able to run Tomcat via IntelliJ IDEA and everything works (am able to run tomcat and see my webapp inside Google Chrome & see catalina.out via IntelliJ) but when I go to the webapps dir, I don't see the unpacked war file anywhere?
cd $CATALINA_HOME/webapps
ls
Directory listing:
ROOT docs examples host-manager manager
Question(s):
How can I setup / edit my Tomcat local run configuration to move the war file (whether exploded or not) inside $CATALINA_HOME/webapps?
Where is this IntelliJ generated war file located?
Configure the artifact output path to be under webapps directory.
In the artifact output directory.
Normally there is no need to change it, IntelliJ IDEA instructs Tomcat to deploy from the configured artifact output location.
I have a Maven project which I need to run from VSCode. Right now the way I do it is:
Open the project folder in VSCode. Edit the java, js, html files etc.
Start my tomcat by running bin/startup.sh; tail -f logs/* ; in the apache tomcat's directory.
Open terminal in the project directory and run mvn clean install -DskipTests.
Then run cp /Users/path-to-my-project/target/myWebApp.war ~/apache-tomcat-8.5.23/webapps/ to copy the war file into the tomcat's webapp directory.
After which I can access my web application at localhost:8080/myWebApp.
Is it possible to do all of this in one click (or command) in VSCode. I know it can be done in Eclipse or IntelliJ but I want to work with VSCode.
I have installed the Spring Boot Extension Pack and Java Extension Pack in VSCode. I am just confused on how to setup the path to my tomcat, build the project and then copy the war file to the tomcat webapps folder.
Is it possible to do all of this in one click (or command) in VSCode. I know it can be done in Eclipse or IntelliJ but I want to work with VSCode.
To make your webapp visitable, just type:
Ctrl+`
in the VS Code to get a terminal, and then type:
mvnw spring-boot:run
in the application there is a suffix after the locahost:8080. So something like localhost:8080/mywebapp/...rest of the url. With the above method everything works but I loose that web app name suffix. Any idea how I can get it back?
In your application.properties file(in the src/main/resources folder in your spring boot project), add below line(for Spring boot v2.0.5):
server.servlet.context-path=/mywebapp
For older version, you may need:
server.contextPath=/mywebapp
See these links for reference:
How to set base url for rest in spring boot?
What is the purpose of mvnw and mvnw.cmd files?
how to run springboot app in visual studio code? is it possible or not?
I have successfully installed apache tomcat & verified it to be working using the curl command
curl http://localhost:8080/
Tomcat is installed in
/var/lib/tomcat8/
webapps/ROOT/index.html
webapps/ROOT/META-INF
lib
I have received following structure of the java app in a zip file
App/
build.xml
deploy.sh
run.sh
www/
*.jsp files
WEB-INF/lib/*.jar files
I want to install and run this app on my server. How can I do that. Specifically I want to know where to place these folders. Do I need to run any of the deploy or build files. Do i need to install the jar files? If I directly run one of the .jsp files from curl command, it crashes due to missing java class.
Perhaps I am missing something obvious but I am new to java env and could not find it from google.
If you haven't tried it yet, consider using Maven to build your projects.
This will automate and simplify a lot of similar work for you, like creating a .war file and deploying your project to Tomcat. With Maven, you have to set the <packaging>war</packaging> in pom.xml (a project configuration file) and run mvn tomcat7:deploy command.
For details look at the above link to Maven docs or for instance check out this tutorial.
You can also use the Tomcat Manager under (default) http://localhost:8080/manager to deploy the .war file manually.
I´m trying to deploy java application in OpenShift server. My application is divided in four projects: BBDD, Bussiness, Web Services and Web. When I create the application with openshift, it´s created this structure: src(this one has java, resources and webapp folders), webapps and pom.xml. I don´t know how to organize my projects into that structure to upload to the server.
I have put my web structure on webapp folder inside src. Then, I put the other projects on java folder. When I executed the application I can see my web pages and I can navigate for all of them but, when I call to a webservice I have the following error:
Http/1.1 404 not found
Thanks in advance,
Iban
Openshift is expecting to compile the application on their server using the pom.xml then run the application it built. To do that your project needs to be a maven webapplication project. Only when you have tested it locally would you expect that committing the code to your openshift server (using git) would it be able to compile and run the app successfully.
This means that you should not be uploading files using an SCP upload tool; you should be committing your source using git to your openshift server for it to compile then run your app.
The way I typically work with maven and openshift is to add a fragment of xml into the pom.xml to enable the jetty-maven-plugin to be able to use mvn jetty:run to build and launch the project to test it locally. If-and-only-if it works locally do I try to deploy it. That command is 'zero install' as maven downloads the jetty jars and runs them over your project.
Redhat openshift tends to promote redhat jboss AS application server as a Java solution so if you go down that route you should try mvn packageto make the war file and test it against a local jboss install before expecting it to work on the server. There is an approach where rather than committing code for the server to build and run you can build an EAR file locally and have that pushed to the server.
At the bottom of this answer I have a link to a demo I wrote which shows my preferred approach. I create my apps as a DIY cartridge which is an empty shell then customise the scripts in the .openshift folder to start the Java server of my choice. I use maven to build my webapp which I run using the jetty-maven-plugin to debug locally in Eclipse (maven IDE plugin lets me "debug as... > maven > "jetty:run"). Then I configure the pom.xml to build my whole app plus the jetty Java webserver into one huge runnable jar. Then I edit the start script to use "java -jar" to run my full app.
If you are using a DYI cartridge you don't need to use maven; I have used sbt as the build tool to create a runnable jar. You simply have to modify the scripts in the .openshift folder to download and run the tools you choose.
The demo I made GitHub at the link below has instructions on how to deploy it on openshift. So you may want to get that running then after you can both debug it locally and push it to your openshift server then rip out my code and add in all yours:
https://github.com/simbo1905/zkmongomaps
I tried everything in this tutorial, But when it cam time to deploy the web service i got this error.
As you can see the configuration it says doesn't exist actually exists. I searched Google but all I could find was instances where people had the same problem, but the resolution was never posted.
I found solution regarding mentioned problem. It seems Netbeans 7.4+ is not creating axis2 config file for deployment. You can do it manually.
here is the guide how to do it in French:
http://vincent-lecomte.blogspot.be/2014/10/java-probleme-config-axis2-et-netbeans.html
Below is my config for Netbeans 8.0:
1. Go to directory C:\Users\[Curr user]\AppData\Roaming\NetBeans\8.0\config\Preferences\org\netbeans\modules
2. Create folder "websvc"
3. In the folder "websvc" create file "axis2.properties"
4. In the file "axis2.properties" paste below text:
AXIS_DEPLOY=D:\\Tomcat\\webapps\\axis2 //change to the directory where axis2 is installed
AXIS_URL=http://[yourhost]:8080/axis2
TOMCAT_MANAGER_USER=user
TOMCAT_MANAGER_PASSWORD=password
Hope this helps.
Hi follow these steps to resolve the issue.
Step 1: Download axis2 plugin file “org-netbeans-modules-websvc-axis2.nbm” from Internet.Install plugin in netbeans and restart the netbeans.
Step 2: Browse location of .nbm file and click on install and then restart the netbeans.
The major problem after the creation of project is deployment in tomcat server.
While we are doing the deployment it shows the following.
"Neither deployment directory nor war file specified for Axis2 web application (Axis2 environment).
Please, specify the axis2.war or axis2 deployment directory location in
Tools -> Options -> Axis2 -> Deployment panel."
To resolve the above issue please follow the steps.
• Go to the following folder:
UserProfile\ AppData \ Roaming \ IDE \ 7.4 \ config \Preferences \ org \ netbeans \ modules.
• Create a subfolder "websvc".
• Create a "axis2.properties" file.
• Add the following properties (double slashes to the deployment directory):
AXIS_DEPLOY=C:\Program Files (x86)\Apache Software Foundation\Tomcat 8.0\webapps\axis2.war
AXIS_URL=http://localhost:8090/axis2
TOMCAT_MANAGER_PASSWORD=root
TOMCAT_MANAGER_USER=root
The final file path will be(For example):
C:\Users\BalaSubrahmanyam\AppData\Roaming\NetBeans\8.0.2\config\Preferences\org\netbeans\modules\websvc\ axis2.properties
Save the file and then restart the netbeans again and buid the project.
The customized axis2 war is now deployed in tomcat server.