Could not resolve placeholder 'fcrepo.modeshape.configuration' Tomcat8 | CentOS

631 views
Skip to first unread message

Devin Griffin

unread,
Nov 7, 2017, 2:46:14 PM11/7/17
to Fedora Community
I'm trying to install the latest version of Fedora on Tomcat 8 on top of CentOS.

It's giving me this error:

HTTP Status 500 - Servlet.init() for servlet jersey-servlet threw exception

type Exception report

message Servlet.init() for servlet jersey-servlet threw exception

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: Servlet.init() for servlet jersey-servlet threw exception
	org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
	org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
	org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1539)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1495)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Thread.java:748)

root cause

org.springframework.beans.factory.BeanDefinitionStoreException: Invalid bean definition with name 'modeshapeRepofactory' defined in class path resource [spring/repo.xml]: Could not resolve placeholder 'fcrepo.modeshape.configuration' in string value "${fcrepo.modeshape.configuration}"; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'fcrepo.modeshape.configuration' in string value "${fcrepo.modeshape.configuration}"
	org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:223)
	org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222)
	org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)
	org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284)
	org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:166)
	org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523)
	org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
	org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
	org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
	org.fcrepo.http.commons.FedoraContextLoaderListener.contextInitialized(FedoraContextLoaderListener.java:40)
	org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
	org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1853)
	java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	java.lang.Thread.run(Thread.java:748)

root cause

java.lang.IllegalArgumentException: Could not resolve placeholder 'fcrepo.modeshape.configuration' in string value "${fcrepo.modeshape.configuration}"
	org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
	org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
	org.springframework.beans.factory.config.PropertyPlaceholderConfigurer$PlaceholderResolvingStringValueResolver.resolveStringValue(PropertyPlaceholderConfigurer.java:258)
	org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveStringValue(BeanDefinitionVisitor.java:282)
	org.springframework.beans.factory.config.BeanDefinitionVisitor.resolveValue(BeanDefinitionVisitor.java:209)
	org.springframework.beans.factory.config.BeanDefinitionVisitor.visitPropertyValues(BeanDefinitionVisitor.java:141)
	org.springframework.beans.factory.config.BeanDefinitionVisitor.visitBeanDefinition(BeanDefinitionVisitor.java:82)
	org.springframework.beans.factory.config.PlaceholderConfigurerSupport.doProcessProperties(PlaceholderConfigurerSupport.java:220)
	org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:222)
	org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)
	org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:284)
	org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:166)
	org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:681)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:523)
	org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
	org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
	org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
	org.fcrepo.http.commons.FedoraContextLoaderListener.contextInitialized(FedoraContextLoaderListener.java:40)
	org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
	org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1853)
	java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	java.util.concurrent.FutureTask.run(FutureTask.java:266)
	java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	java.lang.Thread.run(Thread.java:748)

note The full stack trace of the root cause is available in the Apache Tomcat/8.0.47 logs.


Apache Tomcat/8.0.47


After some Google searches, I believe the issue is this:
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/file-simple/repository.json -Dfcrepo.home=/mnt/fedora-data"
However, I have tried to get that system property configured every way I've seen online with no resolve.

Where do I put the JAVA_OPTS statement on CentOS w/Tomcat8?

Bethany Seeger

unread,
Nov 7, 2017, 4:02:51 PM11/7/17
to fedora-c...@googlegroups.com
Hi Devin, 

I have fedora install on a CentOS server where I have tomcat8 located in /var/tomcat (essentially, I followed these instructions, though I chose to put it in a different spot: https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-8-on-centos-7).

Tomcat has a file in the /etc/systemd/system/ folder named tomcat.service with the following environment information:
(note that I have it refer to files I store in /etc/fedora — like the repository.json, activemq.xml, audit.xml file – your statements will vary) 
----------

Environment=JAVA_HOME=/usr/lib/jvm/jre

Environment=CATALINA_PID=/var/tomcat/temp/tomcat.pid

Environment=CATALINA_HOME=/var/tomcat

Environment=CATALINA_BASE=/var/tomcat

#Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'

Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -Dcantaloupe.config=/opt/cantaloupe/cantaloupe.properties'

Environment='JAVA_OPTS=-Djava.awt.headless=true -Dfile.encoding=UTF-8 -server -Dfcrepo.modeshape.configuration=file:/etc/fcrepo/repository.json -Dfcrepo.home=/opt/fcrepo/fcrepo4-data -Dfcrepo.binary.directory=binary.store -Dfcrepo.activemq.configuration=file:/etc/fcrepo/activemq.xml -Dfcrepo.activemq.directory=activemq -Dfcrepo.modeshape.index.directory=modeshape.index -Dfcrepo.audit.container=/audit -Dcom.arjuna.ats.arjuna.common.ObjectStoreEnvironmentBean.default.objectStoreDir=arjuna.common.object.store -Dcom.arjuna.ats.arjuna.objectstore.objectStoreDir=arjuna.object.store -Dnet.sf.ehcache.skipUpdateCheck=true -Xms1024m -Xmx2048m -XX:NewSize=256m -XX:MaxNewSize=256m -XX:MaxMetaspaceSize=512M -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:ConcGCThreads=5 -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -Dfcrepo.spring.audit.configuration=file:/etc/fcrepo/audit.xml -Dlogback.configurationFile=/etc/fcrepo/logback.xml


I can stop/start/restart tomcat via:


$> systemctl stop tomcat


Hope that helps some. 


Bethany


--
You received this message because you are subscribed to the Google Groups "Fedora Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fedora-communi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Devin Griffin

unread,
Nov 7, 2017, 4:28:15 PM11/7/17
to Fedora Community
Thank you!

I changed my tomcat.service to:

Description=Apache Tomcat Web Application Container
After=syslog.target network.target

[Service]
Type=forking

Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat

Environment='CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC'
Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dfcrepo.modeshape.configuration=classpath:/config/file-simple/repository.json -Dfcrepo.home=/mnt/fedora-data'

ExecStart=/opt/tomcat/bin/startup.sh
ExecStop=/bin/kill -15 $MAINPID

User=tomcat
Group=tomcat

[Install]
WantedBy=multi-user.target

Now, I get this error:

HTTP Status 404 - /fcrepo-webapp-4.7.4/

type Status report

message /fcrepo-webapp-4.7.4/

description The requested resource is not available.


Apache Tomcat/8.0.47

 
I made sure that the fedora-data file is actually there and that the repository.json path is correct.

Bethany Seeger

unread,
Nov 7, 2017, 5:02:40 PM11/7/17
to fedora-c...@googlegroups.com
Hi Devin, 

Can you share your tomcat log?  I’d be curious to see the startup information up through this error message.  

Thanks,

Devin Griffin

unread,
Nov 7, 2017, 5:15:36 PM11/7/17
to Fedora Community
Is this the correct log file?


07-Nov-2017 16:11:44.493 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpath
07-Nov-2017 16:11:47.708 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
07-Nov-2017 16:12:23.681 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializers detected on classpath
07-Nov-2017 16:12:24.577 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContext
07-Nov-2017 16:12:30.043 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.fcrepo.http.commons.FedoraContextLoaderListener
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'modeshapeRepofactory': Invocation of init method failed; nested exception is org.fcrepo.kernel.api.exception.RepositoryRuntimeException: java.lang.IllegalStateException: This store is read-only [1.4.191/2]
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:136)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:408)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1575)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:732)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
    at org.fcrepo.http.commons.FedoraContextLoaderListener.contextInitialized(FedoraContextLoaderListener.java:40)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4853)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5314)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
    at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:976)
    at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1853)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.fcrepo.kernel.api.exception.RepositoryRuntimeException: java.lang.IllegalStateException: This store is read-only [1.4.191/2]
    at org.fcrepo.kernel.modeshape.spring.ModeShapeRepositoryFactoryBean.buildRepository(ModeShapeRepositoryFactoryBean.java:86)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:365)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:310)
    at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:133)
    ... 28 more
Caused by: java.lang.IllegalStateException: This store is read-only [1.4.191/2]
    at org.h2.mvstore.DataUtils.newIllegalStateException(DataUtils.java:773)
    at org.h2.mvstore.MVStore.commitAndSave(MVStore.java:1029)
    at org.h2.mvstore.MVStore.commit(MVStore.java:996)
    at org.h2.mvstore.db.TransactionStore.endTransaction(TransactionStore.java:456)
    at org.h2.mvstore.db.TransactionStore.commit(TransactionStore.java:364)
    at org.h2.mvstore.db.TransactionStore$Transaction.commit(TransactionStore.java:779)
    at org.modeshape.persistence.file.FileDb.txCommitted(FileDb.java:228)
    at org.modeshape.jcr.txn.Transactions$SimpleTransaction.commit(Transactions.java:501)
    at org.modeshape.jcr.txn.Transactions$TraceableSimpleTransaction.commit(Transactions.java:557)
    at org.modeshape.jcr.txn.Transactions$NestableThreadLocalTransaction.commit(Transactions.java:584)
    at org.modeshape.jcr.cache.document.WritableSessionCache.save(WritableSessionCache.java:568)
    at org.modeshape.jcr.cache.document.WritableSessionCache.save(WritableSessionCache.java:507)
    at org.modeshape.jcr.SystemContent.save(SystemContent.java:121)
    at org.modeshape.jcr.SystemNamespaceRegistry.register(SystemNamespaceRegistry.java:171)
    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:1140)
    at org.modeshape.jcr.JcrRepository$RunningState.<init>(JcrRepository.java:936)
    at org.modeshape.jcr.JcrRepository.doStart(JcrRepository.java:372)
    at org.modeshape.jcr.JcrRepository.getStartupProblems(JcrRepository.java:286)
    at org.fcrepo.kernel.modeshape.spring.ModeShapeRepositoryFactoryBean.buildRepository(ModeShapeRepositoryFactoryBean.java:80)
    ... 35 more

07-Nov-2017 16:12:30.071 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext
07-Nov-2017 16:12:30.739 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log ContextListener: contextInitialized()
07-Nov-2017 16:12:30.740 INFO [localhost-startStop-1] org.apache.catalina.core.ApplicationContext.log SessionListener: contextInitialized()

Bethany Seeger

unread,
Nov 8, 2017, 9:22:32 AM11/8/17
to fedora-c...@googlegroups.com
Hi Devin, 

Yes – looks like the correct file.   From the looks of this line:  

07-Nov-2017 16:12:30.043 SEVERE [localhost-startStop-1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.fcrepo.http.commons.FedoraContextLoaderListener
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'modeshapeRepofactory': Invocation of init method failed; nested exception is org.fcrepo.kernel.api.exception.RepositoryRuntimeException: java.lang.IllegalStateException: This store is read-only [1.4.191/2]

I have to wonder if your data location (‘/mnt/fedora-data’) has wrong permissions and tomcat can’t write there?   That directory should be owned and writable by tomcat. This is what my permissions look like for that directory: 

drwxr-xr-x   7 tomcat  tomcat   150 Aug 22 13:14 fcrepo4-data


-Bethany

From: <fedora-c...@googlegroups.com> on behalf of Devin Griffin <devin1...@gmail.com>
Reply-To: "fedora-c...@googlegroups.com" <fedora-c...@googlegroups.com>
Date: Tuesday, November 7, 2017 at 6:15 PM
To: Fedora Community <fedora-c...@googlegroups.com>
Subject: Re: [fedora-community] Could not resolve placeholder 'fcrepo.modeshape.configuration' Tomcat8 | CentOS

Devin Griffin

unread,
Nov 10, 2017, 11:20:36 AM11/10/17
to Fedora Community

I just changed my permissions and it worked, thank you!
Reply all
Reply to author
Forward
0 new messages