Troubleshooting CKFinder

This website contains links to software which is either no longer maintained or will be supported only until the end of 2019 (CKFinder 2). For the latest documentation about current CKSource projects, including software like CKEditor 4/CKEditor 5, CKFinder 3, Cloud Services, Letters, Accessibility Checker, please visit the new documentation website.

If you look for an information about very old versions of CKEditor, FCKeditor and CKFinder check also the CKEditor forum, which was closed in 2015. If not, please head to StackOverflow for support.

(Article contents added)
 
(Flash Upload Problem: - converted to a template)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#CUSTOMTITLE:Debugging CKFinder}}
+
__TOC__
 +
{{#CUSTOMTITLE:Troubleshooting CKFinder}}
 +
This article describes some measures that can be taken in case of problems with the CKFinder for Java application.
 +
 
 +
== Debugging CKFinder ==
 
CKFinder for Java contains a special debugging mode that makes it easier to troubleshoot the application. This mode can be turned on in the <code>WEB-INF/web.xml</code> file, by setting a new <code><init-param>debug</init-param></code> node to <code>true</code>.
 
CKFinder for Java contains a special debugging mode that makes it easier to troubleshoot the application. This mode can be turned on in the <code>WEB-INF/web.xml</code> file, by setting a new <code><init-param>debug</init-param></code> node to <code>true</code>.
  
Line 23: Line 27:
  
 
<note>The debugging mode should not be turned on by default on a production server and should only be used to diagnose a problem when CKFinder does not work as expected.</note>
 
<note>The debugging mode should not be turned on by default on a production server and should only be used to diagnose a problem when CKFinder does not work as expected.</note>
 +
 +
 +
== Empty Error Messages ==
 +
Under some circumstances right after installing CKFinder you may get errors about incorrect configuration of the application. In rare cases (usually because of your custom web application settings) it may happen that you will not see any message text either in the dialog window or in your log files.
 +
 +
[[Image: CKFinder_Java_empty_error.png|frame|center|An empty CKFinder error message window]]
 +
 +
 +
Here is what you can do to fix it:
 +
 +
# '''Clear Tomcat log files'''. This step is not obligatory, but if you do not want to go through hundreds of log files that you probably have in your Tomcat, you can clear them. In this way it will be easier for you to find an exception you are interested in.
 +
# '''Deploy''' the <code>CKFinderJava-''x.y''.war</code> file (<code>''x.y''</code> is the version number) on your Apache Tomcat server.
 +
# '''Turn on debugging''' mode in the <code>CKFinderJava</code> application. In order to achieve this, go to the <code>WEB-INF/web.xml</code> file and set the <code><init-param>debug</init-param></code> node to <code>true</code>. See the [[CKFinder_2.x/Developers_Guide/Java/Troubleshooting#Debugging_CKFinder|section above]] for a more detailed description of the debugging mode.
 +
# '''Start and stop your Apache Tomcat server'''. This will create a <code>CKFinderJava</code> '''context file''' which represents a web application that is run within a particular virtual host. You can find more information about application context here: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html.
 +
# If you are using a default Apache Tomcat configuration, your virtual host is <code>localhost</code> and your application context should be placed under <code>{''CATALINA_HOME''}/conf/Catalina/localhost</code>. The context file has the same name as your application and has an <code>.xml</code> extension. In our default case it will be <code>CKFinderJava-''x.y''.xml</code>.
 +
# '''Open the context file''', find the <code>Context</code> node and add the <code>swallowOutput</code> attribute with its value set to <code>true</code>. The node should look like this: <code><Context antiJARLocking="true" path="/CKFinderJava" swallowOutput="true" />.</code> This attribute will redirect all errors to the web application logger.
 +
# Now '''start your application''' again and repeat the steps to return an error. A detailed stacktrace should be visible in the CKFinder dialog window as well as in Tomcat log files.
 +
 +
[[Image: CKFinder_Java_nonempty_error.png|frame|center|An empty CKFinder error message window]]
 +
 +
 +
==Flash Upload Problem==
 +
 +
{{Template:Flash Upload Problem}}
 +
 +
To workaround this problem we have created <code>FileUploadFilter</code> which  retrieves appropriate cookies on server side. So if you are using flash upload component together with session scope variables to identify your user, make sure this Filter is included in your application config file. Also note that its mapping should be set to the same url pattern as for <code>ConnectorServlet</code>.
 +
 +
To use the filter you have to declare it in <code>web.xml</code> file for your application. For more details on configuration please refer to Integration, [[http://docs.cksource.com/CKFinder_2.x/Developers_Guide/Java/Integration#File_Upload_Filter File Upload Filter]] section.
 +
 +
== Support and Help ==
 +
If you encounter other issues with CKFinder for Java, you can find support on the [http://cksource.com/forums community forum]. Use the [http://cksource.com/contact contact form] from our website to send your questions and comments.

Latest revision as of 19:48, 13 September 2011

This article describes some measures that can be taken in case of problems with the CKFinder for Java application.

Debugging CKFinder

CKFinder for Java contains a special debugging mode that makes it easier to troubleshoot the application. This mode can be turned on in the WEB-INF/web.xml file, by setting a new <init-param>debug</init-param> node to true.

<servlet>
	<servlet-name>ConnectorServlet</servlet-name>
	<servlet-class>com.ckfinder.connector.ConnectorServlet</servlet-class>
	<init-param>
		<param-name>XMLConfig</param-name>
		<param-value>/WEB-INF/config.xml</param-value>
	</init-param>
	<init-param>
		<param-name>debug</param-name>
		<param-value>true</param-value>
	</init-param>
	<load-on-startup>1</load-on-startup>
</servlet>

For more information on the web.xml file refer to the Integration article.

With the debugging mode on, CKFinder returns detailed exception information when an error occurs.

important note
The debugging mode should not be turned on by default on a production server and should only be used to diagnose a problem when CKFinder does not work as expected.


Empty Error Messages

Under some circumstances right after installing CKFinder you may get errors about incorrect configuration of the application. In rare cases (usually because of your custom web application settings) it may happen that you will not see any message text either in the dialog window or in your log files.

An empty CKFinder error message window


Here is what you can do to fix it:

  1. Clear Tomcat log files. This step is not obligatory, but if you do not want to go through hundreds of log files that you probably have in your Tomcat, you can clear them. In this way it will be easier for you to find an exception you are interested in.
  2. Deploy the CKFinderJava-x.y.war file (x.y is the version number) on your Apache Tomcat server.
  3. Turn on debugging mode in the CKFinderJava application. In order to achieve this, go to the WEB-INF/web.xml file and set the <init-param>debug</init-param> node to true. See the section above for a more detailed description of the debugging mode.
  4. Start and stop your Apache Tomcat server. This will create a CKFinderJava context file which represents a web application that is run within a particular virtual host. You can find more information about application context here: http://tomcat.apache.org/tomcat-7.0-doc/config/context.html.
  5. If you are using a default Apache Tomcat configuration, your virtual host is localhost and your application context should be placed under {CATALINA_HOME}/conf/Catalina/localhost. The context file has the same name as your application and has an .xml extension. In our default case it will be CKFinderJava-x.y.xml.
  6. Open the context file, find the Context node and add the swallowOutput attribute with its value set to true. The node should look like this: <Context antiJARLocking="true" path="/CKFinderJava" swallowOutput="true" />. This attribute will redirect all errors to the web application logger.
  7. Now start your application again and repeat the steps to return an error. A detailed stacktrace should be visible in the CKFinder dialog window as well as in Tomcat log files.
An empty CKFinder error message window


Flash Upload Problem

Note: the flash upload component has been completely removed in CKFinder 2.6.

As of CKFinder 2.1 we have introduced a new Flash component for multiple file upload. It is working great except in one situation. When you use your own authentication method in CKFinder (you have overridden the checkAuthentication() method), based on a variable placed in the session scope, in browsers other than Internet Explorer you might see the following error while trying to upload images: "The file browser is disabled for security reasons. Please contact your system administrator and check the CKFinder configuration file".

CKFinder Flash Upload Problem


This is happening because of an old Flash "cookie bug". If you are interested in seeing reports on this issue you can follow the links below (login is required):

To sum up the problem: as you probably know, the browser has a cookie space which is designed to store cookies that are used for the communication with the server. When the Flash component (embedded in the Web page) is being initialized, it creates its own separate cookie space in non-IE browsers from which unfortunately wrong or no cookies are sent. If correct cookies are not sent, sessions and cookie-based authentication will not work.

To workaround this problem we have created FileUploadFilter which retrieves appropriate cookies on server side. So if you are using flash upload component together with session scope variables to identify your user, make sure this Filter is included in your application config file. Also note that its mapping should be set to the same url pattern as for ConnectorServlet.

To use the filter you have to declare it in web.xml file for your application. For more details on configuration please refer to Integration, [File Upload Filter] section.

Support and Help

If you encounter other issues with CKFinder for Java, you can find support on the community forum. Use the contact form from our website to send your questions and comments.

This page was last edited on 13 September 2011, at 19:48.