So I am I am using java and maven and having an issue with my local google app engine, where i upload an image via the blobstore apis but then can not server the image back out, after restarting the app engine. An image uploaded, can be served prior to the restart.
What i think is happening is that the blob store is being cleared out when i restart (via the mvn clean). I had the same issue with the data store but fixed that by moving the data store file via a command line arg (-Ddatastore.backing_store)
What i can not find for the life of me is the proper command line arg for setting where the blob store is located. I think that if i set that my images would still be available to me.
ehhhhhhh... i feel like i could have found this before posting... but it was in a really weird spot.
The argument is blobstore.backing_store
i hope this helps someone tho.
Related
I've been searching for hours and came across a lot of non-sense about read-only this and that and folders and directories and viewing the phone fs, etc. etc.
All I want to do is write to a file that is on my PC for an Android project. I've tried to use local paths (Windows) and have been met with read-only fs system problems, even after completely converting the desired folder to read AND write, Android refuses to get it. I set uses-permissions in my manifest with WRITE_EXTERNAL_STORAGE and WRITE_INTERNAL_STORAGE, but no luck.
I've tried to write to the phone, via emulator and actual physical phone, but every search I make turns up nothing (searching for the name of the file).
How can I write to a log file, any file that is where my development source code is? I need to digest JSON data from a web service call and I need it to be written to a local file so that I can work with it. The calls are through Android, currently an emulator, and an install on a physical device, yet no log is written because either a read-only problem which is non-sense, or I just can't find the damn file.
Any help would be greatly appreciated.
I guess ultimately the question I asked was just too messy. I wanted to know where I could find "local" logs on my Android device, which I can open and read myself in some text editor. I also wanted to know where "local" logs/files are written to my hard disk when testing the app via emulator.
At this point, I haven't found anything relating to a log file or any arbitrary file being able to be written from an Android app to a local dev PC without being pulled from something like adb.
I have found the solution to where I can write arbitrary files to an emulator or phone's filesystem (Source: https://www.journaldev.com/9383/android-internal-storage-example-tutorial):
FileOutputStream fos = Main.getAppContext().openFileOutput( "myfile.txt", Context.MODE_PRIVATE );
fos.write( "Hello, world".getBytes() );
fos.close();
Some things to note (Android SDK 26+ at least, others are untested):
FileOutputStream works very well.
"Main" refers to whichever entry point class you're using for your app. It most likely (or must?) extends AppCompatActivity.
Context.MODE_PRIVATE seems to be required.
AndroidManifest.xml permissions READ_EXTERNAL_STORAGE, WRITE_EXTERNAL_STORAGE, READ_INTERNAL_STORAGE, WRITE_INTERNAL_STORAGE do NOT seem to be required.
Important: Files will be saved to /data/data/YOUR.APP.PACKAGE/files/.
This was also helpful: https://developer.android.com/training/data-storage
I have deployed the war into tomcat 7 Openshift . Everything is fine and its running .Myappp Here is my mapped web application.
I am storing images in the dir webapps->docs->images
But When I upload the image (with UI) it doesnt appear on site and I cant even find where images are stored (I connected using FTP -filezilla )
Where my deployed war file stored ? Do I need to make any changes in my code so to upload in proper dir of Openshift??
Thanks in advance
You should use your OPENSHIFT_DATA_DIR (~/app-root/data) to store uploaded images. However, using Java this presents some challenges. I would recommend that you read through this article (https://forums.openshift.com/how-to-upload-and-serve-files-using-java-servlets-on-openshift), it should help you with dealing with user uploaded images.
I'm new in app engine.
I created an Java application using Google app engine. I populated a database offline. I can access it at my localhost. I know that the local dev server stores data in local_db.bin.
When I upload the app to the online dev server, it doesn't upload my database. It is possible to upload the local_db.bin?
Thank you for you help.
Copying/deploying the local_db.bin file directly to Google servers will have no effect and that file is intended only for the SDK that runs locally. On production the datastore is a service and all implementation and files are hidden away from the user. Thus you can't copy or change the format for the file to achieve what you want.
See this link for
datastore copy
Depending how much data you have and how often you need to populate it then it might just be easier to re-populate it online, create some basic data bootstrapping code/script or an API/import process.
Now, after restarting a local App Engine app, local Google Cloud Storage data will be lost. How to avoid this?
[update] I use Java. It seems the Cloud Storage data is not saved in \war\WEB-INF\appengine-generated. When I use CTRL-C to terminate the server and restart it again, the data saved in Cloud Storage will not be found.
Do you mean a local version of the datastore? Add a flag like this: --datastore_path=/some/path/to/store/a/local/datastore/dev_appserver.datastore. It will store a local version that will persist. Otherwise, it overwrites the temp version every time you restart the app.
Lipis is correct. There are other commands that may be more suitable. From the Command-line arguments:
--storage_path=...
Path at which all local files (such as the Datastore, Blobstore files, Google Cloud Storage Files, logs, etc) will be stored, unless overridden by --datastore_path, --blobstore_path, --logs_path, etc.
You can also specify the location of the data store in java, but it's using undocumented features.
dev_appserver --property=datastore.backing_store=c:/temp/ds.bin <app directory>
To do it with Maven , please see my answer here
I am unable to upload a product image in broadleaf commerce via the broadleaf admin site. When I try to upload image from a local file, I get the following error
HTTP ERROR 500
Problem accessing /admin/asset/uploadAsset. Reason:
File operation attempted on file that is not in provided work area. D:\DOCUME~1\Gutha\LOCALS~1\Temp\5e\a2\gal_w01.jpg. Work area = D:\DOCUME~1\Gutha\LOCALS~1\Temp\/5e/a2/
I tried creating that folder, and placing the image in that area, but it is of no use becaues each time a new folder is being shown here. Could any one tell me where should I place the images to be uploaded?
Thanks in advance.
Sounds like a bug. I've opened a ticket that you can track here ...
https://github.com/BroadleafCommerce/BroadleafCommerce/issues/773
If you can, let us know what version you are running into the issue in the above ticket.
FYI, I work for Broadleaf Commerce.