[2.0] YAMLException: java.io.IOException: Stream closed

3,646 views
Skip to first unread message

Karthik Sankar

unread,
Mar 23, 2012, 1:47:24 PM3/23/12
to play-fr...@googlegroups.com
Recently I installed Play Framework 2.0 and trying it out. I am trying to initialize a table from yml file. I get the 'Stream closed' exception on the Yaml.load method. Can someone help? Here is the code:

public class Global extends GlobalSettings {
@Override
public void onStart(Application app){

initializeData(app);
@Transactional
public void initializeData(Application app){
Map<String,List<Object>> all =(Map<String,List<Object>>)Yaml.load(
app.resourceAsStream("conf/initial-data.yml"), 
app.classloader() 
        ); 
        Ebean.save(all.get("restaurants")); 
}
}

sveri

unread,
Apr 5, 2012, 4:04:22 PM4/5/12
to play-fr...@googlegroups.com
I have the same problem, was there a solution to this?

Regards,
Sven
Message has been deleted

Kevin Bosman

unread,
Apr 6, 2012, 11:51:33 AM4/6/12
to play-fr...@googlegroups.com
>>> Map<String,List<Object>> all =(Map<String,List<Object>>)Yaml.load(
>>> app.resourceAsStream("conf/initial-data.yml"),
>>> app.classloader()
>>>         );

Is there a reason you need to use resourceAsStream()?
This works:

Map<String, List<Object>> all = (Map<String, List<Object>>) Yaml
.load("initial-data.yml");

Reply all
Reply to author
Forward
0 new messages