Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for information: Fontconfig head is null, check your fonts or fonts configuration #101

Closed
argenstijn opened this issue Mar 14, 2024 · 5 comments

Comments

@argenstijn
Copy link

argenstijn commented Mar 14, 2024

Do you happen what i can do to fix this issue below?

exception": {
"refId": 1,
"exceptionType": "java.lang.RuntimeException",
"message": "Fontconfig head is null, check your fonts or fonts configuration",
"frames": [
{
"class": "sun.awt.FontConfiguration",
"method": "getVersion",
"line": 1263
},
{
"class": "sun.awt.FontConfiguration",
"method": "readFontConfigFile",
"line": 221
},
{
"class": "sun.awt.FontConfiguration",
"method": "init",
"line": 105
},
{
"class": "sun.awt.X11FontManager",
"method": "createFontConfiguration",
"line": 696
},
{
"class": "sun.font.SunFontManager$2",
"method": "run",
"line": 352
},
{
"class": "sun.font.SunFontManager$2",
"method": "run",
"line": 309
},
{
"class": "java.security.AccessController",
"method": "executePrivileged",
"line": 129
},
{
"class": "java.security.AccessController",
"method": "doPrivileged",
"line": 319
},
{
"class": "sun.font.SunFontManager",
"method": "",
"line": 309
},
{
"class": "sun.awt.FcFontManager",
"method": "",
"line": 35
},
{
"class": "sun.awt.X11FontManager",
"method": "",
"line": 55
},
{
"class": "sun.font.PlatformFontInfo",
"method": "createFontManager",
"line": 37
},
{
"class": "sun.font.FontManagerFactory",
"method": "getInstance",
"line": 51
},
{
"class": "java.awt.Font",
"method": "getFont2D",
"line": 526
},
{
"class": "java.awt.Font",
"method": "canDisplayUpTo",
"line": 2278
},
{
"class": "java.awt.font.TextLayout",
"method": "singleFont",
"line": 469
},
{
"class": "java.awt.font.TextLayout",
"method": "",
"line": 530
},
{
"class": "org.apache.poi.ss.util.SheetUtil",
"method": "getDefaultCharWidthAsFloat",
"line": 352
},
{
"class": "org.apache.poi.ss.util.SheetUtil",
"method": "getColumnWidth",
"line": 310
},
{
"class": "org.apache.poi.ss.util.SheetUtil",
"method": "getColumnWidth",
"line": 294
},
{
"class": "org.apache.poi.xssf.usermodel.XSSFSheet",
"method": "autoSizeColumn",
"line": 497
},
{
"class": "org.apache.poi.xssf.usermodel.XSSFSheet",
"method": "autoSizeColumn",
"line": 479
},
{
"class": "com.nn.aav.insurance.business.reporting.control.ExcelSupport",
"method": "createExcelColumns",
"line": 91
},
{
"class": "com.nn.aav.insurance.business.reporting.control.ExcelSupport",
"method": "csvToExcelReport",
"line": 60
},
{
"class": "com.nn.aav.insurance.business.reporting.control.IndependerReportRepository",
"method": "createReportForSource",
"line": 85
},
{
"class": "com.nn.aav.insurance.business.reporting.control.IndependerReportRepository",
"method": "createReportForSourceIfNotComplete",
"line": 73
},
{
"class": "com.nn.aav.insurance.business.reporting.boundary.IndependerInsuranceRequestResultReporter",
"method": "lambda$handleRequest$0",
"line": 35
},
{
"class": "java.lang.Iterable",
"method": "forEach",
"line": 75
},
{
"class": "com.nn.aav.insurance.business.reporting.boundary.IndependerInsuranceRequestResultReporter",
"method": "handleRequest",
"line": 32
},
{
"class": "com.nn.aav.insurance.business.reporting.boundary.IndependerInsuranceRequestResultReporter",
"method": "handleRequest",
"line": 17
},
{
"class": "io.quarkus.amazon.lambda.runtime.AmazonLambdaRecorder$1",
"method": "processRequest",
"line": 167
},
{
"class": "io.quarkus.amazon.lambda.runtime.AbstractLambdaPollLoop$1",
"method": "run",
"line": 142
},
{
"class": "java.lang.Thread",
"method": "runWith",
"line": 1596
},
{
"class": "java.lang.Thread",
"method": "run",
"line": 1583
},
{
"class": "com.oracle.svm.core.thread.PlatformThreads",
"method": "threadStartRoutine",
"line": 833
},
{
"class": "com.oracle.svm.core.posix.thread.PosixPlatformThreads",
"method": "pthreadStartRoutine",
"line": 211
}
]
}
}

This in a native quarkus application using version 3.8.2. It's running in AWS as lambda using the latest runtime. I am using Java 21!. I think the latest runtime in AWS does not support fonts anymore.

I will try to set system prop: org.apache.poi.ss.ignoreMissingFontSystem

If this prop works can this also be added as configuration option for quarkus-poi?

@argenstijn
Copy link
Author

It works in Amazon linux 2 but not when you use Amazone Linix 2023 as lambda provider

@argenstijn
Copy link
Author

Setting org.apache.poi.ss.ignoreMissingFontSystem does not work in my situation!

@argenstijn
Copy link
Author

Interesting:

Quarkus or quarkus-awt is now throwing a RuntimeException. But in the code of apache

@Internal
    public static float getDefaultCharWidthAsFloat(final Workbook wb) {
        Font defaultFont = wb.getFontAt( 0);

        AttributedString str = new AttributedString(String.valueOf(defaultChar));
        copyAttributes(defaultFont, str, 0, 1);
        try {
            TextLayout layout = new TextLayout(str.getIterator(), fontRenderContext);
            return layout.getAdvance();
        } catch (Throwable t) {
            // ignore exception and return a default char width if
            // the ignore-feature is enabled and the exception indicates that
            // the underlying font system is not available
            if (ignoreMissingFontSystem && (
                    // the three types of exception usually indicate here that the font
                    // system is not fully installed, i.e. system libraries missing or
                    // some JDK classes cannot be loaded
                    t instanceof UnsatisfiedLinkError ||
                    t instanceof NoClassDefFoundError ||
                    t instanceof InternalError  ||
                    // other fatal exceptions will always be rethrown
                    !ExceptionUtil.isFatal(t))) {
                return DEFAULT_CHAR_WIDTH;
            }

            throw t;
        }
    }

So the property does not work because awt/quarkus throws a runtime exception. Do you also agree with this?

@melloware
Copy link
Contributor

See #95

Quarkus Issue: quarkusio/quarkus#38412

@melloware
Copy link
Contributor

I updated the Native build instructions for how to include .so files in the native build. Will close for now.

@melloware melloware closed this as not planned Won't fix, can't repro, duplicate, stale Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants