Eclipse tips
Debug tomcat
You can debug your OpenKM installation using the Tomcat logging facility. This is an useful thing when you have problems with your configuration. Default OpenKM installation tries to log important events like errors and warnings. Is possible to change this configuration editing the file $TOMCAT_HOME/conf/logging.properties.
Default Tomcat log configuration can generate a lot of messages. These files are stored at $TOMCAT_HOME/logs.
Debug remote tomcat server
When you have problems on the production environment this configuration is specially useful.
Add the following options when the JVM is started:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Or if you are using shell scripts to start Tomcat, start it with the following command (recommended):
$ $TOMCAT_HOME/bin/catalina.sh jpda start
It will start Tomcat so that a remote debugger can be connected to port 8000.
More information at:
Eclipse configuration
Open eclipse "Debug configurations", then choose "Remote Java Application", right click on mouse and choose "new".
Set the "host" and "port" of the remote server:
Include in source tab your OpenKM java project:
You can debug normally, setting breakpoints, etc.
Debug GWT frontend user interface with GWT Super Dev Mode
Super Dev Mode is available from version GWT 2.5.0.RC1, more information at GWT 2.5.0.RC1 Release notes.
You can find additional information of them at :
- GWT Super Dev Mode offical site.
Enable source for debugging
Edit pom.xml file and uncomment this section:
<!-- Only for development -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
Uncomment the xsiframe section into the Main.gwt.xml file:
<!--
Use GWT 2.7.0 to debug in Firefox -->
<add-linker name="xsiframe"/>
<set-configuration-property name='xsiframe.failIfScriptTag' value='FALSE'/>
<set-configuration-property name="devModeUrlWhitelistRegexp" value="http://(localhost|127\.0\.0\.1|192\.168\.1\.34)(:\d+)?/.*" />
Eclipse configuration
Open eclipse "Debug configurations", then choose "Java Application", right click on mouse and choose "new".
Set the Main class field value:
com.google.gwt.dev.DevMode
Select "Arguments" tab and set the "program arguments" field value:
-bindAddress 0.0.0.0 -src src/ com.openkm.frontend.Main
And the "VM arguments" field value:
-Xms2048m
Select "JRE" tab and set the "OpenJDK version":
You should choose OpenJDK 1.8.x
Select the "Classpath" tab and add folder /openkm/src/main ( use "Advanced" button and "add folder" option for it ) :
Add GWT jar dependencies with Add External JARs button:
The version of JARs files below might change.
The javax.servlet-api-3.1.0 solve a java.lang.NoClassDefFoundError: javax/servlet/http/HttpSessionIdListener error. That happens from version 2.8.x and upper.
- gwt-user-2.8.2.jar
- gwt-dev-2.8.2.jar
- gwt-user-2.8.2.jar
- javax.servlet-api-3.1.0
No you can run the Super Dev Mode at the end of the log is shown the url where the service is binding:
Open the code server url in your chrome browser browser and drag the bookmarklets in your bookmark bar:
Open your OpenKM frontend url in Chorme browser and then click in your bookmark bar the option "Dev Mode On" you have dragged in previous step. It will be shown a popup option with Compile button. Click in "Compile" button.
Finally open the Chrome developer tools and from the sources tab you have OpenKM java code available, where to set breakpoints, watch variables, etc:
Debug GWT frontend user interface with GWT Shell
GWT Shell is deprecated an it has been removed from GWT version 2.5.1, more information at GWT 2.5.1 Release notes.
You can debug GWT frontend with GWT Shell ( what have extension support from firefox browsers 2.4 and older ) or GWT Super Dev Mode ( we suggest use chrome in this scenario ).
In the documentation section below, we have tried to explain how to get working old GWT Shell with eclipse. The sample below show how to debug GWT from localhost, but also is possible debug remotely.
You can find additional information of them at :
- GWT Shell official site.
Enable source for debugging
Edit pom.xml file and uncomment this section:
<!-- Only for development -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-dev</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
Eclipse configuration
Open eclipse "Debug configurations", then choose "Java Application", right click on mouse and choose "new".
Set the Main class field value:
com.google.gwt.dev.DevMode
Select "Arguments" tab and set the "program arguments" field value:
-port 8080 -noserver -startupUrl /OpenKM/frontend/index.jsp com.openkm.frontend.Main
And the "VM arguments" field value:
-Xms1024m -Xmx2048M -XX:PermSize=64m -XX:MaxPermSize=1024m
Select "JRE" tab and set the "OpenJDK version":
You should choose OpenJDK 1.8.x
Select the "Classpath" tab and add folder /openkm/src/main ( use "Advanced" button and "add folder" option for it ) :
Now you can run the GWT Shell.
To debug login put in your browse:
You can remotely debug GWT simply changing localhost for your remote URL. Take in consideration you are executing GWT code from eclipse, not the remote one. Consider your local GWT code version be the same is compiled on the remote server.
http://localhost:8080/OpenKM/frontend/index?gwt.codesvr=127.0.1.1:9997
You debug into eclipse, see variables values, etc.