when start application on cloudfoundry got error of 310, "web.xml not found" - cloud-foundry

Today when I tried to run the sample application hello-java which from git#github.com:SpringSource/cloudfoundry-samples.git, I got the following errors when start the application,
Starting hello-java-from-linux-1... FAILED
CFoundry::AppStagingError: 310: Staging failed: 'Staging task failed:
Staging plugin failed: /var/vcap/packages/stager/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.64/lib/vcap/staging/plugin/java_web/plugin.rb:28:in block in stage_application': Web application staging failed: web.xml not found (RuntimeError)
from /var/vcap/packages/stager/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.64/lib/vcap/staging/plugin/java_web/plugin.rb:22:inchdir'
from /var/vcap/packages/stager/vendor/bundle/ruby/1.9.1/gems/vcap_staging-0.1.64/lib/vcap/staging/plugin/java_web/plugin.rb:22:in stage_application'
from /var/vcap/packages/stager/bin/run_plugin:19:in'
I've checked the target war "hello-java-1.0.war" built by maven, the web.xml has been already packaged under WEB-INF.
Here is the pom.xml of the sample application,
http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.cloudfoundry.samples
hello-java
1.0
war
javax.servlet
servlet-api
2.5
provided
And here are the vmc version and maven version info,
- vmc 0.4.7,
- Apache Maven 3.0.4
Can anyone help on how to solve the issue? Thanks a lot!
BTW, I've searched the cloudfoundry support site, and found some tips to check log files, however seems that I cannot get log files to check the real error, I ran into the following issues when tried to get the log files.
[niy#niy-fedora hello-java]$ vmc files hello-java-from-linux-1 logs
Getting file contents... FAILED
CFoundry::AppStopped: 305: Operation not permitted on a stopped app
For more information, see ~/.vmc/crash

When deploying a java or spring WAR with vmc it's important to be in the same directory as the WAR file at the time you execute vmc.

Related

ClassNotFoundException - when building the image & push it to GCR using jib-maven-plugin in BitBucket pipeline

I am getting the below error in my GCP Cloud Run service:
Error: Could not find or load main class com.sdas.demo.sd.Application
Caused by: java.lang.ClassNotFoundException: com.sdas.demo.sd.Application
What I was doing:
I have a spring boot application where I used jib-maven-plugin. In BitBucket pipeline, I was executing the below command:
mvn clean compile com.google.cloud.tools:jib-maven-plugin:3.1.4:build -Dimage=eu.gcr.io/sdas-demo-dev/temp-service
After that deploying this GCR image to Cloud Run using gcloud command from BitBucket pipeline. This deployment failed with the error that 'Could not load main class'.
But if I run the mvn clean compile com.google.cloud.tools:jib-maven-plugin:3.1.4:build -Dimage=eu.gcr.io/sdas-demo-dev/temp-service from my computer git bash for the same spring boot application code and then deploy it to Cloud Run (via gcloud command or via console or via pipeline); it's deployed successfully.
I used 'mainClass' tag under jib-maven-plugin in pom.xml. But still it is unable to find or load the main class.
Can anyone help how to identify the problem? Is this a classpath issue or environment issue?
Issue sorted now.
Root cause:
'No resources found to compile' - I found this message in the build log. This message remind me something wrong within the application package.
My system is running on Windows 10 and my application directory starting with 'Java.com.demo.sdas' (J in capital). Since Windows is case in sensitive; it is not causing an issue.
BitBucket pipeline running on Linux server and it is case sensitive. Thus it is unable to find the application directory starting with 'Java.com.demo.sdas'.
Solution: Renamed the directory as 'java' and then everything is working as expected.

Trying to Use the InfoRecoverySample in IS 5.0.0

I'm trying t use the InfoRecoverySample in IS 5.0.0. I was able to build it as according to the instructions here:
https://docs.wso2.com/display/IS500/Recovering+Account+Information+Using+a+Webapp
However after placing the war file in [IS_HOME]/repository/deployment/server/webapps/ and restarting, I get errors in the application logs. Unfortunately they are very vague:
org.apache.axis2.deployment.DeploymentException: Error occurred while deploying webapp : [IS_HOME]/repository/deployment/server/webapps/InfoRecoverySample.war
Error occurred while deploying webapp : [IS_HOME]/repository/deployment/server/webapps/InfoRecoverySample.war
Error while deploying webapp: StandardContext[InfoRecoverySample.war].File[repository/deployment/server/webapps/InfoRecoverySample.war]
My best guess is that the pom.xml file is out of date because I see lots of references to 4.2.0. This is the pom.xml file I'm using:
https://svn.wso2.org/repos/wso2/people/chamathg/samples/is/InfoRecoverySample/pom.xml
Does it sound like I'm on the right track? If so, is there an updated pom.xml file (or sample project) out there?
TIA,
Mike
Deploy the war file in your tomcat/webapps folder, not the identity server webapps. then access via localhost:8080
edit:
The way the pom is designed is for deployment on your localhost, not the wso2 server. Despite what the instructions say. However, you can deploy it to [IS_HOME]/repository/deployment/server/webapps/ as long as you remove most of the jar files that are created in the war's WEB-INF/lib directory. These will conflict when being run from the IS. The only one you need to leave is org.wso2.carbon.identity.sso.agent-1.2.0.jar. remove, re-zip, and then redeploy.

Where does the hybris generate war file,Cloud foundry cannot detect the war file when pushing to pcf

i am trying to deploy hybris cuppy project to cloud foundry,But when i try to push it.it says
ERR No container can run this application
OUT Staging failed: Buildpack compilation step failed
ERR encountered error: App staging failed in the buildpack compile phase.
when i googled it i found it mostly occurs because if it couldnt detect the war file or jar file.Want to know where does hybris generate war file.
You can generate war for cuppy extension by running from 'cuppy' directory:
ant build_war
Then check console output.

unable to deploy application on cloudfoundry raising error 404 Not Found

i am trying to deploy spring application on cloudfoundry.but as a build war file of project using mvn package command.after that i used vmc push --appname target(directory)
i finished all the steps that need to push on cloudfoundry.
finally i got message uploading application-name....ok
then i entered command vmc apps
then it shows all my pushed applications....
there was url(http://cloudapp-project-master.cloudfoundry.com/) for my deployed application.
which i copied and placed in browser then it giving me 404 Not Found nginx
i don't know where is the problem....
Please help me to get out of this.
advanced thanks....
Can you look at the logs folder to see if the files there give more information.
vmc logs <app-name>
or
vmc files <app-name> logs/stderr.log
vmc files <app-name> logs/stdout.log
What is the status of the app when you run vmc apps? I would recommend you to file a ticket at http://support.cloudfoundry.com with detailed information about the issue and maybe share the project so that they can reproduce the issue easily. You will need the account registered in cf.com to be able to login.

deploy a node.js application to api.cloudfoundry.com. and got an error

Error 402: App packaging failed: 'Failed synchronizing resource pool'
I got this error when deploy a node.js application to api.cloudfoundry.com.
the vmc I used is:
vmc 0.3.10
I want to know how does this error happened. Is there something wrong with my vmc? or something wrong with my node.js application?
Thank you.
You'll definitely want to upgrade to the latest vmc. "gem update" should refresh it to 0.3.18 for you but if not, "gem install vmc" to grab the newest.
What steps did you follow to deploy the app - did you just run vmc push and follow the prompts, did you have a manifest.yml file in place (probably not as vmc 0.3.10 may have pre-dated manifest support), did you provide additional parameters to vmc push?