jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vibhu Sharma <vi...@projectoffguard.com>
Subject Re: problem attaching InputStream to jcr:data
Date Mon, 15 Jun 2009 05:22:27 GMT
Hi

I was able to pinpoint and solve the problem. The problem was with the
commons-io.jar version in the classpath. I had commons-io-1.1.jar,
which I replaced with version 1.4
This corrected the problem.
Thanks for the support, and I am really sorry to waste your time.

warm regards
Vibhu

On Sun, Jun 14, 2009 at 6:10 PM, Guo Du<mrduguo@gmail.com> wrote:
> You may need to create the stream value before set the property:
>
> node.setProperty("jcr:data",
> session.getValueFactory().createValue(fileInputStream));
>
> Good luck!
>
>
>
> On Sat, Jun 13, 2009 at 11:44 PM, Vibhu Sharma <vibhu@projectoffguard.com>wrote:
>
>> Hi,
>> I have just downloaded the jackrabbit-1.5.5 jars and now when I am
>> trying to upload a file and attach it to jcr:data of nt:resource,
>> tomcat just throws an Exception - javax.servlet.ServletException:
>> Servlet execution threw an exception
>>
>> May anyone point me where the problem is. Thanks in advance
>>
>> I am using Tomcat 6 with jackrabbit 1.5.5, LocalfileSystem on a
>> Windows Box and DerbyPersistence Manager.
>>
>> The code snippet for adding the node is as follows:
>>
>> fileNode = baseNode.addNode("nameOfNode", "nt:file");
>> contentNode = fileNode.addNode("jcr:content","nt:resource");
>> _logger.debug(" setting the uploaded content in text node :
>> "+content.getMimeType());
>> _logger.debug(" setting the jcr:data ");
>> contentNode.setProperty("jcr:data", content.getContentStream());
>> _logger.debug(" set the jcr:data");
>> contentNode.setProperty("jcr:mimeType", content.getMimeType());
>> _logger.debug(" set the mime type : file : "+content.getContentStream());
>> _logger.debug(" setting the jcr:lastModified  ");
>> contentNode.setProperty("jcr:lastModified", Calendar.getInstance());
>> _logger.debug(" text node specific properties added successfully");
>>
>> the Logger just prints "setting the jcr:data" and then the page
>> displays the above mentioned exception
>>
>> Following is the snippet of the log
>>
>> DEBUG [main] (RepositoryImpl.java:428) - No configuration entry for
>> SecurityManager. Using
>> org.apache.jackrabbit.core.security.simple.SimpleSecurityManager
>>  INFO [main] (SimpleSecurityManager.java:116) - init: using Repository
>> LoginModule configuration for Jackrabbit
>> DEBUG [main] (SimpleSecurityManager.java:136) - No adminID defined in
>> LoginModule/JAAS config -> using default.
>> DEBUG [main] (ProviderRegistryImpl.java:66) - Could not register
>> principal provider: principalProvider configuration entry missing.
>>  INFO [main] (RepositoryImpl.java:435) - SecurityManager = class
>> org.apache.jackrabbit.core.security.simple.SimpleSecurityManager
>> DEBUG [main] (AbstractLoginModule.java:119) - Initalize LoginModule:
>> DEBUG [main] (AbstractLoginModule.java:138) - - PrincipalProvider ->
>>
>> 'org.apache.jackrabbit.core.security.simple.SimpleSecurityManager$SimplePrincipalProvider'
>> DEBUG [main] (SimpleLoginModule.java:44) - init: SimpleLoginModule. Done.
>> DEBUG [main] (AbstractLoginModule.java:163) - - Option: anonymousId ->
>> 'anonymous'
>> DEBUG [main] (MLRUItemStateCache.java:148) -
>> org.apache.jackrabbit.core.state.MLRUItemStateCache@b41166 size=1,
>> 3664/4194304
>> DEBUG [main] (RepositoryConfig.java:176) - got repository session for text
>> DEBUG [main] (RepositoryConfig.java:73) - got session, now registering
>> node types...
>> DEBUG [main] (NodeTypeRegistry.java:1287) -
>> {http://www.projectoffguard.com/base}text<http://www.projectoffguard.com/base%7Dtext>already
exists
>> FATAL [main] (RepositoryConfig.java:99) - error instantiating session
>> or registering node types : Invalid node type definition:
>> {http://www.projectoffguard.com/base}text<http://www.projectoffguard.com/base%7Dtext>already
exists
>> DEBUG [main] (DBSource.java:24) - reached DbHelper
>> DEBUG [http-8080-1] (BeanUtilsBean.java:814) -
>> BeanUtils.populate(com.offguard.upload.form.ContentForm@43487e,
>> {content.genre=[Ljava.lang.String;@14c7a98,
>> content.subGenre=[Ljava.lang.String;@4a96a,
>> type=[Ljava.lang.String;@e920f, userId=[Ljava.lang.String;@974600,
>> content.title=[Ljava.lang.String;@174cb21,
>> content.language=[Ljava.lang.String;@c3e967, media=DarshanResume.pdf,
>> content.description=[Ljava.lang.String;@1079ff})
>> DEBUG [http-8080-1] (BeanUtilsBean.java:895) -
>> setProperty(com.offguard.upload.form.ContentForm@43487e,
>> content.genre, [aw])
>> DEBUG [http-8080-1] (BeanUtilsBean.java:910) -     Target bean = [
>> null , 0 , null , false , false , null , null ]
>> DEBUG [http-8080-1] (BeanUtilsBean.java:911) -     Target name = genre
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:460) - Convert string 'aw'
>> to class 'java.lang.String'
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:468) -   Using converter
>> ConverterFacade[StringConverter[UseDefault=true]]
>> DEBUG [http-8080-1] (AbstractConverter.java:127) - Converting 'String'
>> value 'aw' to type 'String'
>> DEBUG [http-8080-1] (PropertyUtilsBean.java:2138) - setSimpleProperty:
>> Invoking method public void
>> com.offguard.bean.content.Content.setGenre(java.lang.String) with
>> value aw (class java.lang.String)
>> DEBUG [http-8080-1] (BeanUtilsBean.java:895) -
>> setProperty(com.offguard.upload.form.ContentForm@43487e,
>> content.subGenre, [aw])
>> DEBUG [http-8080-1] (BeanUtilsBean.java:910) -     Target bean = [
>> null , 0 , null , false , false , null , null ]
>> DEBUG [http-8080-1] (BeanUtilsBean.java:911) -     Target name = subGenre
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:460) - Convert string 'aw'
>> to class 'java.lang.String'
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:468) -   Using converter
>> ConverterFacade[StringConverter[UseDefault=true]]
>> DEBUG [http-8080-1] (AbstractConverter.java:127) - Converting 'String'
>> value 'aw' to type 'String'
>> DEBUG [http-8080-1] (PropertyUtilsBean.java:2138) - setSimpleProperty:
>> Invoking method public void
>> com.offguard.bean.content.Content.setSubGenre(java.lang.String) with
>> value aw (class java.lang.String)
>> DEBUG [http-8080-1] (BeanUtilsBean.java:895) -
>> setProperty(com.offguard.upload.form.ContentForm@43487e, type, [1])
>> DEBUG [http-8080-1] (BeanUtilsBean.java:910) -     Target bean =
>> com.offguard.upload.form.ContentForm@43487e
>> DEBUG [http-8080-1] (BeanUtilsBean.java:911) -     Target name = type
>> DEBUG [http-8080-1] (MethodUtils.java:941) - Matching name=getType on
>> class com.offguard.upload.form.ContentForm
>> DEBUG [http-8080-1] (MethodUtils.java:1026) - No match found.
>> DEBUG [http-8080-1] (MethodUtils.java:941) - Matching name=isType on
>> class com.offguard.upload.form.ContentForm
>> DEBUG [http-8080-1] (MethodUtils.java:1026) - No match found.
>> DEBUG [http-8080-1] (BeanUtilsBean.java:895) -
>> setProperty(com.offguard.upload.form.ContentForm@43487e, userId,
>> [1001])
>> DEBUG [http-8080-1] (BeanUtilsBean.java:910) -     Target bean =
>> com.offguard.upload.form.ContentForm@43487e
>> DEBUG [http-8080-1] (BeanUtilsBean.java:911) -     Target name = userId
>> DEBUG [http-8080-1] (MethodUtils.java:941) - Matching name=getUserId
>> on class com.offguard.upload.form.ContentForm
>> DEBUG [http-8080-1] (MethodUtils.java:1026) - No match found.
>> DEBUG [http-8080-1] (MethodUtils.java:941) - Matching name=isUserId on
>> class com.offguard.upload.form.ContentForm
>> DEBUG [http-8080-1] (MethodUtils.java:1026) - No match found.
>> DEBUG [http-8080-1] (BeanUtilsBean.java:895) -
>> setProperty(com.offguard.upload.form.ContentForm@43487e,
>> content.title, [aw])
>> DEBUG [http-8080-1] (BeanUtilsBean.java:910) -     Target bean = [
>> null , 0 , null , false , false , null , null ]
>> DEBUG [http-8080-1] (BeanUtilsBean.java:911) -     Target name = title
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:460) - Convert string 'aw'
>> to class 'java.lang.String'
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:468) -   Using converter
>> ConverterFacade[StringConverter[UseDefault=true]]
>> DEBUG [http-8080-1] (AbstractConverter.java:127) - Converting 'String'
>> value 'aw' to type 'String'
>> DEBUG [http-8080-1] (PropertyUtilsBean.java:2138) - setSimpleProperty:
>> Invoking method public void
>> com.offguard.bean.content.Content.setTitle(java.lang.String) with
>> value aw (class java.lang.String)
>> DEBUG [http-8080-1] (BeanUtilsBean.java:895) -
>> setProperty(com.offguard.upload.form.ContentForm@43487e,
>> content.language, [awe])
>> DEBUG [http-8080-1] (BeanUtilsBean.java:910) -     Target bean = [
>> null , 0 , aw , false , false , null , null ]
>> DEBUG [http-8080-1] (BeanUtilsBean.java:911) -     Target name = language
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:460) - Convert string 'awe'
>> to class 'java.lang.String'
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:468) -   Using converter
>> ConverterFacade[StringConverter[UseDefault=true]]
>> DEBUG [http-8080-1] (AbstractConverter.java:127) - Converting 'String'
>> value 'awe' to type 'String'
>> DEBUG [http-8080-1] (PropertyUtilsBean.java:2138) - setSimpleProperty:
>> Invoking method public void
>> com.offguard.bean.content.Content.setLanguage(java.lang.String) with
>> value awe (class java.lang.String)
>> DEBUG [http-8080-1] (BeanUtilsBean.java:895) -
>> setProperty(com.offguard.upload.form.ContentForm@43487e, media,
>> DarshanResume.pdf)
>> DEBUG [http-8080-1] (BeanUtilsBean.java:910) -     Target bean =
>> com.offguard.upload.form.ContentForm@43487e
>> DEBUG [http-8080-1] (BeanUtilsBean.java:911) -     Target name = media
>> DEBUG [http-8080-1] (PropertyUtilsBean.java:2138) - setSimpleProperty:
>> Invoking method public void
>>
>> com.offguard.upload.form.ContentForm.setMedia(org.apache.struts.upload.FormFile)
>> with value DarshanResume.pdf (class
>> org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile)
>> DEBUG [http-8080-1] (BeanUtilsBean.java:895) -
>> setProperty(com.offguard.upload.form.ContentForm@43487e,
>> content.description, [aw])
>> DEBUG [http-8080-1] (BeanUtilsBean.java:910) -     Target bean = [
>> null , 0 , aw , false , false , awe , null ]
>> DEBUG [http-8080-1] (BeanUtilsBean.java:911) -     Target name =
>> description
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:460) - Convert string 'aw'
>> to class 'java.lang.String'
>> DEBUG [http-8080-1] (ConvertUtilsBean.java:468) -   Using converter
>> ConverterFacade[StringConverter[UseDefault=true]]
>> DEBUG [http-8080-1] (AbstractConverter.java:127) - Converting 'String'
>> value 'aw' to type 'String'
>> DEBUG [http-8080-1] (PropertyUtilsBean.java:2138) - setSimpleProperty:
>> Invoking method public void
>> com.offguard.bean.content.Content.setDescription(java.lang.String)
>> with value aw (class java.lang.String)
>> DEBUG [http-8080-1] (DBAuthenticator.java:57) -  getting connection
>> DEBUG [http-8080-1] (DBAuthenticator.java:107) - sql : select status
>> from user_account where user_id = 1001
>> DEBUG [http-8080-1] (DBAuthenticator.java:38) - authentication successful
>> DEBUG [http-8080-1] (CommonAction.java:64) - authentication successful
>> DEBUG [http-8080-1] (AddAction.java:43) - in process action
>> DEBUG [http-8080-1] (AddAction.java:102) - Addaction - in set propertiesb
>> DEBUG [http-8080-1] (AddAction.java:106) - currDate : 2009:06:14:03:33:55
>> DEBUG [http-8080-1] (AddAction.java:126) - --- content : size : 35000
>> DEBUG [http-8080-1] (AddAction.java:127) - --- content : size :
>> application/pdf
>> DEBUG [http-8080-1] (AddAction.java:128) - --- media :
>> java.io.ByteArrayInputStream@12ea1dd
>> DEBUG [http-8080-1] (RepositoryConfig.java:119) - getting repository
>> session for text
>> DEBUG [http-8080-1] (AbstractLoginModule.java:119) - Initalize LoginModule:
>> DEBUG [http-8080-1] (AbstractLoginModule.java:138) - -
>> PrincipalProvider ->
>>
>> 'org.apache.jackrabbit.core.security.simple.SimpleSecurityManager$SimplePrincipalProvider'
>> DEBUG [http-8080-1] (SimpleLoginModule.java:44) - init: SimpleLoginModule.
>> Done.
>> DEBUG [http-8080-1] (AbstractLoginModule.java:163) - - Option:
>> anonymousId -> 'anonymous'
>> DEBUG [http-8080-1] (MLRUItemStateCache.java:148) -
>> org.apache.jackrabbit.core.state.MLRUItemStateCache@8fa0d1 size=1,
>> 3664/4194304
>> DEBUG [http-8080-1] (RepositoryConfig.java:123) - got repository
>> session for text
>> DEBUG [http-8080-1] (ContentDAO.java:43) -  entered add node
>> DEBUG [http-8080-1] (MLRUItemStateCache.java:148) -
>> org.apache.jackrabbit.core.state.MLRUItemStateCache@10275fa size=1,
>> 2164/4194304
>> DEBUG [http-8080-1] (ItemManager.java:787) - caching item
>> cafebabe-cafe-babe-cafe-babecafebabe
>> DEBUG [http-8080-1] (ItemManager.java:787) - caching item
>> 9265f3d8-6d19-4d00-9d7d-24d00131ff80
>> DEBUG [http-8080-1] (ItemManager.java:787) - caching item
>> 9265f3d8-6d19-4d00-9d7d-24d00131ff80/{
>> http://www.jcp.org/jcr/1.0}primaryType<http://www.jcp.org/jcr/1.0%7DprimaryType>
>> DEBUG [http-8080-1] (ItemManager.java:787) - caching item
>> 9265f3d8-6d19-4d00-9d7d-24d00131ff80/{http://www.jcp.org/jcr/1.0}uuid<http://www.jcp.org/jcr/1.0%7Duuid>
>> DEBUG [http-8080-1] (TextDAO.java:29) -  setting the uploaded content
>> in text node : application/pdf
>> DEBUG [http-8080-1] (TextDAO.java:31) -  setting the jcr:data
>> DEBUG [http-8080-1] (ItemManager.java:787) - caching item
>> 9265f3d8-6d19-4d00-9d7d-24d00131ff80/{http://www.jcp.org/jcr/1.0}data<http://www.jcp.org/jcr/1.0%7Ddata>
>> DEBUG [http-8080-1] (ItemManager.java:884) - destroyed item
>> 9265f3d8-6d19-4d00-9d7d-24d00131ff80/{http://www.jcp.org/jcr/1.0}data<http://www.jcp.org/jcr/1.0%7Ddata>
>> DEBUG [http-8080-1] (ItemManager.java:801) - removing items
>> 9265f3d8-6d19-4d00-9d7d-24d00131ff80/{http://www.jcp.org/jcr/1.0}data<http://www.jcp.org/jcr/1.0%7Ddata>
>> from cache
>> DEBUG [http-8080-1] (ItemManager.java:884) - destroyed item
>> 9265f3d8-6d19-4d00-9d7d-24d00131ff80
>> DEBUG [http-8080-1] (ItemManager.java:801) - removing items
>> 9265f3d8-6d19-4d00-9d7d-24d00131ff80 from cache
>> DEBUG [http-8080-1] (ItemManager.java:874) - invalidated item
>> cafebabe-cafe-babe-cafe-babecafebabe
>> DEBUG [http-8080-1] (ItemManager.java:818) - removing item
>> cafebabe-cafe-babe-cafe-babecafebabe from cache
>>
>
>
>
> --
> Kind regards,
>
> Du, Guo
>

Mime
View raw message