Blog do projektu Open Source JavaHotel

środa, 21 maja 2014

JavaHotel, Jython 2.7 and Google App Engine

Introduction

I decided to go ahead and upgrade Jython I'm using from Jython 2.5 (Jython 2.5.4rc1) to Jython 2.7 (Jython 2.7beta2). It works without any problem but I was stuck after deploying to Google App Engine.  The exception error was as follows:

Caused by: java.lang.ExceptionInInitializerError
 at jnr.posix.POSIXFactory.(POSIXFactory.java:15)
 at org.python.modules.posix.PosixModule.(PosixModule.java:63)
 at org.python.modules.Setup.(Setup.java:29)
 at org.python.core.PySystemState.initBuiltins(PySystemState.java:1317)
 at org.python.core.PySystemState.doInitialize(PySystemState.java:1056)
 at org.python.core.PySystemState.initialize(PySystemState.java:982)
 at org.python.core.PySystemState.initialize(PySystemState.java:938)
It was very nasty because it worked in Development Mode (local environment) and it is not easy to debug the application after deploying to the production environment.

Solution 

After spending some time, analyzing exception stack and digging through different versions jnr-posix module (used by Jython for system related stuff) especially Platform class I found the solution.  It was because Google App Engine does not set os.name property (it is null). So the solution was to enhance appengine-web.xml file.
  <system-properties>
    ......
    <property name="os.name" value="linux"/>
    <property name="os.arch" value="amd64"/>    
  </system-properties>
It works now but two questions are pending around me:
  • How it worked with Jython 2.5
  • While Google App Engine set this variables in Development Mode and does not set in Production Mode.

Brak komentarzy:

Prześlij komentarz