Serviio on headless Linux
Hi,
I'm trying to run Serviio on a headless Linux server box. For some reason, even though the serviio startup script explicitly sets java.awt.headless=true, it tries to access the java.awt.AppContext and java.awt.SunToolkit all the time, which fails miserably:
As a result, it's impossible to do pretty much anything with the server.
The interesting thing is that with the same JRE on the same machine, test code executing the same calls runs just fine (e.g. new GregorianCalendar() or even SharedSecrets.getJavaAWTAccess(), which just returns null).
This is on an Arch Linux, running jre7-openjdk 7.u40_2.4.2-1
Edit: The offending AppContext gets initialized by this call:
I'm trying to run Serviio on a headless Linux server box. For some reason, even though the serviio startup script explicitly sets java.awt.headless=true, it tries to access the java.awt.AppContext and java.awt.SunToolkit all the time, which fails miserably:
- Code:
Exception in thread "LibraryAdditionsCheckerThread" java.lang.NoClassDefFoundError: Could not initialize class sun.awt.SunToolkit
at sun.awt.AppContext$2.run(AppContext.java:271)
at sun.awt.AppContext$2.run(AppContext.java:260)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.AppContext.initMainAppContext(AppContext.java:260)
at sun.awt.AppContext.access$200(AppContext.java:133)
at sun.awt.AppContext$3.run(AppContext.java:314)
at sun.awt.AppContext$3.run(AppContext.java:298)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.AppContext.getAppContext(AppContext.java:297)
at sun.awt.AppContext$6.getContext(AppContext.java:841)
at sun.misc.SharedSecrets.getJavaAWTAccess(SharedSecrets.java:201)
at java.util.TimeZone.getDefaultInAppContext(TimeZone.java:730)
at java.util.TimeZone.getDefaultRef(TimeZone.java:620)
at java.util.GregorianCalendar.<init>(GregorianCalendar.java:586)
at org.apache.derby.iapi.types.SQLTimestamp.setNumericTimestamp(Unknown Source)
at org.apache.derby.iapi.types.SQLTimestamp.setValue(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setTimestamp(Unknown Source)
at org.apache.derby.impl.jdbc.EmbedPreparedStatement.setTimestamp(Unknown Source)
at org.serviio.util.JdbcUtils.setTimestampValueOnStatement(JdbcUtils.java:239)
at org.serviio.library.dao.ImageDAOImpl.create(ImageDAOImpl.java:69)
at org.serviio.library.dao.ImageDAOImpl.create(ImageDAOImpl.java:37)
at org.serviio.library.local.service.ImageService.addImageToLibrary(ImageService.java:79)
at org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.addNewMediaFile(LibraryAdditionsCheckerThread.java:191)
at org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.searchForNewFiles(LibraryAdditionsCheckerThread.java:145)
at org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.searchForNewFiles(LibraryAdditionsCheckerThread.java:134)
at org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.searchForNewFiles(LibraryAdditionsCheckerThread.java:134)
at org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.run(LibraryAdditionsCheckerThread.java:83)
As a result, it's impossible to do pretty much anything with the server.
The interesting thing is that with the same JRE on the same machine, test code executing the same calls runs just fine (e.g. new GregorianCalendar() or even SharedSecrets.getJavaAWTAccess(), which just returns null).
This is on an Arch Linux, running jre7-openjdk 7.u40_2.4.2-1
Edit: The offending AppContext gets initialized by this call:
- Code:
Daemon Thread [LibraryAdditionsCheckerThread] (Suspended (entry into method setJavaAWTAccess in sun.misc.SharedSecrets))
sun.misc.SharedSecrets.setJavaAWTAccess(sun.misc.JavaAWTAccess) line: 195
sun.awt.AppContext.<clinit>() line: 816
javax.imageio.spi.IIORegistry.getDefaultInstance() line: 154
javax.imageio.ImageIO.<clinit>() line: 65
org.serviio.util.ImageUtils.resizeImageAsJPG(byte[], int, int) line: 61
org.serviio.util.ImageUtils.resizeImageAsJPG(java.io.File, int, int) line: 109
org.serviio.library.local.service.ImageService.createThumbnail(org.serviio.library.local.metadata.ImageMetadata) line: 312
org.serviio.library.local.service.ImageService.addImageToLibrary(org.serviio.library.local.metadata.ImageMetadata, org.serviio.library.entities.Repository) line: 64
org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.addNewMediaFile(org.serviio.library.entities.Repository, java.io.File, org.serviio.library.metadata.MediaFileType) line: 191
org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.searchForNewFiles(java.io.File, org.serviio.library.entities.Repository) line: 145
org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.searchForNewFiles(java.io.File, org.serviio.library.entities.Repository) line: 134
org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.searchForNewFiles(java.io.File, org.serviio.library.entities.Repository) line: 134
org.serviio.library.local.metadata.LibraryAdditionsCheckerThread.run() line: 83