Group viewer HTML (Dropwizard Java) not loading

Hi, I’m trying to run the GitHub - groupdocs-viewer/GroupDocs.Viewer-for-Java-Dropwizard: Moved to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java/tree/master/Demos/Dropwizard, it starts without problems and shows me the page in http://localhost:8080/viewer/, when I try to see any document it just shows me a spinner (loading document) but never shows the file.

Even I tried with GitHub - groupdocs-viewer/GroupDocs.Viewer-for-Java-Spring: Moved to https://github.com/groupdocs-viewer/GroupDocs.Viewer-for-Java/tree/master/Demos/Spring, in both code examples I run the code from the terminal, then tried the generated jar, even with Docker, but in all the cases the result is the same, the spinner and it does not show the file.

Thanks

@noemd

Please download or clone our updated Spring application and let us know if issue persists. Here’s the demo video.

Hi, I downloaded the application, but when I tried to run it using: mvn clean spring-boot:run

It give the error:

java.lang.IllegalStateException: Cannot load configuration class: com.groupdocs.ui.Application
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:414) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanFactory(ConfigurationClassPostProcessor.java:254) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:282) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:126) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:330) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246) ~[spring-boot-2.0.4.RELEASE.jar:2.0.4.RELEASE]
	at com.groupdocs.ui.Application.main(Application.java:34) ~[classes/:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78) ~[na:na]
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:567) ~[na:na]
	at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.java:496) ~[na:na]
	at java.base/java.lang.Thread.run(Thread.java:831) ~[na:na]
Caused by: java.lang.ExceptionInInitializerError: null
	at org.springframework.context.annotation.ConfigurationClassEnhancer.newEnhancer(ConfigurationClassEnhancer.java:122) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassEnhancer.enhance(ConfigurationClassEnhancer.java:110) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.context.annotation.ConfigurationClassPostProcessor.enhanceConfigurationClasses(ConfigurationClassPostProcessor.java:403) ~[spring-context-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	... 18 common frames omitted
Caused by: org.springframework.cglib.core.CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @235efee4
	at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:464) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:336) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:93) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:91) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[na:na]
	at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:116) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:291) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.KeyFactory$Generator.create(KeyFactory.java:221) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:174) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.core.KeyFactory.create(KeyFactory.java:153) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	at org.springframework.cglib.proxy.Enhancer.<clinit>(Enhancer.java:73) ~[spring-core-5.0.8.RELEASE.jar:5.0.8.RELEASE]
	... 21 common frames omitted

In the other spring version that error didn’t show, do I have to do another configuration?

Thanks.

groupsdocsviewer_2021-07-27_15-15-49.png (533.5 KB)

Hi, I cleared the project an did a retry, now the app does run but I have the same problem, it just shows the loading spinner.

loading_2021-07-27_17-55-47.jpg (24.3 KB)

@noemd

Could you please check if there are any errors in the Development Tools (F12) > Console?

Hi, yes there are errors:

ViewerAppComponent.html:20 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: ‘null: undefined’. Current value: ‘null: 1’.
at viewDebugError (core.js:28793)
at expressionChangedAfterItHasBeenCheckedError (core.js:28770)
at checkBindingNoChanges (core.js:29758)
at checkNoChangesNodeInline (core.js:44443)
at checkNoChangesNode (core.js:44416)
at debugCheckNoChangesNode (core.js:45377)
at debugCheckRenderNodeFn (core.js:45309)
at Object.eval [as updateRenderer] (ViewerAppComponent.html:20)
at Object.debugUpdateRenderer [as updateRenderer] (core.js:45294)
at checkNoChangesView (core.js:44251)

error_2021-07-28_09-18-41.jpg (121.8 KB)

@noemd

Thank you for sharing the error, could you please also share the file that you’re trying to open?

Hi, the file is this one:

Aspose - copia.docx (10.3 KB)

even I tried with a txt, I can not upload it here in the blog, but it only contained the String hello world, but the error in angular appears again.

I converted the file into PDF, an then I have another error:

Aspose - copia.pdf (4.2 KB)

error_PDF_2021-07-29_09-05-44.jpg (76.7 KB)

@noemd

Thank you for attaching the files. We’re trying to reproduce this issue.

Thanks, we are very interested in using groupdocs tools. Maybe we need to pay the license to have all the functionality working?

@noemd

Thank you for your interest in our products. We have partially reproduced this issue and we now can see the error in Developer Console.

It’s SPA issue and we’re investigating it at the moment. We’ll let you know in case of any updates.

Thanks Vladimir

@noemd

Please try using the latest version of the SPA. To verify that there are no issues in the developer console I’ve performed the following steps:

  1. Cloned the repository git clone git@github.com:groupdocs-viewer/GroupDocs.Viewer-for-Java.git
  2. Navigated into client folder cd ./GroupDocs.Viewer-for-Java/Demos/Dropwizard/client
  3. Updated SPA version npm update @groupdocs.examples.angular/viewer
  4. Navigated into the root folder cd ..
  5. Run the project mvn clean compile exec:java
  6. Navigated to http://localhost:8080/viewer/ in a browser

After the opening the app it worked well

In case you already have the app you can just update SPA version (Step 3) and re-run the app. Please let us know if you are still experiencing the issues with running the app after updating.

Hi, I got a temporary license, when i put it into the License folder the angular error disappeared, however, the word document (the one that I shared here) didn’t render:

license_word_error_2021-07-30_09-51-36.jpg (135.0 KB)

Then I tried with a PDF (the one that I shared here) and the java error appeared (with the license the angular error did not show again):

error_PDF_2021-07-29_09-05-44.jpg (76.7 KB)

Those cases where for the Spring Demo, then I tried with the dropwizard, I followed the steps you shared with me npm update …), when I tried to load the file I got different errors, but in the end it keeps sending just the spinner and the document can not be render.

I even checked if I have the latest version:

image.png (8.9 KB)

dorpwizard_word_error_2021-07-30_10-10-58.jpg (171.2 KB)

@noemd

Thank you for sharing the screenshots. From the last screenshot I can see that the server responded with 500 so it seems that the main issue is with the API now. Could you please check if there any errors in the terminal from which you’ve started the App. A typical output app_started.png (38.3 KB) when the service is started.

One more thing, try running the terminal as Administrator and see if the issue is gone.

Thanks for replying, when I started the app all was ok I think:

image.png (24.2 KB)

But when I try to load the files:

image.png (15.7 KB)

image.png (19.6 KB)

In the Spring Demo

image.png (596.7 KB)

When the word finally got in the cache no more errors where shown but the document did not render.

@noemd

Thanks again for the screenshots. From the second one I can see that it is locale issue

. The workaround has been provided in this topic. To change default locale to the supported one open GroupDocs.Viewer-for-Java\Demos\Dropwizard\src\main\java\com\groupdocs\ui\common\MainService.java file and replace

public MainService() {
    super();
    defaultConfiguration = false;
}

public MainService(boolean defaultConfiguration) {
    super();
    this.defaultConfiguration = defaultConfiguration;
}

with

public MainService() {
    super();
    setLocale();
    defaultConfiguration = false;
}

public MainService(boolean defaultConfiguration) {
    super();
    setLocale();
    this.defaultConfiguration = defaultConfiguration;
}

private static setLocale() {
    Locale usLocale = new Locale("en", "US");
    Locale.setDefault(usLocale);
}

And then try restarting the app with mvn clean compile exec:java.

Hi, I made the changes you told me in dropwizard, started the app without problems:

image.png (28.5 KB)

Tried to view the doc file but it took several minutes (about 10) and it didn’t render, however, I tried then with the PDF file and it finally did it thanks.

image.png (95.8 KB)

Is there a way to do the same with the Spring project and to render Word files too with both projects?

Sorry another question the Editor project should work with the same license?

Thanks a lot Vladimir, we are very interested on those two products Viewer and Editor

@noemd

You’re welcome!

Sure, you have to set the supported locale but this time in Application.java file of the Spring project and build the project.

Yes, a Total license can be used with all GroupDocs products including Viewer and Editor.