jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Khanapurkar, Mona A." <Mona.A.Khanapur...@idearc.com>
Subject Jcr taglib to access file content
Date Wed, 10 Oct 2007 18:32:10 GMT
Hi,

I am using jcr-taglib in my jsp to access jackrabbit contents. It works
fine if the content is a text and does not work if it is an inputstream.

I save the file node using the following code into the repository. And,
I'm able to access it using jcr api. But can't access the same thing
from this taglib. Upto the jcr:content node I can, but not the jcr:data.


Node fileNode = node.addNode(fileName, "nt:file");
Node resourceNode = fileNode.addNode ("jcr:content", "nt:resource");
resourceNode.setProperty ("jcr:mimeType", contentType);
resourceNode.setProperty ("jcr:data", inputStream);
Calendar lastModified = Calendar.getInstance ();
lastModified.setTimeInMillis (System.currentTimeMillis());
resourceNode.setProperty ("jcr:lastModified", lastModified);
session.save();

I get the following exception when I try to access jcr:data item from
the taglib. Has anyone come across the same issue?

2007-10-10 12:50:04,429 ERROR [org.apache.jackrabbit.core.ItemManager] -
failed
to retrieve item state of item
80469c98-f000-437c-a00d-4ec58d2f4e3c/{http://www.
jcp.org/jcr/1.0}data
org.apache.jackrabbit.core.state.ItemStateException: failed to read
property sta
te:
80469c98-f000-437c-a00d-4ec58d2f4e3c/{http://www.jcp.org/jcr/1.0}data
        at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.
load(DatabasePersistenceManager.java:392)
        at
org.apache.jackrabbit.core.state.SharedItemStateManager.loadItemState
(SharedItemStateManager.java:1155)
        at
org.apache.jackrabbit.core.state.SharedItemStateManager.getNonVirtual
ItemState(SharedItemStateManager.java:1080)
        at
org.apache.jackrabbit.core.state.SharedItemStateManager.getItemState(
SharedItemStateManager.java:252)
        at
org.apache.jackrabbit.core.state.LocalItemStateManager.getPropertySta
te(LocalItemStateManager.java:120)
        at
org.apache.jackrabbit.core.state.LocalItemStateManager.getItemState(L
ocalItemStateManager.java:152)
        at
org.apache.jackrabbit.core.state.XAItemStateManager.getItemState(XAIt
emStateManager.java:226)
        at
org.apache.jackrabbit.core.state.SessionItemStateManager.getItemState
(SessionItemStateManager.java:175)
        at
org.apache.jackrabbit.core.ItemManager.createItemInstance(ItemManager
.java:493)
        at
org.apache.jackrabbit.core.ItemManager.getItem(ItemManager.java:324)
        at
org.apache.jackrabbit.core.NodeImpl.getProperty(NodeImpl.java:2506)
        at
org.apache.jackrabbit.taglib.template.SimpleTemplateEngine.write(Simp
leTemplateEngine.java:57)
        at org.apache.jackrabbit.taglib.OutTag.doEndTag(OutTag.java:106)
        at
org.apache.jsp.test_jsp._jspx_meth_jcr_out_0(org.apache.jsp.test_jsp:
160)
        at
org.apache.jsp.test_jsp._jspx_meth_jcr_session_0(org.apache.jsp.test_
jsp:133)
        at
org.apache.jsp.test_jsp._jspService(org.apache.jsp.test_jsp:82)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper
.java:373)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:4
64)
        at
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:358)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491
)
        at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1074)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:264)
        at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.invoke(Filt
erSecurityInterceptor.java:107)
        at
org.acegisecurity.intercept.web.FilterSecurityInterceptor.doFilter(Fi
lterSecurityInterceptor.java:72)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:274)
        at
org.acegisecurity.ui.ExceptionTranslationFilter.doFilter(ExceptionTra
nslationFilter.java:110)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:274)
        at
org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFil
ter(AnonymousProcessingFilter.java:125)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:274)
        at
org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(R
ememberMeProcessingFilter.java:135)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:274)
        at
org.acegisecurity.wrapper.SecurityContextHolderAwareRequestFilter.doF
ilter(SecurityContextHolderAwareRequestFilter.java:81)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:274)
        at
org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProces
singFilter.java:217)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:274)
        at
org.acegisecurity.ui.logout.LogoutFilter.doFilter(LogoutFilter.java:1
06)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:274)
        at
org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilte
r(HttpSessionContextIntegrationFilter.java:229)
        at
org.acegisecurity.util.FilterChainProxy$VirtualFilterChain.doFilter(F
ilterChainProxy.java:274)
        at
org.acegisecurity.util.FilterChainProxy.doFilter(FilterChainProxy.jav
a:148)
        at
org.acegisecurity.util.FilterToBeanProxy.doFilter(FilterToBeanProxy.j
ava:98)
        at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1065)
        at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilt
er.java:119)
        at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilte
r.java:55)
        at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(Servlet
Handler.java:1065)
        at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:3
65)
        at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav
a:185)
        at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1
81)
        at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:6
89)
        at
org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391)

        at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHand
lerCollection.java:146)
        at
org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.
java:114)
        at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1
39)
        at org.mortbay.jetty.Server.handle(Server.java:285)
        at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:45
7)
        at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpCo
nnection.java:751)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500)
        at
org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209)
        at
org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357)
        at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.ja
va:329)
        at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool
.java:475)
Caused by: java.io.IOException:
/80/46/9c98f000437ca00d4ec58d2f4e3c/%7bhttp%3a%2
f%2fwww.jcp.org%2fjcr%2f1.0%7ddata.0.bin: the specified resource does
not exist
        at
org.apache.jackrabbit.core.value.BLOBFileValue.<init>(BLOBFileValue.j
ava:231)
        at
org.apache.jackrabbit.core.value.InternalValue.create(InternalValue.j
ava:217)
        at
org.apache.jackrabbit.core.persistence.util.Serializer.deserialize(Se
rializer.java:291)
        at
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.
load(DatabasePersistenceManager.java:383)

Thanks,
Mona

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message