Hi Nirmal,
<groupId>org.wso2.carbon</groupId> <artifactId>org.wso2.carbon.registry.core</artifactId> <version>4.2.0</version> On Wed, Dec 3, 2014 at 9:28 AM, Nirmal Fernando <[email protected]> wrote: > What's your registry core version? > > On Wed, Dec 3, 2014 at 9:08 AM, Vinuri Perera <[email protected]> wrote: > >> Hi Niraml, >> >> the error occurs when I'm trying to get the content from the registry >> before deserializeing, >> >> >> Resource governanceFile = registry.get("/_system/governance >> /Test/appserverblabla2796"); >> >> Object resourceObj= governanceFile.getContent(); >> >> >> >> >> >> On Wed, Dec 3, 2014 at 9:02 AM, Nirmal Fernando <[email protected]> wrote: >> >>> resource.getContent would return a byte[] in that case. deserialize it >>> like below; >>> >>> public static Object deserializeFromByteArray(byte[] bytes) throws >>> Exception { >>> >>> >>> ByteArrayInputStream bis = new ByteArrayInputStream(bytes); >>> >>> ObjectInput in = null; >>> >>> try { >>> >>> in = new ObjectInputStream(bis); >>> >>> Object o = in.readObject(); >>> >>> >>> return o; >>> >>> >>> } finally { >>> >>> bis.close(); >>> >>> if (in != null) { >>> >>> in.close(); >>> >>> } >>> >>> } >>> >>> } >>> >>> On Wed, Dec 3, 2014 at 8:54 AM, Vinuri Perera <[email protected]> wrote: >>> >>>> Hi, >>>> >>>> I wanted to get the content of a java serialized file, which was in a >>>> registry. I was able to get the content of a normal text file using >>>> getContent() but not in a serialized file. >>>> >>>> I'm getting the following exception >>>> I tried adding the Media type as "application/java-serialized-object" >>>> still I get the same exception >>>> Any idea how to fix this? >>>> --------------- >>>> >>>> Exception in thread "main" >>>> org.wso2.carbon.registry.core.exceptions.RegistryException: Failed to >>>> get resource content >>>> >>>> at >>>> org.wso2.carbon.registry.ws.client.resource.OnDemandContentResourceImpl.getContent( >>>> OnDemandContentResourceImpl.java:52) >>>> >>>> at com.client.registry.RegistryClient.main(RegistryClient.java:118) >>>> >>>> Caused by: org.apache.axiom.om.OMException: Failed to fetch the MIME >>>> part content >>>> >>>> at org.apache.axiom.attachments.PartContentFactory.createPartContent( >>>> PartContentFactory.java:106) >>>> >>>> at org.apache.axiom.attachments.PartImpl.fetch(PartImpl.java:176) >>>> >>>> at org.apache.axiom.attachments.PartImpl.getContent(PartImpl.java:149) >>>> >>>> at org.apache.axiom.attachments.PartImpl.writeTo(PartImpl.java:238) >>>> >>>> at org.apache.axiom.attachments.PartDataHandler.writeTo( >>>> PartDataHandler.java:65) >>>> >>>> at >>>> org.wso2.carbon.registry.ws.client.registry.WSRegistryClientUtils.makeBytesFromDataHandler( >>>> WSRegistryClientUtils.java:152) >>>> >>>> at >>>> org.wso2.carbon.registry.ws.client.registry.WSRegistryServiceClient.getContent( >>>> WSRegistryServiceClient.java:951) >>>> >>>> at >>>> org.wso2.carbon.registry.ws.client.resource.OnDemandContentResourceImpl.getContent( >>>> OnDemandContentResourceImpl.java:48) >>>> >>>> ... 1 more >>>> >>>> Caused by: java.io.IOException: Attempted read on closed stream. >>>> >>>> at org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed( >>>> AutoCloseInputStream.java:183) >>>> >>>> at org.apache.commons.httpclient.AutoCloseInputStream.read( >>>> AutoCloseInputStream.java:107) >>>> >>>> at java.io.FilterInputStream.read(FilterInputStream.java:133) >>>> >>>> at org.apache.axiom.om.util.DetachableInputStream.read( >>>> DetachableInputStream.java:147) >>>> >>>> at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer( >>>> BufferedLineReaderInputStream.java:111) >>>> >>>> at org.apache.james.mime4j.io.MimeBoundaryInputStream.fillBuffer( >>>> MimeBoundaryInputStream.java:223) >>>> >>>> at org.apache.james.mime4j.io.MimeBoundaryInputStream.read( >>>> MimeBoundaryInputStream.java:157) >>>> >>>> at org.apache.james.mime4j.io.BufferedLineReaderInputStream.fillBuffer( >>>> BufferedLineReaderInputStream.java:111) >>>> >>>> at org.apache.james.mime4j.io.BufferedLineReaderInputStream.read( >>>> BufferedLineReaderInputStream.java:158) >>>> >>>> at org.apache.james.mime4j.io.LineReaderInputStreamAdaptor.read( >>>> LineReaderInputStreamAdaptor.java:67) >>>> >>>> at org.apache.axiom.attachments.utils.BAAOutputStream.readFrom( >>>> BAAOutputStream.java:112) >>>> >>>> at >>>> org.apache.axiom.attachments.impl.BufferUtils.inputStream2OutputStream( >>>> BufferUtils.java:76) >>>> >>>> at org.apache.axiom.attachments.PartContentFactory.createPartContent( >>>> PartContentFactory.java:83) >>>> ... 8 more >>>> >>>> Thanks, >>>> ~Vinuri~ >>>> -- >>>> Vinuri Perera >>>> Software Engineer | WSO2 Inc >>>> >>>> M : 0711518805 >>>> >>>> >>>> _______________________________________________ >>>> Dev mailing list >>>> [email protected] >>>> http://wso2.org/cgi-bin/mailman/listinfo/dev >>>> >>>> >>> >>> >>> -- >>> >>> Thanks & regards, >>> Nirmal >>> >>> Senior Software Engineer- Platform Technologies Team, WSO2 Inc. >>> Mobile: +94715779733 >>> Blog: http://nirmalfdo.blogspot.com/ >>> >>> >>> >> >> >> -- >> Vinuri Perera >> Software Engineer | WSO2 Inc >> >> M : 0711518805 >> >> > > > -- > > Thanks & regards, > Nirmal > > Senior Software Engineer- Platform Technologies Team, WSO2 Inc. > Mobile: +94715779733 > Blog: http://nirmalfdo.blogspot.com/ > > > -- Vinuri Perera Software Engineer | WSO2 Inc M : 0711518805
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
