Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when saving datastream #289

Closed
jcoyne opened this issue Apr 16, 2014 · 5 comments
Closed

Error when saving datastream #289

jcoyne opened this issue Apr 16, 2014 · 5 comments

Comments

@jcoyne
Copy link

jcoyne commented Apr 16, 2014

On Alpha 4, when I POST an XML document to: http://localhost:8983/fedora/rest/ad/da/87/89/adda8789-ab2a-44f8-be67-8f57fd4e5fb3/descMetadata/fcr:content

I get a 500 response with this body:

javax.jcr.nodetype.ConstraintViolationException: Unable to determine a valid node definition for the node "/ad/da/87/89/adda8789-ab2a-44f8-be67-8f57fd4e5fb3/descMetadata/19" in workspace "default" of "repo"
    at org.modeshape.jcr.AbstractJcrNode.validateChildNodeDefinition(AbstractJcrNode.java:1290)
    at org.modeshape.jcr.AbstractJcrNode.addChildNode(AbstractJcrNode.java:1119)
    at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:1066)
    at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:980)
    at org.modeshape.jcr.AbstractJcrNode.addNode(AbstractJcrNode.java:108)
    at org.modeshape.jcr.api.JcrTools.findOrCreateNode(JcrTools.java:432)
    at org.modeshape.jcr.api.JcrTools.findOrCreateNode(JcrTools.java:386)
    at org.fcrepo.kernel.FedoraResourceImpl.initializeNewResourceProperties(FedoraResourceImpl.java:110)
    at org.fcrepo.kernel.FedoraResourceImpl.<init>(FedoraResourceImpl.java:104)
    at org.fcrepo.kernel.DatastreamImpl.<init>(DatastreamImpl.java:83)
    at org.fcrepo.kernel.DatastreamImpl.<init>(DatastreamImpl.java:98)
    at org.fcrepo.kernel.services.DatastreamServiceImpl.createDatastream(DatastreamServiceImpl.java:102)
    at org.fcrepo.kernel.services.DatastreamServiceImpl.createDatastreamNode(DatastreamServiceImpl.java:146)
    at org.fcrepo.http.api.FedoraContent.create(FedoraContent.java:144)
    at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
    at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:205)
    at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:75)
    at com.codahale.metrics.jersey.InstrumentedResourceMethodDispatchProvider$TimedRequestDispatcher.dispatch(InstrumentedResourceMethodDispatchProvider.java:30)
    at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:302)
    at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:108)
    at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
    at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
    at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:538)
    at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:716)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:669)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:455)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:536)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1072)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:382)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1006)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    at org.eclipse.jetty.server.Server.handle(Server.java:365)
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:485)
    at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:937)
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:998)
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:856)
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
    at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    at java.lang.Thread.run(Thread.java:722)
@jcoyne
Copy link
Author

jcoyne commented Apr 16, 2014

It seems to occur when I post content to the same URL twice in a row. The first response is a 201, the second is a 500

@jcoyne
Copy link
Author

jcoyne commented Apr 16, 2014

It seems that using a PUT works just fine, but the error when using POST is unclear and maybe unnecessary.

@escowles
Copy link
Contributor

Yes, in general, POST is for creating new resources and PUT/PATCH is for modifying them.

I think the 500 error is because it's trying to create a child resource under the datastream, so it's getting an error trying to figure out which type to create because there aren't any valid types. I've opened a Pivotal ticket for fixing this bug and returning a 4xx error when trying to POST to an existing fcr:content node: https://www.pivotaltracker.com/story/show/69610980

@awoods
Copy link

awoods commented Apr 17, 2014

Resolved with: 311b19a

@awoods awoods closed this as completed Apr 17, 2014
@escowles
Copy link
Contributor

This has been fixed in master and will be in 4.0.0-alpha5:

311b19a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants