I have built my own hippo project based on hippo-maven-archetype.
I have prepared the PostgreSQL configuration of repository and created hippo database.
Then I've built my app and run it by maven (mvn -Pcargo.run -Drepo.path=storage).
All is ok, Postgresql repository was initialized successsfully and hippo works.
Now I am trying to deploy my project on my Linux server, as described here, using tomcat 8 and java 8.
All is ok, except that the repository does not initializing in any way.
Cms Web-page always redirects to localhost/cms/wicket/bookmarkable/org.hippoecm.frontend.NoRepositoryAvailablePage.
At tomcat startup there are no errors, but also there are no messages about bootstrapping the repository.
After successful startup, log files contain exception: java.lang.IllegalArgumentException: The resource path [WEB-INF/storage] is not valid
Tomcat java command prompt (as ps shows:)
/usr/bin/java -Djava.util.logging.config.file=/opt/apache-tomcat/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -Xmx512m -Xms128m -XX:PermSize=128m -Drepo.path=storage -Drepo.config=file:/opt/apache-tomcat/conf/repository.xml -Drepo.bootstrap=true -Dlog4j.configuration=file:/opt/apache-tomcat/conf/log4j.xml -Djava.endorsed.dirs=/opt/apache-tomcat/endorsed -classpath /opt/apache-tomcat/bin/bootstrap.jar:/opt/apache-tomcat/bin/tomcat-juli.jar -Dcatalina.base=/opt/apache-tomcat -Dcatalina.home=/opt/apache-tomcat -Djava.io.tmpdir=/opt/apache-tomcat/temp org.apache.catalina.startup.Bootstrap start
Any ideas?
It's a best practice to put your repository storage outside of your web application. I would advise you to explicitly set the storage location by using the repo.path system property to a full qualified location on the filesystem instead of a relative path like you do now. With Tomcat you could specify this in your setenv.sh file by appending the following parameter to your CATALINA_OPTS.
CATALINA_OPTS="-Xmx1024m -Drepo.path=/opt/cms-storage/"
You also need to take into account that the configured workspace will be extracted to a separate file within this storage directory, so if you change something within the repository.xml you will probably have to change the existing workspace.xml as well. As of version 7.9.7 Hippo supports running the entire stack on Java 8. See the release notes for more information and what has changed.
Related
I'm trying to run Spring Boot executable-jar built using spring-boot-maven-plugin on a Linux machine. The machine has multiple jdks installed, the one on PATH is jdk8 and changing it is unfortunately not an option. My executable-jar however needs jdk17, so when I just launch it as is I get UnsupportedClassVersionError.
I was following the official documentation and created the corresponding .conf file to override JAVA_HOME. But this does not seem to solve the issue:
[root#ios-maket updater-new]# ls
updater-new-3.0-SNAPSHOT.conf updater-new-3.0-SNAPSHOT.jar
[root#ios-maket updater-new]# cat updater-new-3.0-SNAPSHOT.conf
JAVA_HOME=/opt/jdk-17/bin/java
[root#ios-maket updater-new]# ./updater-new-3.0-SNAPSHOT.jar
Application is running as root (UID 0). This is considered insecure.
Exception in thread "main" java.lang.UnsupportedClassVersionError...
On the other hand if I run it manually everything works fine:
[root#ios-maket updater-new]# /opt/jdk-17/bin/java -jar ./updater-new-3.0-SNAPSHOT.jar
[main] INFO com.icl.ios.fias.updaternew.UpdaterNew - Starting UpdaterNew using Java 17.0.6
What am I doing wrong?
Setting JAVA_HOME is not enough, you also need to set PATH to point to JAVA_HOME/bin.
JAVA_HOME=/opt/jdk-17
PATH=${JAVA_HOME}/bin:$PATH
java -jar updater-new-3.0-SNAPSHOT.jar
Try running the jar with -Dloader.path to specify the config manually.
java -Dloader.path=./updater-new-3.0-SNAPSHOT.conf -jar ./updater-new-3.0-SNAPSHOT.jar
If this still does not work, then probably there is an issue with your config file, but from what I can see, your config file looks okay, unless the java path is incorrect.
I'm struggling with the deployment of a spring app that needs to compile java code during runtime. My app calls the javac command when a user submits a solution to a problem, so it can later run java
I'm deploying to cloud foundry and using the java-buildpack, but unfortunately, it doesn't come with JDK, only JRE is available and that thing has no javac or java commands available.
Do you guys know a way on how to add JDK to cloud foundry, without having to write my own custom buildpack.
Thanks
I would suggest you use multi-buildpack support and use the apt-buildpack to install a JDK. It should work fine alongside the JBP. It just needs to be first in the list.
https://github.com/cloudfoundry/apt-buildpack
Example:
Create an apt.yml.
---
packages:
- openjdk-11-jdk-headless
Bundle that into your JAR, jar uf path/to/your/file.jar apt.yml. It should be added to the root of the JAR, so if you jar tf path/to/your/file.jar you should see just apt.yml and nothing prefixed to it.
Update your manifest.yml. Add the apt-buildpack first in the list.
---
applications:
- name: spring-music
memory: 1G
path: build/libs/spring-music-1.0.jar
buildpacks:
- https://github.com/cloudfoundry/apt-buildpack#v0.2.2
- java_buildpack
Then cf push. You should see the apt-buildpack run and install the JDK. It'll then be installed under ~/deps/0/lib/jvm/java-11-openjdk-amd64. It does not appear to end up on the PATH either, so use a full path to javac or update the path.
I have a Spring Boot application, which runs in an Apache Tomcat server. In application.yaml I have, among others, following entries:
mail:
pop3Host: ${MAIL_HOSTNAME}
inboxFolder: ${MAIL_INBOX}
hostName: ${MAIL_HOSTNAME}
port: ${MAIL_PORT}
userName: ${MAIL_USERNAME}
password: ${MAIL_PASSWORD}
The application is deployed to Tomcat from within IntelliJ Idea so I can debug it.
I start Tomcat using the following command:
export JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8090,server=y,suspend=n"
export JAVA_OPTS=" -DMAIL_HOSTNAME='smtp.provider.com' -DMAIL_INBOX='MAIL_INBOX' -DMAIL_PORT='587' -DMAIL_USERNAME='username' -DMAIL_PASSWORD='XXXXXXXX'"
export CATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8090,server=y,suspend=n"
./catalina.sh jpda start
However, after I
start Tomcat using the above script,
deploy the Spring Boot application from IntelliJ Idea, and
make sure that the code where those values are used is executed,
I get the exception indicating that the placeholders have not been substituted.
How can I fix it, i. e. make sure that I can specify some information (like user name and password) in application.yaml via environment variables (so that I don't include the actual credentials in application.yaml)?
export JPDA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8090,server=y,suspend=n"
export JAVA_OPTS=" -DMAIL_HOSTNAME='smtp.provider.com' -DMAIL_INBOX='MAIL_INBOX' -DMAIL_PORT='587' -DMAIL_USERNAME='username' -DMAIL_PASSWORD='XXXXXXXX'"
export CATALINA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=8090,server=y,suspend=n"
./catalina.sh jpda start
Add export MAIL_HOSTNAME= etc. to the above lines, or create a setenv.sh file with such lines (in the same directory as catalina.sh file).
Using setenv.sh is documented in RUNNING.txt file of Apache Tomcat.
It is not possible to pass JVM arguments to a process running in a remote machine from an IDE. The Spring Boot params will be loaded from the JVM params when the process is started in the remote machine. I am sorry to say that it won't work.
An alternate solution i suggest is, use spring config server to create a separate profile for remote debugging config ( like we will have for Dev, QA environments etc ). When you try to debug the application, please restart the remote application using jenkins job ( I am assuming you don't have remote acccess to the box where the app is running) by passing the profile name in the jenkins job so that the values you wanted will be picked up. Please let me know if you need more details.
I have created account on new relic and downloaded zip for new relic agent and uploaded to /etc directory in my linux machine(tomcat server).
As per documentations, I follow the following code
cd /etc/newrelic
java -jar newrelic.jar install
But I am getting following error:
Dec 31, 2013 06:14:04 +0000 NewRelic 1 INFO: Agent is using Logback
***** ( ( o)) New Relic Java Agent Installer
***** Installing version 3.2.3 ...
Could not edit start script because:
.:. Could not locate a Tomcat, Jetty, JBoss, JBoss7 or Glassfish instance in /etc
Try re-running the install command with the -s <AppServerRootDirectory> option or from <AppServerRootDirectory>/newrelic.
If that doesn't work, locate and edit the start script manually.
No need to create New Relic configuration file because:
.:. A config file already exists: /etc/newrelic/newrelic.yml
***** Install incomplete
***** Next steps:
For help completing the install, see https://newrelic.com/docs/java/new-relic-for-java
Can anyone give me solution for this?
As the log information provide that it Could not locate a Tomcat, you need to provide env var like TOMCAT_HOME and so on.
In linux, even if you have installed some software, it can not be conveniently used without adding into PATH or some other env var.
In your situation, seems you need to add TOMCAT_HOME and export it.
Make sure the tomcat is correctly installed!
I was dealing with the same error, you only need to copy the new-relic.jar file inside the root of your tomcat server and then type:
java -jar new-relic.jar install
And that's it, it worked for me. Hope it helps
I work in support at New Relic, specializing in the Java agent.
Since Tomcat installations vary between Linux environments, your best bet is to follow the manual installation instructions:
https://docs.newrelic.com/docs/java/java-agent-manual-installation
Scroll down to the Tomcat instructions, which advise you to add the -javaagent flag to your Tomcat startup script. Once you've made that change and started your Tomcat instance, you can verify that the newrelic.jar is included in the startup arguments by issuing a ps -ef | grep java command.
If you need further help, please open a support ticket at support.newrelic.com and we'll be glad to assist.
Before installing the New Relic the code will fetch the requisite environment parameters like JAVA_HOME, TOMCAT_HOME, etc ( depends on your configuration) and then install the agent on your server. Make sure all the required env variables are defined.
After you have done the above, also check the following:
a) The New Relic should be extraced/installed in your home directory ( in my case /APP)
cd /APP
Unzip newrelic-java-3.26.1.zip –d /APP
b) The Java agent should be defined in the local properties file ( I have configured it for Hybris server in Dev environment)
vim /APP/hybris/config/local.properties
Add : -javaagent:/APP/newrelic/newrelic.jar –D newrelic.environment=Development
c) In some cases, it requirs the application specific yml file along with the newrelic.yml file ( in my case hybris.yml)
Cd /APP/newrelic
mkdir extensions
chmod 755 extensions
cd /APP/newrelic/extensions
vim hybris.yml
Hybris specific configuration for the hybris.yml file ( use jmx.yml)
Add the jmx.yml data in the hybris.yml after creating the file.
d) Restart your application:
I did it using the following commands:
cd /APP/hybris/bin/platform
ant clean all
e) You should see the data in sometime. Keep monitoring the new relic logs in:
tail -f /APP/newrelic/logs/newrelic_agent.log
Before you do any of these steps, make sure that your new relic folder is in inside the folder of your server. That immediately fixed my problem.
The folder newrelic belongs to /usr/share/tomcat/. At least on Ubuntu 16.04 with Tomcat 7. Then also the install command works. Please do not forget to read and adapt the whole newrelic.yml file.
I have a problem with starting Jetty via the startup command /etc/init.d/jetty. When I execute the command the following output is generated:
/etc/init.d/jetty start
Starting Jetty servlet engine.:
Jetty Rotate logs
Jetty servlet engine started, reachable on http://jagadguru:80/.: jetty.
It does start successfully when I type java -jar start.jar in my Jetty directory.
Can anyone help me with this?
This is likely a file permission issue. Even if you are running the start script with sudo, the script defines a jetty user (default is jetty). I had an issue similar to this where my permissions on /tmp prevented jetty from creating a file there. I adjusted the permissions on /tmp and all is well! The jetty user also needs permissions on the jetty folder of course.
Also, for checking if Jetty is finding java correctly, run sudo service jetty check
It's probably an issue due to wrong permissions on some work or log folder. I assume the start script tries to change the user and therefore doesn't has the same permissions as the one you use when running Jetty via "java -jar".
Another possibility is that you don't have JAVA_HOME set and the start script doesn't find your java bin.
Please attach some kind of log file as it is really hard to say more without more detailed information.
As answered here, the default configuration for Jetty in /etc/default/jetty only allows connections from localhost, you need to set JETTY_HOST to 0.0.0.0 to allow Jetty to accept connections from any host.
Add the following line to /etc/default/jetty:
JETTY_HOST 0.0.0.0