Announcement Announcement Module
No announcement yet.
Spring with ColdFusion Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring with ColdFusion


    I am trying to get Spring to work with ColdFusion. However, just about every Spring class I need to use seems to use logging. Any time anything log related happens when Spring is running in ColdFusion, I get an error similar to the following:

    "Error creating bean with name 'myDataSource' defined in file [/Applications/jakarta-tomcat-5.0.25/webapps/ROOT/spring2/styles.xml]: Instantiation of bean failed; nested exception is org.apache.commons.logging.LogConfigurationExcepti on: org.apache.commons.logging.LogConfigurationExcepti on: org.apache.commons.logging.LogConfigurationExcepti on: Class org.apache.commons.logging.impl.Jdk14Logger does not implement Log"

    Having dug around a bit, I have determined that ColdFusion uses an older version of log4j than the current Spring distro, and as a result, this problem occurs whenever ColdFusion tries to load a Java object that was compiled using the newer version of log4j (like the ones in Spring).

    Does anybody have any ideas how I can get around this problem?


    - max

  • #2
    Moo hoo haa haa ha! I have figured out the solution.

    According to a post I found online on another forum, the file webservices.jar that comes with ColdFusion MX has a really old version of commons-logging. If you delete commons-logging from this jar file, re-jar it and replace the old jar with this altered one, the problem goes away.

    Here's the step-by-step solution:

    1) Go to WEB-INF/cfusion/lib/ under your CF MX installation
    2) Rename the old webservices.jar file
    3) Copy this jar file out to another location
    4) Extract all files within the jar into a directory called "webservices" (i.e. jar -xvf webservices.jar)
    5) Remove the commons-logging directory in this extracted "webservices" directory (just delete it and all its contents). You have to dig through the class file structure to find it
    6) Re-jar the contents of the extracted "webservices" directory into webservices.jar (i.e. jar -cvf webservices.jar -C webservices/ .)
    7) Copy the new webservices.jar to the location in #1

    After doing this, I was able to instantiate a BeanFactory and load beans without any log4j errors (something I've never been able to do before). I haven't tested it any further than that, so use this method on a production server at your own risk.

    I highly recommend holding on to the original webservices.jar file in case you run in to issues and need to switch back quickly.

    - max


    • #3
      JRun Issues

      Hi again,

      FYI: I've found that the solution listed above works fine if you deployed CFMX in Tomcat, but not in JRun. I'm working on a fix/workaround for JRun and I'll post it once I have it figured out.

      - max


      • #4
        JRun 4/Spring Logging fix found


        I have determined how to fix the logging issue with Spring in JRun 4. Use these instructions *instead* of the ones listed above for Tomcat.

        1) Go to [jrun root]/lib
        2) Copy out the webservices.jar file
        3) Extract the jar file using the jar utility
        4) Navigate the extracted directory structure to org/apache/commons
        5) Remove the "logging" directory
        6) Replace it with the "logging" directory from commons-logging-1.0.4 (you can get this from ). (NOTE: I'm assuming that any newer version of commons-logging will work, this happened to be the distro that I used successfully)
        7) Re-jar your webservices directory into webservices.jar
        8) Copy the modified webservices.jar in to [jrun root]/lib
        9) Start JRun

        You should now be able to use the Spring classes in ColdFusion without issue.

        - max