This page is divided into two sections. The first section - titled "Troubleshooting Steps" provides step-by-step instructions to follow if you encounter problems configuring or using DWR. The second section - title "Common Problems and Fixes" lists several common problems and their associated fixes.

Troubleshooting Steps

  1. The DWR test page - Check the DWR test page and execute any problem methods from the test page.
    1. Everything works from the DWR test page, but not from a custom page. What should I do?
    2. The DWR test page does not come up, my exposed class does not show up on the test page, or my method call does not work from the test page. What should I do?
  2. Your Java code - Have you verified it is not your Java code causing the problem?
  3. General Tips
    1. Use the server logs
    2. Debug your JavaScript
    3. Use an HTTP Debugging proxy/Sniffer to examine the request/response.
  4. If all else fails? Search for your issue on the DWR users mailing list, if you can't find a solution send a message to the mailing list. Make sure you include all of the information you have gathered from your troubleshooting!

The DWR test page

The test page displays all classes exposed to DWR and allows you to invoke methods on those classes. If a method call works from the test page you have properly installed and configured DWR.

Accessing the DWR test page

What to do when things work from the DWR test page, but do not work from a custom page

This situation indicates that you have a Javascript problem on your custom page.

What to do when things don't work from the DWR test page or a custom page

This situation indicates that DWR, your container, or application is not properly configured.

Your Java Code

Are you sure it is not your own Java code causing the problem? Make sure it isn't by testing your Java code outside of DWR. If everything is working in your test case try debugging through your code when called from DWR to see if you can isolate the problem.

Many developers new to the web don't bother setting up a debugging environment. I feel this is a mistake. It is easy to do and you can learn a lot by stepping through code. Setting up a debugging environment is specific to your IDE and servlet container/application server and beyond the scope of our documentation. I recommend looking into the options that are available for the development environment you are working in.

Troubleshooting/Debugging Tips

Using the server logs

The chances are if you encounter an error DWR will be logging the cause of the error in the server logs. Many times the errors in the log can quickly lead you to a fix for the problem you are experiencing. Here are a few examples:

A failure to configure a converter for a class that DWR needs to serialize will result in the following error:

Jul 22, 2008 2:37:58 PM org.directwebremoting.util.CommonsLoggingOutput error
SEVERE: No converter found for 'dwr.book.model.User'
A failure to add the commons-logging.jar into your application's classpath will result in the following error:
SEVERE: StandardWrapper.Throwable
java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.directwebremoting.dwrp.PollHandler.<clinit>(PollHandler.java:382)
at java.lang.Class.forName0(Native Method)
The logs are there for a reason -- use them. Many times reading the logs will guide you to a quick solution.

JavaScript Debugging

All modern web browsers have JavaScript debugging tools. When encountering problems in a web browser it is recommended to first check your browsers error console. If you see problems in the console you can discover more about the problem by using the browsers debugging features.

Using an HTTP Debugging Proxy/Sniffer

HTTP debugging proxies are a nice tool to have in your arsenal. These tools allow you to inspect all HTTP traffic and even manipulate incoming/outgoing data. A few we recommend are:

Common Problems and Fixes

TransformerFactoryConfigurationError

This problem shows up as the following stack trace when starting a DWR enabled webapp:

root cause
javax.xml.transform.TransformerFactoryConfigurationError:
  Provider org.apache.xalan.processor.TransformerFactoryImpl not found
       javax.xml.transform.TransformerFactory.newInstance(Unknown Source)

This doesn't really have much to do with DWR, it's caused by Tomcat not being setup properly. The quick answer is to download Xalan and place xalan.jar into $TOMCAT-HOME/common/lib. DWR 2.0 copes with this problem better than DWR 1.x, but the core problem is still that DWRs XML serialization support requires an XSLT parser.

If you have this problem with JDK 5 then it has been reported that the following VM parameter will kick Tomcat into action.

-Djavax.xml.transform.TransformerFactory=
   com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl

XML Parser Errors

The most common error when getting started with DWR is an XML parser error. It has nothing to do with DWR, and is due to your installation of Tomcat having Xerces installed when it shouldn't or not installed when it should.

In addition to these issues, various version of Tomcat either came with XML parsers or had add-on packages that included them. It's important to check that you have the correct add-on packages for your JDK version.

Classpath Issues With BEA Weblogic

Weblogic 8.1 (and maybe other versions) can make it hard for DWR to find classes.

This can happen if dwr.jar is being used from an APP-INF directory (i.e. APP_INF/lib). Under these circumstances DWR will still appear to function, the debug pages will be visible for example, however it will have trouble finding your classes.

The solution is to place dwr.jar into your WEB-INF/lib directory.

DWR and Multiple IEs on one machine

Microsoft discourage people from using multiple versions of IE on a single machine, even though there are solutions like Tredosof Multiple IE. The issue is that you never really have a full installation of the non-system browser. Cookie support is one area where multiple versions of IE breaks, which can cause problems with DWR's cross-domain security.

Probably the best solution is to use Virtual PC. This is Microsoft's recommended solution.

Alternatively you could disable DWRs cross domain security feature, by adding this parameter to your web.xml in the DWR servlet section:

<init-param>
  <!-- fix for multiple IEs on one machine. Remove this before going live -->
  <param-name>crossDomainSessionSecurity</param-name>
  <param-value>false</param-value>
</init-param>

Annotations and Websphere

Websphere is rather late to support Java5 and some versions of Websphere react strangely when Java5 code is found. DWR 2.x contains optional Java5 support. The vast majority of the JAR file was compiled with JDK 1.3 however the Annotations support was compiled with JDK 1.5. Normally a 1.4 JVM will throw an exception that DWR can catch using a normal try/catch mechanism, however for some reason the IBM 1.4 JVM seems to throw a magic uncatchable exception!. The following console message maybe found with Websphere / DWR 2.x.

TRAS0014I: The following exception was logged
java.lang.LinkageError: LinkageError while defining class:
org.directwebremoting.annotations.AnnotationsConfigurator

Could not be defined due to:
org/directwebremoting/annotations/AnnotationsConfigurator
(Unsupported major.minor version 49.0)

This is often caused by having a class defined at multiple
locations within the classloader hierarchy. Other potential
causes include compiling against an older or newer version of
the class that has an incompatible method signature.
...

If this prevents DWR from working, there are 2 solutions:

Still having problems?

If you can't find a solution here then please join the mailing list and ask there.