Trolltech Home | Qt-jambi-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-jambi-interest Archive, November 2007
OS X JavaApplicationStub running issues


Message 1 in thread

My application crashes when trying to run it from a .app with OS X's
JavaApplicationStub (I use the JarBundler ANT task but get the same effect
when packaging with the Jar Bundler application that Apple supplies in
/Developer/Applications/Java Tools...). I packed jambi.jar, its native
libraries and all my other dependent libraries into a single jar package
which I then supply to this JarBundler ant task.

The ant build.xml snippet I use is here:
    <target name="unpacklib" depends="compile">
        <mkdir dir="${unpacklib}"/>
        <unjar dest="${unpacklib}"><fileset dir="${lib}"><filename
name="*.jar"/></fileset></unjar>
        <copy todir="${unpacklib}/"><fileset
dir="${env.QTJAMBI_PATH}/lib"><filename
name="**"/></fileset></copy>
        <copy todir="${unpacklib}"><fileset dir="${ env.NMICA_HOME}"><filename
name="*.jnilib"/></fileset></copy>
        <delete dir="${unpacklib}/META-INF" />
    </target>

    <target name="jambijar">
        <jar jarfile="${dist}/lib/${name.main}_withlibs.jar"
basedir="${unpacklib}" manifest="${manifest.file.main}" compress="false">
            <fileset dir="${resources}"/>
            <fileset dir="${unpacklib}" />
        </jar>
    </target>

    <target name="jambiapp">
        <mkdir dir="${dist}/app"/>

        <jarbundler dir="${dist}/app"
            name="mXplor"
            mainclass="uk.ac.sanger.motifxplorer.app.MXplor"
            jar="${dist}/lib/${name.main }_withlibs.jar"
            icon="images/icon.icns"
            vmoptions="-XstartOnFirstThread"
            jvmversion="1.6+">
            <documenttype name="XMS motif set"
                    extensions="xms"
                    role="Editor"/>
        </jarbundler>

        <mkdir dir="${dist}/app"/>

    </target>

The interesting thing is it works just fine when I call it in the usual way
( java -XstartOnFirstThread -jar mxplor_withlibs.jar ) but gives this error
message when I put the same -XstartOnFirstThread in vmoptions which should
get rid of this specific crash (and indeed if I don't include it when
running with java -jar I get that same crash)! If I don't include it in the
Info.plist when launching the .app the application sometimes opens up for a
bit and even works works normally, and then crashes with a different error
msg (I've attached that below too). I assume this is an issue that has to do
with JavaApplicationStub and QT? Any ideas?

With -XstartOnFirstThread in VMOptions:
===== Tuesday, 27 November 2007 13:26:45 Europe/London =====
Starting mXplor...
Invalid memory access of location 00000000 eip=9fe16387
#
# An unexpected Java error has been detected by HotSpot Virtual Machine.
#
# If this error is reproducible, please report it with the following
information:
#   1. Provide the steps to reproduce, a test case, and any relevant
information
#   2. The corresponding JavaNativeCrash_pid<num>.crash.log (Java state)
#   3. The corresponding <name>.crash.log (native state; generated by
CrashReporter)
#   4. This data:
#
# Java VM: Java HotSpot(TM) Client VM (1.6.0-b88-17-release mixed mode,
sharing)
# An unexpected error has been detected by Java Runtime Environment:
#
#  Bus Error (0xa) at pc=0x9fe16387, pid=1018, tid=25190912
# An error report file with more information is saved as
/Users/mz2/Library/Logs/Java/JavaNativeCrash_pid1018.crash.log
#
#
# File report at: http://bugreport.apple.com/
#
QWidget::repaint: Recursive repaint detected
QWidget: It is dangerous to leave painters active on a widget outside of the
PaintEvent
Nov 27 13:27:04 stinky crashdump[1020]: JavaApplicationStub crashed
Nov 27 13:27:04 stinky crashdump[1020]: crash report written to:
/Users/mz2/Library/Logs/CrashReporter/JavaApplicationStub.crash.log





Without -XstartOnFirstThread in VMOptions:
Invalid memory access of location 00000005 eip=90336c2e
#
# An unexpected Java error has been detected by HotSpot Virtual Machine.
#
# If this error is reproducible, please report it with the following
information:
#   1. Provide the steps to reproduce, a test case, and any relevant
information
#   2. The corresponding JavaNativeCrash_pid<num>.crash.log (Java state)
#   3. The corresponding <name>.crash.log (native state; generated by
CrashReporter)
#   4. This data:
#
# Java VM: Java HotSpot(TM) Client VM ( 1.6.0-b88-17-release mixed mode,
sharing)
# An unexpected error has been detected by Java Runtime Environment:
#
#  Bus Error (0xa) at pc=0x90336c2e, pid=1068, tid=25190912
# An error report file with more information is saved as
/Users/mz2/Library/Logs/Java/JavaNativeCrash_pid1068.crash.log
#
#
# File report at: http://bugreport.apple.com/
#
Nov 27 13:51:03 stinky crashdump[1069]: Exited process crashed
Nov 27 13:51:04 stinky crashdump[1069]: crash report written to:
/Library/Logs/CrashReporter/Exited process.crash.log


The Info.plist for my app is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
                       "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">
  <dict>
    <key>CFBundleName</key>
    <string>mXplor</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>CFBundleGetInfoString</key>
    <string>1.0</string>
    <key>CFBundleAllowMixedLocalizations</key>
    <string>false</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>6.0</string>
    <key>CFBundleExecutable</key>
    <string>JavaApplicationStub</string>
    <key>CFBundleDevelopmentRegion</key>
    <string>English</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleIconFile</key>
    <string>icon.icns</string>
    <key>CFBundleDocumentTypes</key>
    <array>
      <dict>
        <key>CFBundleTypeName</key>
        <string>XMS motif set</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleTypeExtensions</key>
        <array>
          <string>xms</string>
        </array>
      </dict>
    </array>
    <key>Java</key>
    <dict>
      <key>MainClass</key>
      <string>uk.ac.sanger.motifxplorer.app.MXplor</string>
      <key>JVMVersion</key>
      <string>1.6+</string>
      <key>ClassPath</key>
      <array>
        <string>$JAVAROOT/mxplor_withlibs.jar</string>
      </array>
      <key>VMOptions</key>
      <string>-XstartOnFirstThread</string>
    </dict>
  </dict>
</plist>

Message 2 in thread

Matias Piipari wrote:
> My application crashes when trying to run it from a .app with OS X's
> JavaApplicationStub (I use the JarBundler ANT task but get the same effect
> when packaging with the Jar Bundler application that Apple supplies in
> /Developer/Applications/Java Tools...). I packed jambi.jar, its native
> libraries and all my other dependent libraries into a single jar package
> which I then supply to this JarBundler ant task.

I was so happy to see it running, that I didn't let it run long enough 
to crash. With a little bit of effort (e.g. waiting for 10 seconds), 
mine crashes too.

>       <key>VMOptions</key>
>       <string>-XstartOnFirstThread</string>
> 

It turns out that the "-XstartOnFirstThread" VM option is not supported 
by the JavaApplicationStub, the application that goes into 
bundle/Contents/MacOS and is used to launch java apps ;-(

If you instead use:

       <key>StartOnMainThread</key>
       <true/>

I then launches fine.

best regards,
Gunnar