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

5,902 views
Skip to first unread message

Andy Tang

unread,
Sep 14, 2016, 5:55:59 PM9/14/16
to Fedora Community
Hello,

I am new to here and need some help. This is the first time I install Fedora 4.6. After installation is completed, I input http://localhost:8080/fcrepo-webapp-4.6.0/rest/ and get the error message below.What does this mean?

My environment is windows 7 64 bit + java 1.8.0_102-b14 + tomcat 9
Andy help is appreciated.

Andy Tang


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:522)
	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:349)
	org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:1110)
	org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785)
	org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425)
	org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	java.lang.Thread.run(Unknown Source)

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:211)
	org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:223)
	org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)
	org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
	org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:162)
	org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
	org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
	org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
	org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
	org.fcrepo.http.commons.FedoraContextLoaderListener.contextInitialized(FedoraContextLoaderListener.java:40)
	org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
	org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
	org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
	java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	java.util.concurrent.FutureTask.run(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	java.lang.Thread.run(Unknown Source)

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:259)
	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:208)
	org.springframework.beans.factory.config.PropertyPlaceholderConfigurer.processProperties(PropertyPlaceholderConfigurer.java:223)
	org.springframework.beans.factory.config.PropertyResourceConfigurer.postProcessBeanFactory(PropertyResourceConfigurer.java:86)
	org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:265)
	org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:162)
	org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606)
	org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462)
	org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403)
	org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
	org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106)
	org.fcrepo.http.commons.FedoraContextLoaderListener.contextInitialized(FedoraContextLoaderListener.java:40)
	org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:152)
	org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:952)
	org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1823)
	java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	java.util.concurrent.FutureTask.run(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	java.lang.Thread.run(Unknown Source)

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


Apache Tomcat/9.0.0.M9


Andrew Woods

unread,
Sep 14, 2016, 6:12:33 PM9/14/16
to fedora-community
Hello Andy,
Welcome to the Fedora community. Please feel free to keep us posted on your repository status or with any questions that arise. 

As for the issue at hand, a little further down in your log you should see the following message:
=====================================================================
=====================================================================
---------- FEDORA CONFIGURATION ERROR ----------
If the above stacktrace mentions 'fcrepo.modeshape.configuration'
You must configure a 'repository.json'

See documentation specific to your version of Fedora

=====================================================================
=====================================================================

In short, you need to provide the system property, "fcrepo.modeshape.configuration", to Tomcat. For production use, it is recommended that you configure a MySQL or PostgreSQL backend database for Fedora. But for experimentation sake, you should be able to start with a configuration like the following:
---
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/file-simple/repository.json"
---

The link above has more details. 
Regards,
Andrew


--
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-community+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andy Tang

unread,
Sep 19, 2016, 10:34:43 AM9/19/16
to Fedora Community
Andrew,

I did not find setenv.bat file in the folder C:\ApacheTomcat9\bin. So, I create a one and add the "set CATALINA_OPTS=%CATALINA_OPTS% -Dfcrepo.ispn.repo.cache=c:\fedora\cache" to that file.

The environment I use is windows 7 64 bit. Do I need to add "JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/file-simple/repository.json -Dfcrepo.home=/mnt/fedora-data"?


I use Tomcat. Do I need to use Jetty at the same time?

The manual said "repository.json " need to be setup. It seems it did not mentioned where to set it up in windows environment.

Any help is appreciated!

Andy Tang


To unsubscribe from this group and stop receiving emails from it, send an email to fedora-communi...@googlegroups.com.

Andrew Woods

unread,
Sep 19, 2016, 6:41:05 PM9/19/16
to fedora-community
Hello Andy,
Maybe someone who runs Tomcat in a Windows environment can provide details of how you should be setting system properties, but the point is that you need to provide the system property, "fcrepo.modeshape.configuration", to Tomcat. For production use, it is recommended that you configure a MySQL or PostgreSQL backend database for Fedora. But for experimentation sake, you should be able to start with a Windows-appropriate configuration like the following:
---
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/file-simple/repository.json"
---

Since you are using Tomcat, there is no need to also run Jetty.
Regards,
Andrew


To unsubscribe from this group and stop receiving emails from it, send an email to fedora-community+unsubscribe@googlegroups.com.

Andy Tang

unread,
Sep 21, 2016, 5:41:31 PM9/21/16
to Fedora Community
Andrew,

I check the configuration guide of Tomcat in windows.
The correct syntax should be set JAVA_OPTS in catalina.bat under the %catalina_home%\bin.
I add two lines into catalina.bat file as below, and restart tomcat.

set FEDORA_PARA="-Dfcrepo.modeshape.configuration=classpath:/config/file-simple/repository.json"
set "JAVA_OPTS=%JAVA_OPTS% %FEDORA_PARA%"

However, I get the same results as before.
"java.lang.IllegalArgumentException: Could not resolve placeholder 'fcrepo.modeshape.configuration' in string value "${fcrepo.modeshape.configuration}"


May I ask what is the value of "fcrepo.modeshape.configuration". From manual, it said it is "classpath:/config/file-simple/repository.json". Is it the same at linux server and windows server?

Any help is appreciated!
Thanks!
Andy Tang

Andrew Woods

unread,
Sep 21, 2016, 5:49:58 PM9/21/16
to fedora-community

Hello Andy,
It appears that you have the correct information... but I must defer to others on the list who run Windows for the details of the correct syntax.
Regards,
Andrew


To unsubscribe from this group and stop receiving emails from it, send an email to fedora-community+unsubscribe@googlegroups.com.

Jesus Molina

unread,
Nov 4, 2016, 3:50:12 AM11/4/16
to Fedora Community
Hello Andy and to whom it may concern,

I'm using Fedora 4.7.0 and Tomcat 9 on Windows 7 x64. Your configuration is correct, I'm working with it, but instead of adding two lines in catalina.bat, you should create a new file called "setenv.bat" (without double quotes) in %CATALINA_BASE%\bin directory, and setting it with the same content.

It works for me.

Cheers,
Jesus

Andy Tang

unread,
Nov 17, 2016, 3:58:51 PM11/17/16
to fedora-c...@googlegroups.com
Hello Jesus,

Can you send the content of your setenv.bat to me?
I change it by using your way. The result is the same.

Any help is appreciated!

Andy Tang

--
You received this message because you are subscribed to a topic in the Google Groups "Fedora Community" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/fedora-community/j6yG8Betnj4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to fedora-community+unsubscribe@googlegroups.com.
Message has been deleted
Message has been deleted
Message has been deleted

Jesus Molina

unread,
Nov 18, 2016, 7:28:16 AM11/18/16
to Fedora Community
Hi again Andy,

I attach the setenv.bat file. Remove the .dat extension. Deploy it in %CATALINA_HOME%\bin directory. Replace CATALINA_HOME and CATALINA_BASE values for your custom values.

I have revise the hole post and I think I have found the real issue: the fcrepo.modeshape.configuration:file-simple does not exists in fcrepo 4.6.0, but yes in fcrepo 4.7.0.

Change your FEDORA_PARA environment variable to: set FEDORA_PARA="-Dfcrepo.modeshape.configuration=classpath:/config/minimal-default/repository.json". This is a non-production configuration but it will work for your test developments.

Regards,
Jesus
To unsubscribe from this group and all its topics, send an email to fedora-communi...@googlegroups.com.
setenv.bat.dat

Andy Tang

unread,
Nov 18, 2016, 10:27:37 AM11/18/16
to fedora-c...@googlegroups.com
Jesus,

On windows environment, I have tried both 4.6 and 4.7 version and also I have tried both 
 set FEDORA_PARA="-Dfcrepo.modeshape.configuration=classpath:/config/minimal-default/repository.json"
and
 set FEDORA_PARA="-Dfcrepo.modeshape.configuration=classpath:/config/file-simple /repository.json".

But all of them have the same mistake of "java.lang.IllegalArgumentException: Could not resolve placeholder 'fcrepo.modeshape.configuration' in string value "${fcrepo.modeshape.configuration}".


I will use Fedora 4.6 in my Redhat linux server which is successful previously.

Thanks a lot!
Andy Tang



To unsubscribe from this group and all its topics, send an email to fedora-community+unsubscribe@googlegroups.com.

Jimmy

unread,
Nov 13, 2017, 4:09:24 PM11/13/17
to Fedora Community
Hi Andy,

I got same issue with 4.7 in Centos. 
Could you please how to add JAVA_OPTS to tomcat?
Thanks a lot!

-Jimmy
To unsubscribe from this group and all its topics, send an email to fedora-communi...@googlegroups.com.

Benjamin Armintor

unread,
Nov 13, 2017, 4:50:00 PM11/13/17
to fedora-c...@googlegroups.com
Hello Andy,

I'm not a Windows user, but is the position of the quotation mark (") correct in your .bat script?  The portion you pasted uses quotes in different ways for FEDORA_PARA  and the next line, which intends to set JAVA_OPTS.

- Ben

To unsubscribe from this group and stop receiving emails from it, send an email to fedora-community+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages