jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chirag.Jakha...@zycus.com
Subject Storing Document using JBoss throws exception
Date Fri, 18 Jul 2008 07:54:59 GMT
When I try to store the document I get the following exception

JBoss 4.0.5
JackRabbit 1.4.5
JDK 1.5

Thanks in advance

CSJakharia



Code 

It is called by 

addFileNode("a.txt",new ByteArrayInputStream(byte[]))


private Node addFileNode(String fileName,InputStream stream)
        {
                MimeTable mt = MimeTable.getDefaultTable();
                String mimeType = mt.getContentTypeFor(fileName);
                if (mimeType == null) 
                        mimeType = "application/octet-stream";
                try {
                        Node 
fileNode=folderNode.addNode(NAMESPACE_FILE+":"+fileName,JcrConstants.NT_FILE);
                        fileNode.addMixin(JcrConstants.MIX_REFERENCEABLE);
                        Node resNode = 
fileNode.addNode(JcrConstants.JCR_CONTENT, JcrConstants.NT_RESOURCE);
                        resNode.addMixin(JcrConstants.MIX_VERSIONABLE);
                        resNode.setProperty(JcrConstants.JCR_MIMETYPE , 
mimeType);
                        resNode.setProperty(JcrConstants.JCR_ENCODING, 
"");
                        resNode.setProperty(JcrConstants.JCR_DATA, 
stream);
                        Calendar lastModified = Calendar.getInstance();
 //lastModified.setTimeInMillis(file.lastModified());
                        lastModified.setTimeInMillis(new 
Date().getTime());
                        resNode.setProperty(JcrConstants.JCR_LASTMODIFIED, 
lastModified);
                        //fileNode.setProperty(PROPERTY_LATEST_VERSIONNO, 
1.0);
                        folderNode.save();
                        Version version = resNode.checkin();
                        resNode.getVersionHistory().addVersionLabel(
                                version.getName(), String.valueOf(1.0), 
false);
 
                        return fileNode;
                } catch (ItemExistsException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (PathNotFoundException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (NoSuchNodeTypeException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (LockException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (VersionException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (ConstraintViolationException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (ValueFormatException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                } catch (RepositoryException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                }
                return null;
        }

java.lang.NullPointerException
        at java.io.FileInputStream.<init>(FileInputStream.java:103)
        at 
org.apache.jackrabbit.core.value.BLOBInTempFile.getStream(BLOBInTempFile.java:145)
        at 
org.apache.jackrabbit.core.persistence.util.Serializer.serialize(Serializer.java:198)
        at 
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:476)
        at 
org.apache.jackrabbit.core.persistence.AbstractPersistenceManager.store(AbstractPersistenceManager.java:75)
        at 
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:282)
        at 
org.apache.jackrabbit.core.state.SharedItemStateManager$Update.end(SharedItemStateManager.java:688)
        at 
org.apache.jackrabbit.core.state.XAItemStateManager.commit(XAItemStateManager.java:162)
        at 
org.apache.jackrabbit.core.version.XAVersionManager.commit(XAVersionManager.java:476)
        at 
org.apache.jackrabbit.core.TransactionContext.commit(TransactionContext.java:189)
        at 
org.apache.jackrabbit.core.XASessionImpl.commit(XASessionImpl.java:339)
        at 
org.apache.jackrabbit.jca.TransactionBoundXAResource.commit(TransactionBoundXAResource.java:39)
        at 
org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2253)
        at 
org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1784)
        at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:358)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
        at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
        at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
        at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
        at 
org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
        at org.jboss.ejb.Container.invoke(Container.java:954)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at 
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at 
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
        at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
        at java.lang.Thread.run(Thread.java:595)
2008-01-18 07:27:43,609 WARN  [TransactionImpl] XAException: 
tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=dummy2067/14, 
BranchQual=, localId=14] errorCode=XA_RBOTHER
javax.transaction.xa.XAException
        at 
org.apache.jackrabbit.core.TransactionContext.commit(TransactionContext.java:202)
        at 
org.apache.jackrabbit.core.XASessionImpl.commit(XASessionImpl.java:339)
        at 
org.apache.jackrabbit.jca.TransactionBoundXAResource.commit(TransactionBoundXAResource.java:39)
        at 
org.jboss.tm.TransactionImpl$Resource.commit(TransactionImpl.java:2253)
        at 
org.jboss.tm.TransactionImpl.commitResources(TransactionImpl.java:1784)
        at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:358)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:501)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:361)
        at 
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)
        at 
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:168)
        at 
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)
        at 
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:136)
        at 
org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:648)
        at org.jboss.ejb.Container.invoke(Container.java:954)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at 
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at 
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at 
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:819)
        at 
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:420)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at 
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
        at sun.rmi.transport.Transport$1.run(Transport.java:153)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
        at 
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
        at 
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
        at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.jackrabbit.core.TransactionException: Unable to 
commit transaction.
        at 
org.apache.jackrabbit.core.state.XAItemStateManager.commit(XAItemStateManager.java:165)
        at 
org.apache.jackrabbit.core.version.XAVersionManager.commit(XAVersionManager.java:476)
        at 
org.apache.jackrabbit.core.TransactionContext.commit(TransactionContext.java:189)
        ... 35 more
Caused by: org.apache.jackrabbit.core.state.ItemStateException: failed to 
write property state: 
355dbf51-383b-497e-b186-e92161aa2302/{http://www.jcp.org/jcr/1.0}data
        at 
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:487)
        at 
org.apache.jackrabbit.core.persistence.AbstractPersistenceManager.store(AbstractPersistenceManager.java:75)
        at 
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:282)
        at 
org.apache.jackrabbit.core.state.SharedItemStateManager$Update.end(SharedItemStateManager.java:688)
        at 
org.apache.jackrabbit.core.state.XAItemStateManager.commit(XAItemStateManager.java:162)
        ... 37 more
Caused by: java.lang.NullPointerException
        at java.io.FileInputStream.<init>(FileInputStream.java:103)
        at 
org.apache.jackrabbit.core.value.BLOBInTempFile.getStream(BLOBInTempFile.java:145)
        at 
org.apache.jackrabbit.core.persistence.util.Serializer.serialize(Serializer.java:198)
        at 
org.apache.jackrabbit.core.persistence.db.DatabasePersistenceManager.store(DatabasePersistenceManager.java:476)
        ... 41 more
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message