CKEditor fails to load

When the CKEditor is opened, a loading image is displayed, but the editor fails to appear. There are a couple of related issues:

The URL http://localhost/xwiki/webjars/wiki%3Axwiki/application-ckeditor-webjar/plugins/xwiki-resource/resourcePicker.min.css?evaluate=true returns 404 (DocumentDoesNotExist).

The command find /opt/glassfish/glassfish/domains/isd/applications/xwiki -type f | grep -i resourcepicker shows no files.

How do I reinstall CKEditor in offline mode?

Here’s what I tried:

  1. http://localhost/xwiki/bin/admin/XWiki/XWikiPreferences?editor=globaladmin&section=Import
  2. Click Choose File.
  3. Select org.xwiki.contrib_application-ckeditor-ui-1.20.xar
  4. Click Open.
  5. Click org.xwiki.contrib_application-ckeditor-ui-1.20.xar.
  6. Select Replace the page history with the history from the package.
  7. Click Import.

The import appears to have worked correctly; however, the resource picker cannot be found and the same 404 appears. If the resource picker (and similar) are archived, how do I expand the archive so that XWiki can find the files?

It should be 404 Not Found. Where did you get the “DocumentDoesNotExist” part from?

That’s normal because the requested files are inside a jar not directly on the file system.

How did you install CKEditor initially?

That’s not how it works. The XAR you imported has dependencies that need to be installed also, otherwise CKEditor obviously doesn’t work. The right way to install CKEditor is through the Extension Manager which resolves (collects) and installs all the transitive dependencies automatically for you. Of course, you need to be online. There’s no easy way to do this offline:

  • you either create a local extension repository with all the required dependencies so that the Extension Manager finds them or
  • you collect and install all the transitive dependencies by hand (without using the Extension Manager)

Either way, it’s not easy.

Thank you for the response, @mflorea. Before I answer your questions, here’s my most recent attempt to get XWiki’s WYSIWYG editor running on the machine without Internet access:

  1. Install Payara 174 on a Virtual Machine running Ubuntu Linux (having Internet).
  2. Install Java 1.8 u161.
  3. Download, install, and configure XWiki 9.11.1 with all requisite extensions on the VM.
  4. Verify that the WYSIWYG editor works inside the VM (it does).
  5. Zip /opt/payara4/glassfish/domains/domain1/applications/xwiki into xwiki.zip.
  6. Zip /var/local/xwiki into var-local-xwiki.zip.
  7. Copy the files to the firewalled server.
  8. Unzip xwiki.zip as /opt/glassfish5/glassfish/domains/domain1/applications/xwiki.
  9. Unzip var-local-xwiki.zip as /var/local/xwiki
  10. Restart the web application server.

At this point, I thought that all the files would be available and the WYSIWYG editor would be available; however, XWiki still fails to find the files it needs to run the editor.

It should be 404 Not Found. Where did you get the “DocumentDoesNotExist” part from?

The DocumentDoesNotExist appears when I try to browse to the missing resource file directly:

[2018-01-31T12:05:45.252-0800] [glassfish 5.0] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=29 _ThreadName=http://wiki.domain.com/xwiki/webjars/wiki%3Axwiki/bootstrap-tour/js/bootstrap-tour.min.js?r=1] [timeMillis: 1517429145252] [levelValue: 900] [[
  org.apache.catalina.core.StandardHostValve@5783723c: Exception Processing ErrorPage[errorCode=404, location=/bin/view/Main/DocumentDoesNotExist]
java.io.IOException: Failed to extract the Entity Action from URL [http://wiki.domain.com/xwiki/webjars/wiki%3Axwiki/bootstrap-tour/js/bootstrap-tour.min.js]

How did you install CKEditor initially?

Unfortunately, I cannot find where the instructions for installing CKEditor from a XIP were given. I believe I used a XIP file (unzipped into a specific directory) and it was @vmassol who pointed me in that direction, IIRC.

Either way, it’s not easy.

So it seems!

I’ve pasted the server log. This is from a fresh restart of the application server on the machine without Internet access:

If there are concrete, step-by-step instructions I can follow to get the CKEditor up and running (or you have any other ideas on what to try), please let me know.

Thank you.

If you installed XWIki 9.11.1 then you have CKEditor installed because CKEditor is a dependency. Your problem is not with CKEditor but with how the WebJar URLs are handled:

[2018-01-31T12:32:23.878-0800] [glassfish 5.0] [WARNING] [] [javax.enterprise.web] [tid: _ThreadID=28 _ThreadName=http://wiki.host.com/xwiki/webjars/wiki%3Axwiki/bootstrap-tour/js/bootstrap-tour.min.js?r=1] [timeMillis: 1517430743878] [levelValue: 900] [[
  org.apache.catalina.core.StandardHostValve@50f0f06e: Exception Processing ErrorPage[errorCode=404, location=/bin/view/Main/DocumentDoesNotExist]
java.io.IOException: Failed to extract the Entity Action from URL [http://wiki.host.com/xwiki/webjars/wiki%3Axwiki/bootstrap-tour/js/bootstrap-tour.min.js]
    at com.xpn.xwiki.web.XWikiRequestProcessor.processPath(XWikiRequestProcessor.java:133)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:154)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:686)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:791)
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1580)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:338)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at com.xpn.xwiki.web.ActionFilter.doFilter(ActionFilter.java:112)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:127)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:208)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:111)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:250)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:817)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:683)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:639)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:570)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:481)
    at org.apache.catalina.core.StandardHostValve.dispatchToErrorPage(StandardHostValve.java:680)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:361)
    at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:215)
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:373)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:238)
    at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:463)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:168)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:242)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:284)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:201)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:133)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:112)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:539)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:593)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:573)
    at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassCastException: org.xwiki.webjars.internal.WebJarsResourceReference cannot be cast to org.xwiki.resource.entity.EntityResourceReference
    at com.xpn.xwiki.web.XWikiRequestProcessor.processPath(XWikiRequestProcessor.java:128)
    ... 49 more
]]

WebJar URLs are treated as entity URLs and this fails because a WebJarsResourceReference cannot be casted to an EntityResourceReference. So there’s a setup problem. Could be related to short URLs configuration. You need to review all the custom XWiki configuration you did. It could also be related to the servlet container you’re using. I’m not using Glassfish.