'Spire Doc Free 3.9.0 not running in headless server
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.spire.doc.packages.sprDGC
at com.spire.doc.formatting.CharacterFormat.spr (Unknown Source)
at com.spire.doc.formatting.CharacterFormat.spr (Unknown Source)
at com.spire.doc.documents.Paragraph.spr (Unknown Source)
at com.spire.doc.documents.Paragraph.spr (Unknown Source)
at com.spire.doc.documents.Paragraph.applyStyle(Unknown Source)
at com.spire.doc.documents.Paragraph.<init>(Unknown Source)
at com.spire.doc.Body.addParagraph(Unknown Source)
at com.spire.doc.Section.addParagraph(Unknown Source)
at com.qalara.customerorders.service.impl.ProformaInvoiceDocImpl.lambda$proformaInvoiceDoc$5(ProformaInvoiceDocImpl.java:250)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:118)
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1705)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
at reactor.core.publisher.Operators$ScalarSubscription.request(Operators.java:2267)
at reactor.core.publisher.MonoFlatMap$FlatMapInner.onSubscribe(MonoFlatMap.java:230)
at reactor.core.publisher.MonoJust.subscribe(MonoJust.java:54)
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:55)
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:73)
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76)
at reactor.core.publisher.MonoNext$NextSubscriber.onNext(MonoNext.java:76)
at rx.internal.reactivestreams.SingleAsPublisher$SingleAsPublisherSubscriber.onSuccess(SingleAsPublisher.java:86)
at rx.internal.operators.OnSubscribeSingle$1.onCompleted(OnSubscribeSingle.java:55)
at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onCompleted(OnSubscribeDoOnEach.java:70)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(OnSubscribeMap.java:97)
at rx.internal.operators.OnSubscribeSwitchIfEmpty$ParentSubscriber.onCompleted(OnSubscribeSwitchIfEmpty.java:82)
at rx.observers.Subscribers$5.onCompleted(Subscribers.java:225)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.onCompleted(OnSubscribeMap.java:97)
at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.onCompleted(OnSubscribeFilter.java:99)
at rx.observers.Subscribers$5.onCompleted(Subscribers.java:225)
at rx.internal.operators.OnSubscribeDoOnEach$DoOnEachSubscriber.onCompleted(OnSubscribeDoOnEach.java:70)
at rx.internal.producers.SingleProducer.request(SingleProducer.java:75)
at rx.internal.producers.ProducerArbiter.setProducer(ProducerArbiter.java:126)
at rx.internal.operators.OnSubscribeSwitchIfEmpty$ParentSubscriber.setProducer(OnSubscribeSwitchIfEmpty.java:76)
at rx.Subscriber.setProducer(Subscriber.java:205)
at rx.internal.operators.OnSubscribeMap$MapSubscriber.setProducer(OnSubscribeMap.java:102)
at rx.internal.operators.OnSubscribeFilter$FilterSubscriber.setProducer(OnSubscribeFilter.java:104)
at rx.Subscriber.setProducer(Subscriber.java:205)
at rx.Subscriber.setProducer(Subscriber.java:205)
at rx.subjects.AsyncSubject.onCompleted(AsyncSubject.java:103)
at com.couchbase.client.core.endpoint.AbstractGenericHandler.completeResponse(AbstractGenericHandler.java:508)
at com.couchbase.client.core.endpoint.AbstractGenericHandler.access$000(AbstractGenericHandler.java:86)
at com.couchbase.client.core.endpoint.AbstractGenericHandler$1.call(AbstractGenericHandler.java:526)
at org.springframework.cloud.sleuth.instrument.rxjava.SleuthRxJavaSchedulersHook$TraceAction.call(SleuthRxJavaSchedulersHook.java:149)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
... 7 more
Section section = document.addSection();
Paragraph para1 = section.addParagraph();
para1.appendText("Proforma Invioce");
There error is caused at this line "Paragraph para1 = section.addParagraph();"
Code is written in spring boot . In local its working fine.
Why am I getting this error when I deploy the code to the server ?
Solution 1:[1]
Tested below with e-iceblue:spire.pdf.free:4.4.1
and e-iceblue:spire.pdf.free:5.1.0
Issues we had
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.spire.doc.packages...
com.spire.ms.System.Exception: No 'Arial' font found!
Although we did not figure out what the core reason is we figured it out how to get things working.
change | impact |
---|---|
Used JDK instead of JRE | fixed classloading issues (your issue outlined above did not appear) |
Used debian instead of alpine (as base) | unknown |
Installed msttcorefonts | no missing Arial issue |
Knowing that this is not a lightweCaused by: java.lang.NoClassDefFoundError: Could not initialize class com.spire.doc.packages... com.spire.ms.System.Exception: No 'Arial' font found!ight docker image anymore, but it works we used the following Dockerfile.
FROM openjdk:11-jdk
RUN echo "update packages" && apt update && \
echo "install ms fonts" && \
sed -i'.bak' 's/$/ contrib/' /etc/apt/sources.list && \
apt update && \
apt install -y ttf-mscorefonts-installer fontconfig && \
fc-cache -f -v
// add other application files
I hope it helps, good luck
m
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |