10.0.2 Distribution Issues - java.lang.NoClassDefFoundError: javax/jcr/LoginException

586 views
Skip to first unread message

jimmy...@gmail.com

unread,
Jul 24, 2015, 3:10:19 PM7/24/15
to Hippo Community
So, I am trying to get 10.0.2 to run on Tomcat8 in Linux.  It runs locally on my Macbook Pro.  So, I followed the instructions here:  http://www.onehippo.org/library/deployment/create-and-deploy-a-project-distribution.html

The CMS won't start and this error is in the catalina.out.  We have no repository.xml and we are just trying to get this to run in memory.  We are trying to troublehs

24-Jul-2015 18:40:48.946 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:

 org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cms]]

        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)

        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)

        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)

        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)

        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1768)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.NoClassDefFoundError: javax/jcr/LoginException

        at java.lang.Class.getDeclaredFields0(Native Method)

        at java.lang.Class.privateGetDeclaredFields(Class.java:2583)

        at java.lang.Class.getDeclaredFields(Class.java:1916)

        at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:106)

        at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:256)

        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:132)

        at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:65)

        at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:334)

        at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:774)

        at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:305)

        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)

        at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)

        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5066)

        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

        ... 10 more

Caused by: java.lang.ClassNotFoundException: javax.jcr.LoginException

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1305)

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1157)

        ... 24 more


24-Jul-2015 18:40:48.947 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Error deploying web application archive /var/lib/tomcat8/webapps/cms.war

 java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cms]]

        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:728)

        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)

        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)

        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:945)

        at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1768)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

        at java.util.concurrent.FutureTask.run(FutureTask.java:266)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

Woonsan Ko

unread,
Jul 24, 2015, 3:15:26 PM7/24/15
to hippo-c...@googlegroups.com
Did you edit catalina.properties for common.loader and shared.loader as
instructed in the page?
And do you see hippo api jar files in the shared lib directory?

Regards,

Woonsan
> --
> Hippo Community Group: The place for all discussions and announcements
> about Hippo CMS (and HST, repository etc. etc.)
>
> To post to this group, send email to hippo-c...@googlegroups.com
> RSS:
> https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
> ---
> You received this message because you are subscribed to the Google
> Groups "Hippo Community" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to hippo-communi...@googlegroups.com
> <mailto:hippo-communi...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/hippo-community.
> For more options, visit https://groups.google.com/d/optout.


--
w....@onehippo.com www.onehippo.com
Boston - 745 Atlantic Ave, 8th Floor, Boston MA 02111
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466

jimmy...@gmail.com

unread,
Jul 24, 2015, 3:31:58 PM7/24/15
to Hippo Community, w....@onehippo.com
Yes...but thanks for making me look at it again.  There was a simple typo.  I am now able to get server to come up, but I am having other issues as describe in the other post I made today.


-Jimmy

jimmy...@gmail.com

unread,
Jul 24, 2015, 3:59:10 PM7/24/15
to Hippo Community, w....@onehippo.com, jimmy...@gmail.com
Upon further inspection, we normally don't include the quotes around the elements in this settings, so when I copied these from your web site I go t mixture of quotes and non-quotes.  Thanks again.

-Jimmy

Christopher Dodunski

unread,
Jul 15, 2016, 11:26:59 PM7/15/16
to Hippo Community
Hi,

Despite meticulously following Hippo's Linux Installation Manual, I too am striking this same error:

INFO: Deploying web application archive /home/cms/tomcat/webapps/cms.war
Jul 16, 2016 2:51:29 PM org.apache.catalina.core.ContainerBase addChildInternal
SEVERE: ContainerBase.addChild: start:
SEVERE: ContainerBase.addChild: start:


org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/cms]]

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:158)
...


Caused by: java.lang.NoClassDefFoundError: javax/jcr/LoginException
at java.lang.Class.getDeclaredFields0(Native Method)

...
Caused by: java.lang.ClassNotFoundException: javax.jcr.LoginException
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1282)

Below are the contents of /home/cms/tomcat/shared/lib:

cms@optomus:~/tomcat/logs$ ls -l ../shared/lib/
total 772
-rw-r--r-- 1 cms staff 39590 Jul 13 13:00 hippo-cms7-commons-3.0.0.jar
-rw-r--r-- 1 cms staff 121464 Jul 13 13:00 hippo-repository-api-4.0.1.jar
-rw-r--r-- 1 cms staff 24384 Jul 13 13:00 hippo-repository-builtin-4.0.1.jar
-rw-r--r-- 1 cms staff 33927 Jul 13 13:00 hippo-services-3.0.0.jar
-rw-r--r-- 1 cms staff 16515 Jul 13 13:00 jcl-over-slf4j-1.7.6.jar
-rw-r--r-- 1 cms staff 489884 Jul 13 13:00 log4j-1.2.17.jar
-rw-r--r-- 1 cms staff 28688 Jul 13 13:00 slf4j-api-1.7.6.jar
-rw-r--r-- 1 cms staff 8869 Jul 13 13:00 slf4j-log4j12-1.7.6.jar

And below is the relevant line in catalina.properties:

shared.loader="${catalina.base}/shared/lib","${catalina.base}/shared/lib/*.jar"

File permissions seem fine also, so I'm puzzled why Tomcat/Hippo is not finding the necessary classes.

Any suggestions on what I should check next would be gratefully received.

Thanks & regards,

Chris.

Christopher Dodunski

unread,
Jul 15, 2016, 11:35:57 PM7/15/16
to Hippo Community
Continuing, below are the contents of /usr/local/share/tomcat-endorsed:

cms@optomus:~/tomcat/logs$ ls -l /usr/local/share/tomcat-endorsed/
total 1560
-rw-r--r-- 1 cms staff 15649 Apr 19 2007 geronimo-jta_1.1_spec-1.1.jar
-rw-r--r-- 1 cms staff 69246 Oct 1 2009 jcr-2.0.jar
-rw-r--r-- 1 cms staff 521157 Mar 9 2013 mail-1.4.7.jar
-rw-r--r-- 1 cms staff 972007 Jun 20 2015 mysql-connector-java-5.1.36.jar

Christopher Dodunski

unread,
Jul 16, 2016, 12:24:11 AM7/16/16
to Hippo Community
I've found a solution, though it may not be the right solution. I found no reference to /usr/local/share/tomcat-endorsed in any of the configurations created in accordance with the Hippo Linux Installation Manual. So I simply added it to catalina.properties:

shared.loader="${catalina.base}/shared/lib","${catalina.base}/shared/lib/*.jar","/usr/local/share/tomcat-endorsed","/usr/local/share/tomcat-endorsed/*.jar"

Unless I missed this detail in your installation documentation, you might like to add it in?

Regards,

Chris.

Woonsan Ko

unread,
Jul 16, 2016, 9:05:22 AM7/16/16
to hippo-c...@googlegroups.com
Hi Chris,

I personally have a different opinion about some detail in the documentation, but if you wanted to follow the guide properly, then you should do the following instead:
- don't add /usr/local/shared/tomcat-endorsed/*.jar in shared.loader property.
- instead add the following in setenv.sh as in the example in the document:

JAVA_ENDORSED_DIRS=/usr/local/share/tomcat-endorsed

If you want to understand what the optional JAVA_ENDORSED_DIRS env variable is for, please read the comment in catalina.sh.

Regards,

Woonsan


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)

To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.

For more options, visit https://groups.google.com/d/optout.

Christopher Dodunski

unread,
Jul 17, 2016, 7:06:15 AM7/17/16
to Hippo Community
Hi Woonsan,

Strange... I went to add the JAVA_ENDORSED_DIRS parameter to setenv.sh as you suggested, only to discover it was already there. Why do you think Tomcat only located this library, therefore, after I added it to shared.loader in catalina.properties?

Thanks,

Chris.

Woonsan Ko

unread,
Jul 18, 2016, 11:21:51 AM7/18/16
to hippo-c...@googlegroups.com
Hi Chris,

Did you have JAVA_ENDORSED_DIRS=/usr/local/share/tomcat-endorsed in setenv.sh?
If so, could you also check the JVM has "java.endorsed.dirs" system property correctly? The env variable goes to "java.endorsed.dirs" system property in the end. [1]

Also, it would be very fine to copy all the shared jars from the endorsed directory to $CATALINA_BASE/shared/lib/ directory (just like you have the same structure in the tar ball) instead and add ${catalina.base}/shared/lib/*.jar into shared.loader property in catalina.properties, instead of having to mix the concept of endorsed jars and shared jars, IMHO.

Regards,

Woonsan


Woonsan Ko

unread,
Jul 18, 2016, 2:14:56 PM7/18/16
to hippo-c...@googlegroups.com
On Mon, Jul 18, 2016 at 11:21 AM, Woonsan Ko <w....@onehippo.com> wrote:
Hi Chris,

Did you have JAVA_ENDORSED_DIRS=/usr/local/share/tomcat-endorsed in setenv.sh?
If so, could you also check the JVM has "java.endorsed.dirs" system property correctly? The env variable goes to "java.endorsed.dirs" system property in the end. [1]

Also, it would be very fine to copy all the shared jars from the endorsed directory to $CATALINA_BASE/shared/lib/ directory (just like you have the same structure in the tar ball) instead and add ${catalina.base}/shared/lib/*.jar into shared.loader property in catalina.properties, instead of having to mix the concept of endorsed jars and shared jars, IMHO.
Sorry, correction on the second part: 
- IMHO, it's very fine to move those jars you have in /usr/local/share/tomcat-endorsed/ now to $CATALINA_BASE/common/lib/ directory and add it to common.loader property in catalina.properties like the following (the second item):

common.loader=${catalina.base}/common/classes,${catalina.base}/common/lib/*.jar,"${catalina.base}/lib","${catalina.base}/lib/*.jar","${catalina.home}/lib","${catalina.home}/lib/*.jar"

With this approach, you don't need to have $CATALINA_BASE/shared/lib/ directory and don't need JAVA_ENDORSED_DIRS env var at all.
This approach is actually how -Pcargo.run maintains the common and shared jars at runtime. But this small detail is a bit departed from the online documentation.

Regards,

Woonsan

gulb...@gmail.com

unread,
Jul 18, 2016, 8:18:25 PM7/18/16
to Hippo Community
Hi Woonsan,

Thanks for your help. Actually, I'm not opposed to the concept of implementing an external Tomcat endorsed directory. Probably it simplifies Tomcat upgrades, without the problem of losing JARs in the process. Just provided Tomcat actually loads the JARs found there - it seems my Tomcat installation does not, despite this variable being declared in setenv.sh (see below). Seemingly my Tomcat (8.5.3), by default, doesn't act on this variable. I will now look for the reason why, and report back with the answer. :-)

optomus:~# less /home/cms/tomcat/bin/setenv.sh
JAVA_HOME=/usr/java/jdk
JAVA_ENDORSED_DIRS=/usr/local/share/tomcat-endorsed

CATALINA_HOME="/usr/local/tomcat"
CATALINA_BASE="/home/cms/tomcat"
CATALINA_PID="${CATALINA_BASE}/work/catalina.pid"

CLUSTER_ID="$(whoami)-$(hostname -f)"

MAX_HEAP=2048
MIN_HEAP=256

REP_OPTS="-Drepo.bootstrap=false -Drepo.config=file:${CATALINA_BASE}/conf/repository.xml"
JVM_OPTS="-server -Xmx${MAX_HEAP}m -Xms${MIN_HEAP}m -XX:+UseG1GC -Djava.util.Arrays.useLegacyMergeSort=true"
DMP_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/cms/heapdumps"
RMI_OPTS="-Djava.rmi.server.hostname=127.0.0.1"
JRC_OPTS="-Dorg.apache.jackrabbit.core.cluster.node_id=${CLUSTER_ID}"
L4J_OPTS="-Dlog4j.configuration=file:${CATALINA_BASE}/conf/log4j.xml"

CATALINA_OPTS="${JVM_OPTS} ${REP_OPTS} ${DMP_OPTS} ${RMI_OPTS} ${L4J_OPTS} ${JRC_OPTS}"

export JAVA_HOME CATALINA_HOME CATALINA_BASE

Woonsan Ko

unread,
Jul 18, 2016, 9:55:47 PM7/18/16
to hippo-c...@googlegroups.com
On Mon, Jul 18, 2016 at 8:18 PM, <gulb...@gmail.com> wrote:
Hi Woonsan,

Thanks for your help.  Actually, I'm not opposed to the concept of implementing an external Tomcat endorsed directory.  Probably it simplifies Tomcat upgrades, without the problem of losing JARs in the process. 
That will be true until Java 8. I heard that it is deprecated now and removed in Java 9:
 
Just provided Tomcat actually loads the JARs found there - it seems my Tomcat installation does not, despite this variable being declared in setenv.sh (see below).  Seemingly my Tomcat (8.5.3), by default, doesn't act on this variable.  I will now look for the reason why, and report back with the answer.  :-)
You might want to investigate all the command line option of the tomcat process to see if -Djava.endorsed.dirs=...  is set to the value of JAVA_ENDORSED_DIRS env variable.
If it was found correct, then it should just work (as long as you run JVM 1.8 or earlier version).

Regards,

Woonsan
 

optomus:~# less /home/cms/tomcat/bin/setenv.sh
JAVA_HOME=/usr/java/jdk
JAVA_ENDORSED_DIRS=/usr/local/share/tomcat-endorsed

CATALINA_HOME="/usr/local/tomcat"
CATALINA_BASE="/home/cms/tomcat"
CATALINA_PID="${CATALINA_BASE}/work/catalina.pid"

CLUSTER_ID="$(whoami)-$(hostname -f)"

MAX_HEAP=2048
MIN_HEAP=256

REP_OPTS="-Drepo.bootstrap=false -Drepo.config=file:${CATALINA_BASE}/conf/repository.xml"
JVM_OPTS="-server -Xmx${MAX_HEAP}m -Xms${MIN_HEAP}m -XX:+UseG1GC -Djava.util.Arrays.useLegacyMergeSort=true"
DMP_OPTS="-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/home/cms/heapdumps"
RMI_OPTS="-Djava.rmi.server.hostname=127.0.0.1"
JRC_OPTS="-Dorg.apache.jackrabbit.core.cluster.node_id=${CLUSTER_ID}"
L4J_OPTS="-Dlog4j.configuration=file:${CATALINA_BASE}/conf/log4j.xml"

CATALINA_OPTS="${JVM_OPTS} ${REP_OPTS} ${DMP_OPTS} ${RMI_OPTS} ${L4J_OPTS} ${JRC_OPTS}"

export JAVA_HOME CATALINA_HOME CATALINA_BASE
--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)

To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

gulb...@gmail.com

unread,
Jul 19, 2016, 12:26:08 AM7/19/16
to Hippo Community
Hi Woonsan,

Given that external, endorsed libraries are to be deprecated, I think I'll simply move the contents of /usr/local/share/tomcat-endorsed to /home/cms/tomcat/common/lib, and create the required link. It seems there's a push on application developers to bundle any 3rd party JARs with their distribution, and likely Hippo will soon follow this same path. I'm in favour of change that simplifies, but not at the expense of best practice.

I'm currently delving into producing my first Hippo website, following your detailed tutorials. I like what I've seen of Hippo thus far. My sincere commendations to the Hippo team!! :-)

Regards,

Chris.

Bart van der Schans

unread,
Jul 19, 2016, 5:52:17 AM7/19/16
to hippo-c...@googlegroups.com
Hi Chris,

Tomcat 8.5.x is not supported (yet). Could you try with Tomcat 8.0.x?
That might solve your endorsed lib issue.

More in general about the shared libs/endorsed libs/common libs
discussion: it doesn't matter too much how you call it and where you
store it provided of course that it "works". The reasons for the split
have to do with maintenance and release cycles.

The shared libs are part of the distribution and should be provided by
the project/developers. They need to be replaced with every deploy.

The endorsed libs are part of the server setup and hardly ever change.
Usually these are maintained by the sysadmin. For example it is
usually the sysadmins job to setup the database, datasource and
correct jdbc driver.

The reason that we do not drop all these wars in one lib folder is
maintainability. The separate endorsed lib in combination with the
split between catalina home and base makes it ease to upgrade tomcat.
Putting all shared libs in a separate folder makes it easier to do
deployments, just remove everything from the dir and put in the ones
provided in the distribution.

So which set up works best for you might depend on how your
organization is structured. Are the sysadmin and dev guys the same
person/team? Or are responsibilities split? The setup described in the
installation manual has proven itself for us and a lot of customers
over the last few years, but it should be viewed as a best practice
and a way how you could do it.

HTH,
Bart
> --
> Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
>
> To post to this group, send email to hippo-c...@googlegroups.com
> RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
> ---
> You received this message because you are subscribed to the Google Groups "Hippo Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
> Visit this group at https://groups.google.com/group/hippo-community.
> For more options, visit https://groups.google.com/d/optout.



--
Hippo B.V. - Oosteinde 11, 1017 WT Amsterdam
Hippo USA, Inc. - 71 Summer Street, 2nd Floor, Boston, MA 02110

US +1 877 414 47 76 (toll free)
NL +31 20 522 44 66
UK +44 20 35 14 99 60
DE +49 69 80 88 40 67

http://www.onehippo.com
http://www.onehippo.org

Christopher Dodunski

unread,
Jul 19, 2016, 1:50:50 PM7/19/16
to Hippo Community
Thanks Bart for elaborating. I think I have a pretty good grasp of this now, and have decided to disuse any endorsed library directory, given it is soon to be deprecated from Java. I'll instead create common/lib in tomcat.base.

Thanks & regards,

Chris.

abri...@gmail.com

unread,
Mar 10, 2017, 11:22:52 PM3/10/17
to Hippo Community
If I may add just a final note for other newbies coming in to read this post. Bart's recommendation to rollback was exactly what fixed this issue for me! Thanks!
Reply all
Reply to author
Forward
0 new messages