we'll add a flag to switch it off but there is no issue on our side. You can solve it: 1) not using a new thread 2) using an EJB to execute the js
Romain Manni-Bucau @rmannibucau http://www.tomitribe.com http://rmannibucau.wordpress.com https://github.com/rmannibucau 2014-11-26 17:34 GMT+01:00 Alex A <[email protected]>: > So? it worked in 1.5.2 and does not work anymore in 1.7.1.Even before > starting the new thread the classloader is already this new > CxfContainerClassLoader (see server trace) which seems unable to load > CloudUtils from same webapp. > thank you > > > >> From: [email protected] >> Date: Wed, 26 Nov 2014 14:23:00 +0100 >> Subject: Re: TomEE+ 1.7.1 Classloader gets replaced by >> CxfContainerClassLoader which causes ClassNotFoundException in Rhino/Nashorn >> ScriptEngine >> To: [email protected] >> >> Hi >> >> com.mycompany.bl.MyInstance#executeJavaScript starts a new thread and >> then look the classloader which is bound to the request thread >> >> >> Romain Manni-Bucau >> @rmannibucau >> http://www.tomitribe.com >> http://rmannibucau.wordpress.com >> https://github.com/rmannibucau >> >> >> 2014-11-26 13:27 GMT+01:00 Alex A <[email protected]>: >> > Bonjour Romain, >> > >> > Many thanks for your reply. >> > We have been able to shrink down our app into the attached sample.zip and >> > it >> > does reproduce the issue! >> > The sample comprises a JAX-WS client and a webapp implementing the WS and >> > evaluating the input script. >> > >> > >> > TomEE+ 1.7.1: >> > >> > >> > >> > *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- >> > >> > *-*-*- ExecuteJavaScript Issue *-*-* >> > >> > *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- >> > >> > Connecting to WebServices at >> > http://localhost:8080/WebServiceProject/MyWebServiceWS >> > >> > >> > >> > *- Main menu -* >> > >> > 1. ExecuteJavaScript >> > >> > 2. Exit >> > >> > Your choice [Exit]? 1 >> > >> > >> > >> > ExecuteJavaScript: >> > >> >> Entering console mode. Type in your script, then "run" to finish typing. >> > >> > com.mycompany.cloudutils.CloudUtils.nowStr() >> > >> > run >> > >> > >> > >> > ScriptException around line [ com.mycompany.cloudutils.CloudUtils.nowStr() >> > ] >> > >> >>>> sun.org.mozilla.javascript.internal.EcmaError: TypeError: Cannot call >> >>>> property nowStr in object [JavaPackage >> >>>> com.mycompany.cloudutils.CloudUtils]. >> >>>> It is not a function, it is "object". (<Unknown source>#1) in <Unknown >> >>>> source> at line number 1 >> > >> > >> > >> > >> > SERVER TRACE (showing the classloader is indeed CxfContainerClassLoader as >> > soon as we enter the @WebMethod): >> > >> > CLASSLOADER_FROMSTART: >> > org.apache.openejb.server.cxf.transport.util.CxfContainerClassLoader@7bb42c30 >> > // when WS is called >> > >> > CLASSLOADER_EXECUTION: >> > org.apache.openejb.server.cxf.transport.util.CxfContainerClassLoader@7bb42c30 >> > // at javascript execution >> > >> > >> > >> > >> > >> > >> > >> > TomEE+ 1.5.2: >> > >> > >> > >> > *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- >> > >> > *-*-*- ExecuteJavaScript Issue *-*-* >> > >> > *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*- >> > >> > Connecting to WebServices at >> > http://localhost:8080/WebServiceProject/MyWebServiceWS >> > >> > >> > >> > *- Main menu -* >> > >> > 1. ExecuteJavaScript >> > >> > 2. Exit >> > >> > Your choice [Exit]? 1 >> > >> > >> > >> > ExecuteJavaScript: >> > >> >> Entering console mode. Type in your script, then "run" to finish typing. >> > >> > com.mycompany.cloudutils.CloudUtils.nowStr() >> > >> > run >> > >> > >> > >> > 2014/11/26 12:24:48.332 +0100 >> > >> > >> > >> > >> > >> > SERVER TRACE (showing we keep the StandardClassLoader all along): >> > >> > CLASSLOADER_FROMSTART: LazyStopWebappClassLoader >> > >> > context: /WebServiceProject >> > >> > delegate: false >> > >> > repositories: >> > >> > /WEB-INF/classes/ >> > >> > ----------> Parent Classloader: >> > >> > org.apache.catalina.loader.StandardClassLoader@771c7eb2 >> > >> > >> > >> > CLASSLOADER_EXECUTION: LazyStopWebappClassLoader >> > >> > context: /WebServiceProject >> > >> > delegate: false >> > >> > repositories: >> > >> > /WEB-INF/classes/ >> > >> > ----------> Parent Classloader: >> > >> > org.apache.catalina.loader.StandardClassLoader@771c7eb2 >> > >> > >> > >> > >> > >> > Thank you for your precious help >> > >> > Alexandre >> > >> > >> > >
