Hi Romain,
Do you know any trick to use that classloader? The only one I know is the
"Thread" trick...

thread.setContextClassLoader(appContext.getClassLoader());
thread.start();

Do you think it is fine to use that?

[]s,
Thiago.



On Fri, Jun 29, 2012 at 7:48 AM, Romain Manni-Bucau
<[email protected]>wrote:

> Hi Thiago,
>
> look the beanmanager helper, it takes an app id to find it and use its
> classloader.
>
> So typically we need to add the list of deployed app in the gui and select
> one of them to run the script.
>
> - Romain
>
>
> 2012/6/29 Thiago Veronezi <[email protected]>
>
> > Guys,
> > I am trying to run the following code from the Console panel.
> >
> >
> > //
> >
> >
> *************************************************************************************************************
> > var myImports = new JavaImporter(
> >    java.util.Properties,
> >    javax.naming.InitialContext,
> >    org.superbiz.moviefun.Movie
> >
> > );
> >
> > with (myImports) {
> >    var p = new Properties();
> >    p.put("java.naming.factory.initial",
> > "org.apache.openejb.client.LocalInitialContextFactory");
> >
> >    var ctx = new InitialContext(p);
> >    var myBean = ctx.lookup("MoviesRemote");
> >
> >    util.save('result', myBean.count());
> >
> >    var movie = new Movie();
> >    movie.setDirector('myDirector');
> >    movie.setTitle('myTitle');
> >    movie.setTitle('myTitle');
> >    movie.setYear(2012);
> >    movie.setGenre('action');
> >    movie.setRating(10);
> >
> >    myBean.addMovie(movie);
> >    var movies = myBean.getMovies();
> >
> >    var current = null;
> >    for (var i = 0; i < movies.size(); i++) {
> >        current = movies.get(i);
> >        util.save('movieId' + current.getId(), current.getTitle());
> >    }
> > }
> > //
> >
> >
> *************************************************************************************************************
> >
> > The thing is that when I call the "ScriptEngine.eval(script,
> > executionContext)" (-> OpenEJBScripter, line 76) to run the script, the
> > classloader does not contain the Movie class. Do you know how could I set
> > the proper classloader to execute that call?
> >
> > []s,
> > Thiago.
> >
>

Reply via email to