5

I am developing a Spring application which uses Spring Data. We are working in Eclipse Luna (4.4.0) and are using Java 8 update 20 (same problem occurs in higher versions).

When starting the application from Eclipse under Windows it works fine. Under Mac OS X the following error occurs:

2015-04-22 14:26:27.492  INFO 5363 --- [           main] o.s.j.d.DriverManagerDataSource          : Loaded JDBC driver: com.mysql.jdbc.Driver
2015-04-22 14:26:27.590  INFO 5363 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'jpaPersistenceUnit'
2015-04-22 14:26:28.715  INFO 5363 --- [           main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'jpaPersistenceUnit'
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fff890330dd, pid=5363, tid=30215
#
# JRE version: Java(TM) SE Runtime Environment (8.0_20-b26) (build 1.8.0_20-b26)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.20-b23 mixed mode bsd-amd64 compressed oops)
# Problematic frame:
# C  [libobjc.A.dylib+0x10dd]  objc_msgSend+0x1d

As you can see the error occurs when initializing the database connection to mysql. That database is running.

Any general ideas how to fix this? I know it is a stretch to ask it like this, but please let me know if more information could help. Maybe there are well known situations in which this can occur.

UPDATE:

contents of error log:

Pastebin: hs_err_pid5336.log

titusn
  • 1,201
  • 1
  • 12
  • 43

2 Answers2

1

Seems related to some graphics stuff on the Mac if you check the native stack trace in the hs_err file. This question: How to disable or bypass Hardware Graphics Acceleration(Prism) in JavaFX describes the same crash. The advice there is to run the jvm with -Dprism.order=j2d or -Dprism.order=sw. Try it!

Community
  • 1
  • 1
K Erlandsson
  • 13,408
  • 6
  • 51
  • 67
  • It was related to javaFX as you can see in the answer above, but it turned out we had a different problem. – titusn Apr 30 '15 at 08:28
1

I had this exact problem occur when trying to embed a library with a JavaFX dependency in a headless environment. Initially I had built a JavaFX boot wrapper using a Swing container. This setup caused the JVM to crash with the mentioned crash dump.

I found this solution: https://stackoverflow.com/a/25969138/2633009. The idea is to remove the Swing wrapper and launch the JavaFX environment using the following code:

import javafx.application.Application;
import javafx.stage.Stage;

public class JavaFXInitializer extends Application {

    private static Object barrier = new Object();

    @Override
    public void start(final Stage primaryStage) throws Exception {
        synchronized (barrier) {
            barrier.notify();
        }
    }

    public static void initialize() throws InterruptedException {
        Thread t = new Thread("JavaFX Init Thread") {
            @Override
            public void run() {
                Application.launch(JavaFXInitializer.class, new String[0]);
            }
        };
        t.setDaemon(true);
        t.start();
        synchronized (barrier) {
            barrier.wait();
        }
    }
}

Which is then called in the main application at boot time using:

try {
    JavaFXInitializer.initialize();
} catch (InterruptedException e) {
    // Failed to initialise JavaFX
    e.printStackTrace();
}

My Spring application now runs smooth on both OSX and Windows.

Community
  • 1
  • 1
Stern
  • 130
  • 1
  • 8