run.sh - package X does not exist - java

I'm running ./run.sh from Alfresco All-in-One extension but I got the error:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.2:compile
(default-compile) on project repo-amp: Compilation failure:
Compilation failure:
[ERROR]
/home/user/signextension/sign/repo-amp/src/main/java/pt/empt/sign/fields/CreateFields.java:[3,25]
package com.itextpdf.text does not exist
[ERROR]
/home/user/signextension/sign/repo-amp/src/main/java/pt/empt/sign/fields/CreateFields.java:[4,25]
package com.itextpdf.text does not exist
[ERROR]
/home/user/signextension/sign/repo-amp/src/main/java/pt/empt/sign/fields/CreateFields.java:[5,1]
package com.itextpdf.text.pdf does not exist
My run.sh:
#!/bin/bash
# Downloads the spring-loaded lib if not existing and runs the full all-in-one
# (Alfresco + Share + Solr) using the runner project
springloadedfile=~/.m2/repository/org/springframework/springloaded/1.2.3.RELEASE/springloaded-1.2.3.RELEASE.jar
if [ ! -f $springloadedfile ]; then
mvn validate -Psetup
fi
MAVEN_OPTS="-javaagent:$springloadedfile -noverify -Xms256m -Xmx2G" mvn clean install -Prun
I try this:
#!/bin/bash
# Downloads the spring-loaded lib if not existing and runs the full all-in-one
# (Alfresco + Share + Solr) using the runner project
springloadedfile=~/.m2/repository/org/springframework/springloaded/1.2.3.RELEASE/springloaded-1.2.3.RELEASE.jar
itextpdffile=~/.m2/repository/com/itextpdf/itextpdf/5.5.7/itextpdf-5.5.7.jar
if [ ! -f $springloadedfile ] && [ ! -f $itextpdffile ]; then
mvn validate -Psetup
fi
MAVEN_OPTS="-javaagent:$springloadedfile -javaagent:$itextpdffile -noverify -Xms256m -Xmx2G" mvn clean install -Prun
But I got the error:
Failed to find Premain-Class manifest attribute in
/home/user/.m2/repository/com/itextpdf/itextpdf/5.5.7/itextpdf-5.5.7.jar
Error occurred during initialization of VM agent library failed to
init: instrument
Any help for solve this?

The itext library is not a javaagent library, check this link to learn more about java agents and what are they meant for !
The right way to add itext dependency to your project is by adding this snippet:
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.7</version>
</dependency>
To your main pom.xml file (or the repo-amp pom.xml alternatively) (in the dependencies section). And of course roll back any changes you made to the run.sh file !

Related

Maven build fail: "invalid target release" only in GitLab CI

Part of my GitLab CI pipeline uses Maven ( mvn test ). Maven fails to build my test project with the following error:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project GenericTests: Fatal error compiling: invalid target release: 13 -> [Help 1]
I did some research and apparently setting JAVA_HOME to the location of JDK 13 would work, and it does, but only when I do it by hand locally via SSH.
In my pipeline, even if I export JAVA_HOME right before running mvn test I still get the same error.
script:
- export JAVA_HOME=/usr/java/jdk-13.0.2
- mvn test
Why does this work differently between GitLab CI and SSH? Could it have to do with the fact that GitLab CI is a non-interactive shell? What can I do to remedy this?
EDIT: I also tried to add a release tag in pom.xml like so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>13</release>
</configuration>
</plugin>
but this only resulted in another error during build time:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project GenericTests: Fatal error compiling: invalid flag: --release -> [Help 1]
It turned out to be a mess-up on my part: mvn test was being executed by means of an alias, which was actually sudo mvn test. Hence why the environment variable wasn't being used and why I got Mojo permission denied errors locally when I tried to rerun tests.

Jenkins Setup Issue

I have done the Jenkins Setup to clone solution from Github Repo and trigger the build and solution should run on multiple browsers in parallel (I'm using ANT build).
But when I'm trying to run scripts, its triggering the build but unable to clone solution on VM, throwing below error
Started by upstream project "HippoAutomationTests" build number 12
originally caused by:
Started by user Andy Williams
[EnvInject] - Loading node environment variables.
Building on master in workspace /x01/builds/workspace/HippoAutomationTests/browser/Firefox
using credential b89b0ace-6852-43d4-83a7-83f3ba77a290
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
> git config remote.origin.url https://bitbucket.org/kohler_source/hippoautomationtests.git # timeout=10
Fetching upstream changes from https://bitbucket.org/kohler_source/hippoautomationtests.git
> git --version # timeout=10
using GIT_ASKPASS to set credentials Bitbucket Credentials
> git fetch --tags --progress https://bitbucket.org/kohler_source/hippoautomationtests.git +refs/heads/*:refs/remotes/origin/*
Checking out Revision 104215052b7b4ae548eb2a4782bd9292bc93b95a (refs/remotes/origin/master)
> git config core.sparsecheckout # timeout=10
> git checkout -f 104215052b7b4ae548eb2a4782bd9292bc93b95a
Commit message: "Updating the solution"
> git rev-list --no-walk 104215052b7b4ae548eb2a4782bd9292bc93b95a # timeout=10
[Firefox] $ /x01/jenkins/tools/hudson.tasks.Ant_AntInstallation/Ant_Installation/bin/ant -file build.xml -DGroup=HippoIndia -Dbrowser=Firefox -DURL=http://plumbingindia.kohler.acct.us.onehippo.com/ -DrealTimeReport=true -DrunParallel=methods -Dselenium.capture.path=/Test/build/test-output/new -Dtest.url=http://plumbingindia.kohler.acct.us.onehippo.com/ -DuseVideoCapture=false -DbuildName=Test -DdbMode=false -Dselenium.timeout=60000 -DlocalExecution=true -DthreadCount=1 -Dtest.browser=Firefox -Dpackages=com.tests.* -Dtest.browser.version=11.0 -DretryCount=0 -Dselenium.port=4444 -DdbUrl=localhost:3306/isaf -DshowVideosOnPass=false -DdataProviderThreadCount=20 -Dgroups=HippoIndia -DuseProxy=false -DdbUser=isaf_user -Dselenium.host=localhost -DdbPass=isaf#123 -DreportType=iwafreport build.config run.test
Buildfile: /x01/builds/workspace/HippoAutomationTests/browser/Firefox/build.xml
build.config:
[copy] Copying 1 file to /x01/builds/workspace/HippoAutomationTests/browser/Firefox
clean:
[delete] Deleting directory /x01/builds/workspace/HippoAutomationTests/browser/Firefox/Test/build
init:
[mkdir] Created dir: /x01/builds/workspace/HippoAutomationTests/browser/Firefox/Test/build
[mkdir] Created dir: /x01/builds/workspace/HippoAutomationTests/browser/Firefox/Test/build/test-classes
[mkdir] Created dir: /x01/builds/workspace/HippoAutomationTests/browser/Firefox/Test/build/test-output
compile:
[javac] /x01/builds/workspace/HippoAutomationTests/browser/Firefox/build.xml:99: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 18 source files to /x01/builds/workspace/HippoAutomationTests/browser/Firefox/Test/build/test-classes
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
run.test:
[java] Error occurred during initialization of VM
[java] Error opening zip file or JAR manifest missing : /x01/builds/workspace/HippoAutomationTests/browser/Firefox/lib\aspectjweaver.jar
[java] agent library failed to init: instrument
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 4 seconds
[htmlpublisher] Archiving HTML reports...
[htmlpublisher] Archiving at PROJECT level /x01/builds/workspace/HippoAutomationTests/browser/Firefox/Test/build/test-output/IwafReport to /x01/jenkins/jobs/HippoAutomationTests/configurations/axis-browser/Firefox/htmlreports/HTML_20Report
ERROR: Specified HTML directory '/x01/builds/workspace/HippoAutomationTests/browser/Firefox/Test/build/test-output/IwafReport' does not exist.
Build step 'Publish HTML reports' changed build result to FAILURE
TestNG Reports Processing: START
Looking for TestNG results report in workspace using pattern: **/testng-results.xml
testng-results.xml was last modified before this build started. Ignoring it.
testng-results.xml was last modified before this build started. Ignoring it.
Saving reports...
Found matching files but did not find any TestNG results.
Finished: FAILURE
Please provide some suggestion to resolve the issue.
The aspectjweaver.jar JAR is missing on your build environment as per the error message:
[java] Error occurred during initialization of VM [java] Error opening zip file or JAR manifest missing : /x01/builds/workspace/HippoAutomationTests/browser/Firefox/lib\aspectjweaver.jar
[java] agent library failed to init: instrument
[java] Java Result: 1
Ensure that this JAR is present and don't use \ as a path delimiter. It should be lib/aspectjweaver.jar just like rest of the path.

Java - Launch4j, Build failure

I am trying to create an executable file from my project but unfortunately I have this failure:
Buildfile: C:\02_DEV\R_5_2_3\DiagraDB\build.xml
compile:
[javac] Compiling 1 source file to C:\02_DEV\R_5_2_3\DiagraDB\bin
dist:
[jar] Building jar: C:\DiagraDB_build\lib\DiagraDB.jar
[copy] Copying 1 file to C:\DiagraDB_build\mysql
[launch4j] Compiling resources
[launch4j] Linking
[launch4j] C:\02_DEV\R_5_2_3\DiagraDB\launch4j\bin\ld.exe: C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\crt2.o: No such file: No such file or directory
BUILD FAILED
C:\02_DEV\R_5_2_3\DiagraDB\build.xml:125: net.sf.launch4j.BuilderException: net.sf.launch4j.ExecException: Exec failed (1): C:\02_DEV\R_5_2_3\DiagraDB\launch4j\bin\ld.exe -mi386pe --oformat pei-i386 --subsystem windows -s C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\crt2.o C:\02_DEV\R_5_2_3\DiagraDB\launch4j\head\guihead.o C:\02_DEV\R_5_2_3\DiagraDB\launch4j\head\head.o C:\Users\MET4ABT\AppData\Local\Temp\launch4j5622103051739315213o C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\libmingw32.a C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\libgcc.a C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\libmsvcrt.a C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\libkernel32.a C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\libuser32.a C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\libadvapi32.a C:\02_DEV\R_5_2_3\DiagraDB\launch4j\w32api\libshell32.a -o C:\DiagraDB_build\DiagraDB.exe
Total time: 6 seconds
I have read some kind of stuff such as Launch4j / windres: how to set paths correctly? but I couldn't make it work for mine.
(I have the JDK Version 7 and windows 7.) I appreciate your suggestions about a solution for this problem. Thanks in advance.

Maven Error No POM in this Project when performing archetype:generate

I am trying my hands on the Akka Pi java tutorials
I am trying to creaate a maven project as stated in the tutorial
but any time I enter the command to create a maven project I get an error.
Below are the command and the Error.
C:\Program Files\akka-2.0.2>mvn archetype:generate \
C:\Program Files\akka-2.0.2>mvn archetype:generate \
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.206s
[INFO] Finished at: Wed Sep 26 02:50:38 BST 2012
[INFO] Final Memory: 11M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM
in this directory (C:\Program Files\akka-2.0.2). Please verify you invoked Mave
n from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProject
Exception
looks like maven is requesting for the POM file but it is not stated in the tutrials that I have to create a POM before generating the project.
I am actually new too maven so pardon me.
I am using maven version :3.0.4
and akka version 2.0.2
but the tutorial uses akka version 2.0.1 but i donn't think that is the problem
any suggestion please.
thank you
remove the \ then it should start to query for more informations.
I have no windows here, but on linux it shows the same behavior with
mvn archetype:generate /
HTH R
When some tutorials describes a mvn command to be executed that is covered in two rows or more, they might add an extra backslash at the new line (of the instruction) to indicate that the same command continues on next line.
This backslash should be removed BEFORE executing the command. For instance the command for setting up a Jersey Web Application might look like this:
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes \
-DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.2
but should be launched as below, without backslash:
mvn archetype:generate -DarchetypeGroupId=org.glassfish.jersey.archetypes -DarchetypeArtifactId=jersey-quickstart-webapp -DarchetypeVersion=2.2
If NOT removing this extra backslash you might get the error you described above.

Unable to build piggybank -> /home/build/ivy/lib does not exist

hey all I followed the steps here: http://wiki.apache.org/pig/PiggyBank
to build the piggybank jar but I keep getting the output below. I also built the pig project from source and reference that in my .bash_profile:
cloudera#cloudera-demo:~/piggybank/java$ ./makepiggy.sh
Buildfile: /home/cloudera/piggybank/java/build.xml
download-hive-deps:
init:
compile:
[echo] *** Compiling Pig UDFs ***
[javac] /home/cloudera/piggybank/java/build.xml:100: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
[javac] Compiling 153 source files to /home/cloudera/piggybank/java/build/classes
BUILD FAILED
/home/cloudera/piggybank/java/build.xml:100: /home/build/ivy/lib does not exist.
here is my bash_profile:
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.22
export CLASSPATH=$CLASSPATH:/home/cloudera/pig/trunk/pig.jar
** UPDATE **
The docs were incorrect on the Wiki page, they appear to be correct now: http://wiki.apache.org/pig/PiggyBank
follow the new instructions and you should be fine
The docs were incorrect on the Wiki page, they appear to be correct now: http://wiki.apache.org/pig/PiggyBank
follow the new instructions and you should be fine
Create a directory for the Pig source code: mkdir pig
cd into that directory: cd pig
Checkout the Pig source code: svn checkout http://svn.apache.org/repos/asf/pig/trunk/ .
Build the project: ant
cd into the piggybank dir: cd contrib/piggybank/java
Build the piggybank: ant
You should now see a piggybank.jar file in that directory.

Categories