fcrepo-exts / fcrepo-webapp-plus

Fcrepo4 webapp plus optional fcrepo dependencies
Apache License 2.0
13 stars 16 forks source link

BeanDefinitionParsingException: Unable to locate Spring NamespaceHandler for XML schema namespace #62

Open jrmerz opened 6 years ago

jrmerz commented 6 years ago

I'm trying to get a simple example running on jetty using the pre-made webac jar, but getting the following message:

ERROR 10:28:24.571 (ContextLoader) Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/spring/auth-repo.xml]
Offending resource: ServletContext resource [/WEB-INF/classes/spring/auth-master.xml]; nested exception is org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/context]
Offending resource: class path resource [spring/auth-repo.xml]

at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
.... stack trace

My simple setup is as follows:

OS: MacOS

Downloaded the latest Jetty release from here http://www.eclipse.org/jetty/download.html (9.4.7)

Java is

$ java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

I downloaded and copied the pre made jar from here https://github.com/fcrepo4-exts/fcrepo-webapp-plus/releases/download/fcrepo-webapp-plus-4.7.4/fcrepo-webapp-plus-webac-4.7.4.war and copied it to /webapps of the jetty folder.

I created a rcrepo.xml file in the root of the webapps folder with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">

<Configure id="fcrepo" class="org.eclipse.jetty.webapp.WebAppContext">
  <Set name="contextPath">/fcrepo</Set>
  <Set name="war"><SystemProperty name="jetty.base" default="."/>/webapps/fcrepo-webapp-plus-webac-4.7.4.war</Set>

  <Get name="securityHandler">
    <Set name="loginService">
      <New class="org.eclipse.jetty.security.HashLoginService">
        <Set name="name">fcrepo4</Set>

        <Set name="config"><SystemProperty name="jetty.base" default="."/>/jetty-users.properties</Set>
      </New>
    </Set>
  </Get>
</Configure>

In the root of the folder (jetty.base) I created the jetty-users.properties file with the same setup as the demo:

testuser: password1,fedoraUser
adminuser: password2,fedoraUser
fedoraAdmin: secret3,fedoraAdmin

Finally, I started up jetty with the following command

java -jar -Dfcrepo.modeshape.configuration=classpath:/config/servlet-auth/repository.json -Dfile.encoding=UTF-8 start.jar

Any help or pointers to what to read up on would be greatly appreciated. And thank you for your time.

awoods commented 6 years ago

@jrmerz , thank you for the detailed description. I can reproduce the issue locally.

Most of the testing takes place with Tomcat; however, this issue was seen before: https://jira.duraspace.org/browse/FCREPO-2210

I have not come up with a resolution, but would be interested in your findings if you continue to explore the issue. I will raise the topic on this week's Fedora Tech Call. If you could join, that would be great. https://wiki.duraspace.org/display/FF/2017-10-05+-+Fedora+Tech+Meeting

jrmerz commented 6 years ago

@awoods Just FYI, I'm not well versed in Jetty or Spring and my Java legs haven't been used in some time. That said, I can possibly get on the call if it would help.

I have been able to get the regular install of Fedora running with webac by expanding the default war, adding the required spring files, web.xml and jars from the plus webac war.

Note: one difference I see between the default and plus wars (besides the obvious Spring/Jar differences) is that the META-INF file has a INDEX.LIST file containing lots of information about the war packages. The META-INF/MANIFEST.MF file also has a Class-Path attribute that contains a list of jars. Don't know if this has any effect on the jar loading or not but thought I would let you know.

awoods commented 6 years ago

Thanks for the additional details, @jrmerz . Since the standard war works for you... let me look into the differences.

awoods commented 6 years ago

The fundamental issue here seems to be related to the contents of the META-INF/MANIFEST.MF. The solution is likely to revisit the manner in which the fcrepo-webapp-plus creates derivative war files from the standard fcrepo.war. Given the fact that the WebAC module has been pulled into the core codebase and is now enabled by default (as of the yet unreleased version 5.0.0), I am inclined to de-prioritize this issue, unless you believe it requires more immediate attention, @jrmerz .

jrmerz commented 6 years ago

I have a workaround in my Docker file using the expand method described above. It is a hack but will work till 5.0.0 is released. We are still in early prototype development stage.

Just out of curiosity, timeline for 5.0.0 release? So I can keep an eye out for it.

awoods commented 6 years ago

We would like to wait on 5.0.0 until all of the necessary changes have been made to align the implementation with the Fedora Specification.

We are targeting the first quarter of 2018... if you jump in, it will help our odds :)