web.xml not found during maven build of Tomcat application - mysql

I am receiving the following error when pushing a J2EE app to my OpenShift Tomcat application:
remote: [INFO] Webapp assembled in [40 msecs]
remote: [INFO] Building war: /var/lib/openshift/54eb9daa5973ca7b9a0000d9/app- root/runtime/repo/webapps/ROOT.war
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] BUILD FAILURE
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Total time: 4.339s
remote: [INFO] Finished at: Wed Feb 25 14:51:14 EST 2015
remote: [INFO] Final Memory: 8M/112M
remote: [INFO] ------------------------------------------------------------------------
remote: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-war-plugin:2.1.1:war (default-war) on project dragonfly: Error assembling WAR: webxml attribute is required (or pre-existing WEB-INF/web.xml if executing in update mode) -> [Help 1]
remote: [ERROR]
remote: [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
remote: [ERROR] Re-run Maven using the -X switch to enable full debug logging.
remote: [ERROR]
remote: [ERROR] For more information about the errors and possible solutions, please read the following articles:
remote: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I have my web.xml in webapp/WEB-INF/web.xml and in .openshift/config/web.xml
I'm also confused about webapp vs. WebContent.

The web.xml file must be placed under src/main/webapp/WEB-INF. The error you are getting is because Maven is not finding web.xml at this location.
Also, I will take a wild guess but I presume WebContent is the folder generated by Eclipse when you create a web-application. If this folder is present, then there is a issue with your Eclipse project configuration. You should follow Maven conventions through out your project (and add the Maven nature to your Eclipse project with the m2e plugin).

Related

GPG key skipped during maven release

I am following all the instructions listed here to release my project to sonatype repo: https://dzone.com/articles/publish-your-artifacts-to-maven-central
But still getting the following error during signing artifacts
[INFO] --- maven-gpg-plugin:3.0.1:sign (sign-artifacts) # exceptionless-client ---
gpg: skipped "0x9d0e3e1d": No secret key
gpg: signing failed: No secret key
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 42.750 s
[INFO] Finished at: 2021-08-03T10:52:18+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-gpg-plugin:3.0.1:sign (sign-artifacts) on project exceptionless-client: Exit code: 2 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rezad the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
I can see the key listed when I run gpg --list-key command.
I used git bash to generate new keys, but I didn't know that git bash also comes with a bundled gpg program and it was using that. However, the maven-gpg-plugin was trying to find keys using the gpg program installed under C:/Program Files(x86). After I created keys using this I installed it worked perfectly.

gcloud function: Could not find local artifact: How to solve?

My cloud function code, is a maven-jar-project. It depends on other internal maven jar, so I have added that dependency to the pom.xml.
Expected: I expect that the dependent jars will be automatically included in the cloud function deployment, however I get an error "could not find artifact". Local compilation & running does not have any issue.
I don't want to copy paste those dependency sourcecode directly to my gcloud maven project. [bad ]
[INFO] Installing <removed>-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.659 s
[INFO] Finished at: 2021-04-10T16:31:39-04:00
[INFO] ------------------------------------------------------------------------
>gcloud functions deploy response-adapter --entry-point fun.pubsub.<removed> --runtime java11 --memory 512MB --trigger-topic <removed>
--env-vars-file env.yml
Deploying function (may take a while - up to 2 minutes)...-
For Cloud Build Stackdriver Logs, visit:
Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: ...maven-plugin-2.2.0.jar
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/com/google/cloud/tools/appengine-plugins-core/0.8.1/appengine-plugins-core-0.8.1.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/google/inject/guice/4.2.1/guice-4.2.1-no_aop.jar (521 kB at 375 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/yaml/snakeyaml/1.21/snakeyaml-1.21.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-lang3/3.8.1/commons-lang3-3.8.1.jar (502 kB at 357 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/glassfish/javax.json/1.0.4/javax.json-1.0.4.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/tools/appengine-maven-plugin/2.2.0/appengine-maven-plugin-2.2.0.jar (76 kB at 53 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.19/commons-compress-1.19.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/tools/appengine-plugins-core/0.8.1/appengine-plugins-core-0.8.1.jar (236 kB at 164 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/commons-io/commons-io/2.5/commons-io-2.5.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/glassfish/javax.json/1.0.4/javax.json-1.0.4.jar (85 kB at 59 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/yaml/snakeyaml/1.21/snakeyaml-1.21.jar (299 kB at 205 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/commons/commons-compress/1.19/commons-compress-1.19.jar (615 kB at 416 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/commons-io/commons-io/2.5/commons-io-2.5.jar (209 kB at 141 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/google/cloud/functions/invoker/java-function-invoker/1.0.2/java-function-invoker-1.0.2.jar (4.2 MB at 2.6 MB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.127 s
[INFO] Finished at: 2021-04-10T20:35:09Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project gcf-removed-adapter: Could not resolve dependencies for project gcf-demo:gcf-removed-adapter:jar:0.0.1-SNAPSHOT: Could not find artifact myadaptor:removed-mapper:jar:1.0-
SNAPSHOT -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException; Error ID: efa79f31
To achieve this, you need to deploy from JAR. Like that, you create a JAR with all the dependency already included in it (maven shade). No resolution at deployment time, only get your JAR and put it in Cloud Functions.

Jenkins error: Authorization failed to svn in sonarqube.

I am using Jenkins 2.8 with Sonarqube Plugin 2.2.1. A week ago we had a problem with the sonar server and we get this error. To solve the problem we decided to create a new mysql schema and link it with sonar server.
We did something like this:
mysql –u root -plinux;
create database sonarqube2 character set utf8;
grant all privileges on sonarqube2.* to 'sonarsuer'#'localhost' identified by 'linux';
grant all privileges sonarqube2.* to 'sonaruser'#'%' identified by 'linux';
flush privileges;
Note: We used the same user we had in the old database
After update sonar.jdbc.url with the new data in sonar.properties and in Jenkins configuration we manage to deploy sonarqube again. Then, we tried to launch a SONAR job that we have already created before and we get this error:
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project cas: The svn blame command [svn blame --xml --non-interactive -x -w src/main/java/net/mycompany/cas/CookieRetrievingCookieGeneratorPatch.java] failed: svn: OPTIONS of 'https://my_svn_server/svn/mycompanyxf/cas/trunk/src/main/java/net/mycompany/cas/CookieRetrievingCookieGeneratorPatch.java': authorization failed: Could not authenticate to server: rejected Basic challenge (https://my_svn_server) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project cas: The svn blame command [svn blame --xml --non-interactive -x -w src/main/java/net/mycompany/cas/CookieRetrievingCookieGeneratorPatch.java] failed: svn: OPTIONS of 'https://my_svn_server/svn/mycompanyxf/cas/trunk/src/main/java/net/mycompany/cas/CookieRetrievingCookieGeneratorPatch.java': authorization failed: Could not authenticate to server: rejected Basic challenge (https://my_svn_server)
This is the whole stacktrace:
[INFO] --- sonar-maven-plugin:2.6:sonar (default-cli) # cas ---
[INFO] SonarQube version: 5.0.1
[WARNING] Invalid POM for org.samba.jcifs:jcifs-ext:jar:0.9.4, transitive dependencies (if any) will not be available, enable debug logging for more details
INFO: Default locale: "es_ES", source code encoding: "UTF-8" (analysis is platform dependent)
INFO: Work directory: /u01/jenkins_home/jobs/SONAR - MC - Cas/workspace/trunk/target/sonar
INFO: SonarQube Server 5.0.1
[INFO] [13:47:05.297] Load global referentials...
[INFO] [13:47:05.751] Load global referentials done: 458 ms
[INFO] [13:47:05.771] User cache: /home/tomcat/.sonar/cache
[INFO] [13:47:05.801] Install plugins
[INFO] [13:47:07.792] Install JDBC driver
[INFO] [13:47:07.802] Create JDBC datasource for jdbc:mysql://myserver:3306/sonarqube2?useUnicode=true&characterEncoding=utf8
[INFO] [13:47:11.353] Initializing Hibernate
[ERROR] [13:47:15.591] No license for plugin views
[INFO] [13:47:16.958] Load project referentials...
[INFO] [13:47:18.003] Load project referentials done: 1045 ms
[INFO] [13:47:18.003] Load project settings
[INFO] [13:47:19.038] Loading technical debt model...
[INFO] [13:47:19.097] Loading technical debt model done: 59 ms
[INFO] [13:47:19.115] Apply project exclusions
[INFO] [13:47:19.336] ------------- Scan CAS (Central Authentication Service)
[INFO] [13:47:19.339] Load module settings
[INFO] [13:47:21.334] Loading rules...
[INFO] [13:47:23.049] Loading rules done: 1715 ms
[INFO] [13:47:23.115] Configure Maven plugins
[INFO] [13:47:23.367] No quality gate is configured.
[INFO] [13:47:29.435] Initializer FindbugsMavenInitializer...
[INFO] [13:47:29.437] Initializer FindbugsMavenInitializer done: 2 ms
[INFO] [13:47:29.437] Base dir: /u01/jenkins_home/jobs/SONAR - MC - Cas/workspace/trunk
[INFO] [13:47:29.437] Working dir: /u01/jenkins_home/jobs/SONAR - MC - Cas/workspace/trunk/target/sonar
[INFO] [13:47:29.438] Source paths: src/main/webapp, pom.xml, src/main/java
[INFO] [13:47:29.438] Test paths: src/test/java
[INFO] [13:47:29.439] Binary dirs: target/classes
[INFO] [13:47:29.439] Source encoding: UTF-8, default locale: es_ES
[INFO] [13:47:29.439] Index files
[INFO] [13:47:30.480] 36 files indexed
[INFO] [13:47:31.213] Quality profile for java: Sonar way
[INFO] [13:47:31.213] Quality profile for js: Sonar way
[INFO] [13:47:31.300] JIRA issues sensor will not run as some parameters are missing.
[INFO] [13:47:31.392] Sensor JavaSquidSensor...
[INFO] [13:47:32.089] Java Main Files AST scan...
[INFO] [13:47:32.094] 25 source files to be analyzed
[INFO] [13:47:36.733] Java Main Files AST scan done: 4643 ms
[INFO] [13:47:36.733] 25/25 source files analyzed
[INFO] [13:47:36.746] Java bytecode scan...
[INFO] [13:47:37.302] Java bytecode scan done: 556 ms
[INFO] [13:47:37.305] Java Test Files AST scan...
[INFO] [13:47:37.306] 5 source files to be analyzed
[INFO] [13:47:37.626] 5/5 source files analyzed
[INFO] [13:47:37.627] Java Test Files AST scan done: 321 ms
[INFO] [13:47:37.633] Package design analysis...
[INFO] [13:47:37.684] Package design analysis done: 51 ms
[INFO] [13:47:37.801] Sensor JavaSquidSensor done: 6409 ms
[INFO] [13:47:37.813] Sensor QProfileSensor...
[INFO] [13:47:37.819] Sensor QProfileSensor done: 6 ms
[INFO] [13:47:37.819] Sensor Maven dependencies...
[INFO] [13:47:40.023] Sensor Maven dependencies done: 2204 ms
[INFO] [13:47:40.026] Sensor JavaScriptSquidSensor...
[INFO] [13:47:40.205] 6 source files to be analyzed
[INFO] [13:47:45.590] 6/6 source files analyzed
[INFO] [13:47:48.499] Sensor JavaScriptSquidSensor done: 8473 ms
[INFO] [13:47:48.506] Sensor CoverageSensor...
[INFO] [13:47:48.507] Sensor CoverageSensor done: 1 ms
[INFO] [13:47:48.507] Sensor InitialOpenIssuesSensor...
[INFO] [13:47:48.525] Sensor InitialOpenIssuesSensor done: 18 ms
[INFO] [13:47:48.525] Sensor ProjectLinksSensor...
[INFO] [13:47:48.557] Sensor ProjectLinksSensor done: 32 ms
[INFO] [13:47:48.558] Sensor VersionEventsSensor...
[INFO] [13:47:48.600] Sensor VersionEventsSensor done: 42 ms
[INFO] [13:47:48.600] Sensor FileHashSensor...
[INFO] [13:47:48.608] Sensor FileHashSensor done: 8 ms
[INFO] [13:47:48.610] Sensor CoberturaSensor...
[INFO] [13:47:48.616] parsing /u01/jenkins_home/jobs/SONAR - MC - Cas/workspace/trunk/target/site/cobertura/coverage.xml
[INFO] [13:47:49.078] Sensor CoberturaSensor done: 468 ms
[INFO] [13:47:49.078] Sensor SCM Sensor...
[INFO] [13:47:49.089] SCM provider for this project is: svn
[INFO] [13:47:49.089] Retrieve SCM blame information...
[INFO] [13:47:49.218] 36 files to be analyzed
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:04.240s
[INFO] Finished at: Fri Aug 12 13:47:54 CEST 2016
[INFO] Final Memory: 58M/955M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project cas: The svn blame command [svn blame --xml --non-interactive -x -w src/main/java/net/mycompany/cas/CookieRetrievingCookieGeneratorPatch.java] failed: svn: OPTIONS of 'https://my_svn_server/svn/mycompanyxf/cas/trunk/src/main/java/net/mycompany/cas/CookieRetrievingCookieGeneratorPatch.java': authorization failed: Could not authenticate to server: rejected Basic challenge (https://my_svn_server) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.6:sonar (default-cli) on project cas: The svn blame command [svn blame --xml --non-interactive -x -w src/main/java/net/mycompany/cas/CookieRetrievingCookieGeneratorPatch.java] failed: svn: OPTIONS of 'https://my_svn_server/svn/mycompanyxf/cas/trunk/src/main/java/net/mycompany/cas/CookieRetrievingCookieGeneratorPatch.java': authorization failed: Could not authenticate to server: rejected Basic challenge (https://my_svn_server)
Should I change aditional credential in Jenkins?
Any help would be appreciated.
See SonarQube 5.0 SCM support documentation for details on how to configure SVN authentication (which is what is failing here) using sonar.svn.username and sonar.svn.password.secured.
(side-note: SonarQube 5.0 is pretty old and known for having performance issues, you should really upgrade to latest/LTS version)

How to deploy Express 4 application with mysql database setup on openshift?

I am finding it difficult to deploy the Express4 app on Openshift.
The project is working fine on localhost but not being able to push on server
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 55d6d1367628e11bda000128 (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/nodejs
remote: #<IO:0x000000017462a0>
remote: #<IO:0x00000001746228>
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed
The app deployment fails on server.js ....
The express#3 version works fine on server.js(default they provide).
Any help for deploying express#4 version on openshift ???

Unable to see Openshift application

I added a new openshift application. I followed the instructions and uploaded my code via git push.
The upload logs seem to be fine:
1)the ROOT.war got created:
remote: [INFO] Packaging webapp
remote: [INFO] Assembling webapp [opinion] in [/var/lib/openshift/542ee542e0b8cd
2ca700037d/app-root/runtime/repo/target/opinion]
remote: [INFO] Processing war project
remote: [INFO] Copying webapp resources [/var/lib/openshift/542ee542e0b8cd2ca700
037d/app-root/runtime/repo/src/main/webapp]
remote: [INFO] Webapp assembled in [108 msecs]
remote: [INFO] Building war: /var/lib/openshift/542ee542e0b8cd2ca700037d/app-roo
t/runtime/repo/webapps/ROOT.war
remote: [INFO] WEB-INF/web.xml already added, skipping
remote: [INFO] -----------------------------------------------------------------
-------
remote: [INFO] BUILD SUCCESS
remote: [INFO] -----------------------------------------------------------------
-------
remote: [INFO] Total time: 1:24.196s
remote: [INFO] Finished at: Fri Oct 03 14:11:18 EDT 2014
remote: [INFO] Final Memory: 9M/91M
remote: [INFO] -----------------------------------------------------------------
2) Deployment was a success
remote: + rm -rf /var/lib/openshift/542ee542e0b8cd2ca700037d/jbossews//work/
remote: ++ ls /var/lib/openshift/542ee542e0b8cd2ca700037d/app-root/runtime/repo/
/webapps
remote: + '[' 'META-INF
remote: ROOT.war
remote: WEB-INF
remote: css
remote: fonts
remote: img
remote: js' ']'
remote: + rsync -rS --delete /var/lib/openshift/542ee542e0b8cd2ca700037d/app-roo
t/runtime/repo//webapps/ /var/lib/openshift/542ee542e0b8cd2ca700037d/jbossews//w
ebapps/
remote: + hot_deploy_enabled_for_latest_deployment
remote: ++ ruby_sdk latest_deployment_metadata.hot_deploy
remote: ++ oo-ruby -I/usr/lib/openshift/cartridge_sdk -rruby/sdk -e 'include Ope
nShift::CartridgeSdk; puts latest_deployment_metadata.hot_deploy'
remote: + enabled=false
remote: + '[' false == true ']'
remote: + return 1
remote: Starting jbossews cartridge
remote: Found 127.4.212.129:8080 listening port
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
To ssh://542ee542e0b8cd2ca700037d#opinion-expertviews.rhcloud.com/~/git/opinion.
git/
e2a907c..08d3a44 master -> master
However, when I hit the url(http://opinion-expertviews.rhcloud.com) I am still seeing the
"Welcome to your JBossEWS (Apache/Tomcat) application on OpenShift" screen
What am I missing?
Solved:
I was uploading my files incorrectly. Corrected way:
I compiled my projects into a war file, put it into the webapps
folder at root of the openshift git directory.
removed the pom.xml
file pushed the updated folder to my application
Application now available at:
http://app_name-namespace.rhcloud.com/app_name.
Thanks a lot for your help and guiding me, although it was stupid of me to miss these points
Since you are deploying your war file with a name other than ROOT.war, you will need to visit your application at the context that is the same as the name of the war file you deployed. For example, if your war file was named myapplication.war, your url would be http://app-domain.rhcloud.com/myapplication, to fix this, you can rename your war file ROOT.war, and your application would be available at http://app-domain.rhcloud.com/