Invalid stream header in GAE Standard

262 views
Skip to first unread message

Shachar Grembek

unread,
Apr 4, 2017, 12:03:45 PM4/4/17
to Google App Engine
Hi,

I am using Weka (v3.8.1) Machine Learning within my App Engine Application. In order to run it, I load my ML model file from the "WEB-INF" directory using Weka SDK by calling the following code:
Classifier cls = (Classifier) weka.core.SerializationHelper.read("WEB-INF/j48_2.model");
For some reason I get an exception reading my model file -
StreamCorruptedException with the message: "invalid stream header: EFBFBDEF".

Initially I suspected that the model file is corrupted, but when I run the same code from outside GAE, from a plain java project with the following maven dependency, it works perfectly and the same model file is loaded:
<dependency>
 
<groupId>nz.ac.waikato.cms.weka</groupId>
 
<artifactId>weka-stable</artifactId>
 
<version>3.8.1</version>
</dependency>
Is the content or the header of a file changes by packaging it in the GAE project? How can I overcome it?

I would really appreciate any advise.

Thanks
Shachar
j48_2.model

Jordan (Cloud Platform Support)

unread,
Apr 5, 2017, 3:32:38 PM4/5/17
to Google App Engine
Google Groups is meant for general product discussions and not for technical support.

If you believe this is a bug you can report this in an Issue Tracker. If you are looking for technical support I recommend you post your question on Stack Overflow or directly on the Weka Community form

Note, due to scaling optimizations you are not able to write to the App Engine instance file system (and should instead use something Google Cloud Storage to persist file objects too). Since Weka relies on local file manipulation, you will most likely run into issue attempting to run Weka on App Engine. You should instead run it on Google Compute Engine VMs. 

Alternatively, you can use Google Cloud Machine Learning to run and train your model with the use of TensorFlow in the cloud. 
Reply all
Reply to author
Forward
0 new messages