Prash's Blog

com.gargoylesoftware.htmlunit.ScriptException: Exception invoking jsxGet_cookie February 14, 2012

Filed under: Google App Engine — prazjain @ 2:20 pm
Tags: , ,

I was running HtmlUnit 2.9 with Google App Engine in development environment, and hit upon this exception when loading a url:

Truncated Exception is pasted below:


com.gargoylesoftware.htmlunit.ScriptException: Exception invoking jsxGet_cookie
 at com.gargoylesoftware.htmlunit.javascript.JavaScriptEngine$HtmlUnitContextAction.run(JavaScriptEngine.java:595)
 at net.sourceforge.htmlunit.corejs.javascript.Context.call(Context.java:537)
 ...
Caused by: java.lang.RuntimeException: Exception invoking jsxGet_cookie
 at net.sourceforge.htmlunit.corejs.javascript.MemberBox.invoke(MemberBox.java:198)
 ... 65 more
Caused by: java.lang.IllegalArgumentException: Invalid port: -1
 at org.apache.http.cookie.CookieOrigin.<init>(CookieOrigin.java:58)
 ... 82 more

This is due to a bug in Google App Engine and following is the workaround to fix it in htmlunit for the time being.

Workaround


webClient.setCookieManager(new CookieManager()
{
protected int getPort(final URL url)
{
final int r = super.getPort(url);
return r != -1 ? r : 80;
}
});

Advertisements
 

java.lang.VerifyError: Expecting a stackmap frame at branch target January 19, 2012

Filed under: Google App Engine,Java — prazjain @ 6:30 pm
Tags: ,

If you get this same error :


WARNING: Error for /doit
java.lang.VerifyError: Expecting a stackmap frame at branch target 27 in method com.yourpackage.YourServlet.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V at offset 11
 at java.lang.Class.getDeclaredConstructors0(Native Method)
 at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
 at java.lang.Class.getConstructor0(Class.java:2714)
 at java.lang.Class.newInstance0(Class.java:343)
 at java.lang.Class.newInstance(Class.java:325)
 at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
 at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:428)
 at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
 at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
 at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
 at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
 at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
 at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
 at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
 at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
 at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
 at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
 at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:362)
 at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
 at org.mortbay.jetty.Server.handle(Server.java:326)
 at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
 at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
 at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
 at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
 at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
 at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
 at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

&nbsp;

then you need to add an attribute -XX:UseSplitVerifier to your Default VM arguments.

On Eclipse : Windows -> Preferences -> Java -> Installed JRE’s

And selected and edit, the one that you are using, to include -XX:-UseSplitVerifier

Hope that helps