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

Blob storage to file system - Malformed key? #124

Open
shoon opened this issue Jun 10, 2014 · 4 comments
Open

Blob storage to file system - Malformed key? #124

shoon opened this issue Jun 10, 2014 · 4 comments

Comments

@shoon
Copy link

shoon commented Jun 10, 2014

Version: Play-morphia 1.5.0a

I get a warning every time I save a blob in my model:

10:19:51,968 WARN  ~ error load blob by key[MyStoredBlob_53971403a31057eb1c0aefd6]
java.io.IOException: File is a directory or not readable
        at org.osgl.storage.impl.SObject.of(SObject.java:156)
        at org.osgl.storage.impl.SObject.valueOf(SObject.java:166)
        at org.osgl.storage.impl.FileSystemService.get(FileSystemService.java:84)
        at play.modules.morphia.BlobStorageService.get(BlobStorageService.java:172)
        at play.modules.morphia.Blob.load(Blob.java:179)
        at models.MyBlob.loadBlobs(MyBlob.java)
        at play.modules.morphia.Model._h_Loaded(Model.java:950)
        at play.modules.morphia.MorphiaPlugin$1.postLoad(MorphiaPlugin.java:588)
        at org.mongodb.morphia.mapping.MappedClass.callGlobalInterceptors(MappedClass.java:458)
        at org.mongodb.morphia.mapping.MappedClass.callLifecycleMethods(MappedClass.java:421)
        at org.mongodb.morphia.mapping.Mapper.fromDb(Mapper.java:597)
        at org.mongodb.morphia.mapping.Mapper.fromDBObject(Mapper.java:296)
        at org.mongodb.morphia.query.MorphiaIterator.convertItem(MorphiaIterator.java:78)
        at org.mongodb.morphia.query.MorphiaIterator.processItem(MorphiaIterator.java:65)
        at org.mongodb.morphia.query.MorphiaIterator.next(MorphiaIterator.java:60)
        at org.mongodb.morphia.query.QueryImpl.get(QueryImpl.java:415)
        at play.modules.morphia.Model$MorphiaQuery.get(Model.java:1580)
        at play.modules.morphia.Model.findById(Model.java:747)
        at models.MyBlob.findById(MyBlob.java)
        at controllers.StorageApi.saveMyBlob(StorageApi.java:158)
        at play.mvc.ActionInvoker.invokeWithContinuation(ActionInvoker.java:557)
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:508)
        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
        at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
        at play.mvc.ActionInvoker.invoke(ActionInvoker.java:161)
        at Invocation.HTTP Request(Play!)

The file is committed to the file system just fine and I can retrieve it.

The file is in a time stamped directory and has the file extension. I suspect the key fed to the osgl reader is missing the directory or the file extension.

find . | grep 53971403a31057eb1c0aefd6

./2014/06/10/MyStoredBlob_53971403a31057eb1c0aefd6.zip
./2014/06/10/MyStoredBlob_53971403a31057eb1c0aefd6.zip.attr

My configuration:

morphia.id.type=ObjectId
morphia.logger=false

morphia.db.seeds=192.168.1.10:27017
morphia.db.name=xx
morphia.db.username=xx
morphia.db.password=xx

morphia.storage=fs
morphia.storage.default=fs

morphia.storage.migrateData=false

morphia.storage.fs.serviceImpl=org.osgl.storage.impl.FileSystemService

morphia.storage.fs.home.dir=/test/db/morphia_upload_files
morphia.storage.fs.home.url=/public/uploads
@shoon
Copy link
Author

shoon commented Jun 11, 2014

Pretty sure this is related to #117

@greenlaw110
Copy link
Collaborator

#117 closed already, so you mean the issue is still there? Or the fix to #117 caused this issue? Sorry I don't have too much time on play-morphia for the moment

@shoon
Copy link
Author

shoon commented Jun 13, 2014

I think the issue in 117 is resolved but there's a section of code that prints out the warning but continues on:

BlobStorageService.java, Line 171

@shoon
Copy link
Author

shoon commented Mar 11, 2015

I started a new project recently and wanted to note here how I muted the warning in log4j using StringMatchFilter. Some day will submit a patch :)

log4j.appender.Rolling.filter.1=org.apache.log4j.varia.StringMatchFilter
log4j.appender.Rolling.filter.1.StringToMatch=error load blob by key
log4j.appender.Rolling.filter.1.AcceptOnMatch=false

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

2 participants