I'm playing with our Fedora 3.2 instance and the REST API. I'm using
the Firefox Poster add-on to do an http POST of some simple valid
FOXML to the (example)
http://fedorabox:8080/fedora/objects/newpid:foobar
URI and am running into problems.
The first time I attempt to do the POST, I get the error "The PID
'newpid:foobar' already exists in the registry; the object can't be re-
created." even though it is a brand new object. However, if I search
Fedora for the object, I do find it was created. When I look through
the logs, I see that Fedora tries to create the object twice with this
one request.
If I try to POST a second object with a new pid and new FOXML, the
requests succeeds without error. Fedora only tries the ingest once.
My guess is that the initial authentication handshake with the first
POST causes Fedora to attempt the ingest twice. The second POST
succeeds since the browser is already authenticated, and doesn't need
to go through the handshake. I ran into this because I have some
client software that authenticates with every post (since it's not a
browser) and I keep running into this problem. I did not have this
issue with 3.0 or 3.1. I have included the stacktrace error below.
Has anyone else run into this? Any help appreciated.
Thanks,
Willy
javax.ws.rs.WebApplicationException:
fedora.server.errors.ObjectExistsException: The PID 'newpid:foobar'
already exists in the registry; the object can't be re-created.
at
fedora
.server.rest.BaseRestResource.handleException(BaseRestResource.java:122)
at
fedora
.server
.rest.FedoraObjectResource.createObject(FedoraObjectResource.java:416)
at sun.reflect.GeneratedMethodAccessor109.invoke(Unknown Source)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
com
.sun
.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider
$ResponseOutInvoker._dispatch(EntityParamDispatchProvider.java:157)
at
com
.sun
.jersey
.server
.impl
.model
.method
.dispatch
.ResourceJavaMethodDispatcher
.dispatch(ResourceJavaMethodDispatcher.java:67)
at
com
.sun
.jersey
.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)
at
com
.sun
.jersey
.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:
71)
at
com
.sun
.jersey
.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:
111)
at
com
.sun
.jersey
.server
.impl
.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:
63)
at
com
.sun
.jersey
.server
.impl
.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:
555)
at
com
.sun
.jersey
.server
.impl
.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:
514)
at
com
.sun
.jersey
.server
.impl
.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:
505)
at
com
.sun
.jersey
.spi.container.servlet.ServletContainer.service(ServletContainer.java:
359)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
269)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
fedora
.server
.security
.servletfilters.FilterRestApiFlash.doFilter(FilterRestApiFlash.java:78)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
fedora
.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:
234)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
fedora
.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:
234)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
fedora
.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:
234)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
fedora
.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:
234)
at
org
.apache
.catalina
.core
.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
215)
at
org
.apache
.catalina
.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
at
org
.apache
.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
210)
at
org
.apache
.catalina.core.StandardContextValve.invoke(StandardContextValve.java:
174)
at
org
.apache
.catalina
.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at
org
.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:
127)
at
org
.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:
117)
at
org
.apache
.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
151)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:
870)
at org.apache.coyote.http11.Http11BaseProtocol
$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
at
org
.apache
.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
at
org
.apache
.tomcat
.util
.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:
81)
at org.apache.tomcat.util.threads.ThreadPool
$ControlRunnable.run(ThreadPool.java:685)
at java.lang.Thread.run(Thread.java:619)
Caused by: fedora.server.errors.ObjectExistsException: The PID
'newpid:foobar' already exists in the registry; the object can't be re-
created.
at
fedora
.server.storage.DefaultDOManager.getIngestWriter(DefaultDOManager.java:
909)
at
fedora
.server.management.DefaultManagement.ingest(DefaultManagement.java:136)
at sun.reflect.GeneratedMethodAccessor111.invoke(Unknown Source)
at
sun
.reflect
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
fedora
.server
.messaging
.NotificationInvocationHandler
.invoke(NotificationInvocationHandler.java:70)
at $Proxy0.ingest(Unknown Source)
at
fedora.server.management.ManagementModule.ingest(ManagementModule.java:
338)
at
fedora
.server
.rest.FedoraObjectResource.createObject(FedoraObjectResource.java:411)
... 44 more