Loading ...
Sorry, an error occurred while loading the content.
 

Re: [flexcoders] Re: Flex, Hibernate and Coldfusion

Expand Messages
  • Michael McKellip
    Cathy, Success! Thanks very much to you and Peter we have a workaround. There is definitely a classloader issue between CFMX / JRun 4 and the commons-logging
    Message 1 of 26 , Jan 7 10:48 AM
      Cathy,

      Success! Thanks very much to you and Peter we have a workaround. There
      is definitely a classloader issue between CFMX / JRun 4 and the
      commons-logging classes. The end result is a user will be unable to
      access any classes that use the commons-logging.jar classes from
      within ColdFusion. In our case, we wanted to use a Hibernate backend
      developed for a Flex app from within another app developed in CF /
      Mach II. Hibernate uses the logging framework alot.

      We tried your suggestion of editing the jvm.config and adding the path
      to the commons-logging from Hibernate to the front of the classpath.
      It still only picked up the commons-logging included in
      {application.home}/lib/webservices.jar file. We also tried editing the
      jrun.properties file in the cfmx_bootstrap.jar to force it to pick up
      the commons-logging loaded by the CF classloader. Still no results.

      For those interested, here is how we finally got Hibernate accessible
      from CF (Please note this is not Macromedia Supported):

      1. Put the following Hibernate files into
      {application.home}/servers/cfusion/cfusion/WEB-INF/lib directory:

      cglib-full-2.0.2.jar
      commons-collections-2.1.1.jar
      commons-logging-1.0.4.jar
      dom4j-1.4.jar
      ehcache-0.9.jar
      hibernate2.jar
      jta.jar
      odmg-3.0.jar

      DO NOT include the log4j.jar as it will conflict with what CF loaded.

      2. Expand the {application.home}/lib/webservices.jar file. Remove the
      "logging" folder from within the org/apache/commons directory.
      Recreate the webservices.jar

      3. Expand the {application.home}/servers/cfusion/cfusion/WEB-INF/cfusion/lib/webservices.jar
      file. Remove the "logging" folder from within the org/apache/commons
      directory. Recreate this webservices.jar

      Hibernate will now run successfully within CF. We monitored startup of
      all jrun instances and there are no errors. Everything appears to be
      running. If anyone knows a better workaround, we would love to hear
      it.

      We did submit the simple test case used to reproduce the bug to
      Macromedia. Hopefully it is something they will resolve.

      Michael

      On Thu, 6 Jan 2005 17:27:14 -0500, Cathy Murphy <cmurphy@...> wrote:
      >
      > Michael -
      >
      > > I also setup a standalone CFMX server and the cfm runs perfectly
      > > everytime on its own. Therefore it appears to definitely be a
      > > classloader issue between JRun/ColdFusion and the logging classes. We
      > > have reproduced the problem on all of our servers. Any suggestions
      > > what we can do next to solve the issue?
      > >
      >
      > I would log the issue, including your test case, with Macromedia Support.
      >
      >
      > > > (i) A few last ditch suggestions to possibly get you around
      > > the issue, take
      > > > the latest version of commons-logging and add it to the
      > > same directory as
      > > > the webservices.jar (the call you used yesterday will tell you this
      > > > location). Rerun the same code as yesterday and see if the new
      > > > commons-logging.jar is getting picked up. Then, rerun your
      > > test case.
      > >
      > > We tried this but it continues to pickup the original commons-logging
      > > classes and not the new ones.
      > >
      >
      > Find jvm.config in your server. Add the path of commons-logging.jar to
      > java.class.path.
      >
      > java.class.path=path-to-commons-logging.jar,{application.home}/servers/lib
      >
      > Also, did you try my other suggestion?
      >
      > (ii) Create an init servlet in the CF web application which calls a logging
      > statement or the concise test case from above. This is an automated way of
      > hitting the JSP before the CF page at startup.
      >
      >
      > The only other thing I can think of is finding the commons-logging classes
      > in the CF application and removing them. This isn't really recommended
      > though.
      >
      > - Cathy
      >
      >
      > Yahoo! Groups Links
      >
      >
      >
      >
      >
    • Cathy Murphy
      Congratulations! I m glad you were able to find a solution which works for you. - Cathy ... /webservices.jar
      Message 2 of 26 , Jan 10 10:39 AM
        Congratulations! I'm glad you were able to find a solution which works for
        you.

        - Cathy

        > -----Original Message-----
        > From: Michael McKellip [mailto:michael.mckellip@...]
        > Sent: Friday, January 07, 2005 1:48 PM
        > To: flexcoders@yahoogroups.com
        > Subject: Re: [flexcoders] Re: Flex, Hibernate and Coldfusion
        >
        >
        > Cathy,
        >
        > Success! Thanks very much to you and Peter we have a workaround. There
        > is definitely a classloader issue between CFMX / JRun 4 and the
        > commons-logging classes. The end result is a user will be unable to
        > access any classes that use the commons-logging.jar classes from
        > within ColdFusion. In our case, we wanted to use a Hibernate backend
        > developed for a Flex app from within another app developed in CF /
        > Mach II. Hibernate uses the logging framework alot.
        >
        > We tried your suggestion of editing the jvm.config and adding the path
        > to the commons-logging from Hibernate to the front of the classpath.
        > It still only picked up the commons-logging included in
        > {application.home}/lib/webservices.jar file. We also tried editing the
        > jrun.properties file in the cfmx_bootstrap.jar to force it to pick up
        > the commons-logging loaded by the CF classloader. Still no results.
        >
        > For those interested, here is how we finally got Hibernate accessible
        > from CF (Please note this is not Macromedia Supported):
        >
        > 1. Put the following Hibernate files into
        > {application.home}/servers/cfusion/cfusion/WEB-INF/lib directory:
        >
        > cglib-full-2.0.2.jar
        > commons-collections-2.1.1.jar
        > commons-logging-1.0.4.jar
        > dom4j-1.4.jar
        > ehcache-0.9.jar
        > hibernate2.jar
        > jta.jar
        > odmg-3.0.jar
        >
        > DO NOT include the log4j.jar as it will conflict with what CF loaded.
        >
        > 2. Expand the {application.home}/lib/webservices.jar file. Remove the
        > "logging" folder from within the org/apache/commons directory.
        > Recreate the webservices.jar
        >
        > 3. Expand the
        > {application.home}/servers/cfusion/cfusion/WEB-INF/cfusion/lib
        /webservices.jar
        > file. Remove the "logging" folder from within the org/apache/commons
        > directory. Recreate this webservices.jar
        >
        > Hibernate will now run successfully within CF. We monitored startup of
        > all jrun instances and there are no errors. Everything appears to be
        > running. If anyone knows a better workaround, we would love to hear
        > it.
        >
        > We did submit the simple test case used to reproduce the bug to
        > Macromedia. Hopefully it is something they will resolve.
        >
        > Michael
        >
      • mpwoodward2
        ... I ve been working with Hibernate in Java lately and of course would love to have this same functionality for my CF apps, so this has definitely piqued my
        Message 3 of 26 , Feb 3, 2005
          --- In flexcoders@yahoogroups.com, Michael McKellip
          <michael.mckellip@g...> wrote:
          > Cathy,
          >
          > Success! Thanks very much to you and Peter we have a workaround. There
          > is definitely a classloader issue between CFMX / JRun 4 and the
          > commons-logging classes. The end result is a user will be unable to
          > access any classes that use the commons-logging.jar classes from
          > within ColdFusion. In our case, we wanted to use a Hibernate backend
          > developed for a Flex app from within another app developed in CF /
          > Mach II. Hibernate uses the logging framework alot.

          I've been working with Hibernate in Java lately and of course would
          love to have this same functionality for my CF apps, so this has
          definitely piqued my interest. My main question is this: now that you
          have Hibernate loading from CF, are you using Java objects with it, or
          have you figured out a way to persist CFCs using Hibernate?

          Any details you can give on the specifics of what you're doing would
          be greatly appreciated.

          Thanks,
          Matt
        • Michael McKellip
          Matt, Glad to see that someone else would like to see this work. Our goals may have been slightly different than yours. We were trying to use the persistence
          Message 4 of 26 , Feb 4, 2005
            Matt,

            Glad to see that someone else would like to see this work. Our goals
            may have been slightly different than yours. We were trying to use the
            persistence layer and pojo's created with Hibernate in both an
            internal Flex application and re-use it in a public Mach-II
            application. Both our CF and Flex servers run as instances on top of
            JRun. Hibernate works wonderfully with Flex and we are extremely happy
            with it. CF was another story. We thought we had a workable solution.
            However, while our solution worked with J2ee CF and JRun on a Mac OS
            X machine, it did not work with the same version of CF and JRun on
            Wiindows. We have found one of the major issues is that JRun doesn't
            follow the standard servlet spec. There is definitely a classloader
            issue with the JRun/CF combination. We have confirmed a basic bug with
            the JRun/CF combination that prevents any java app using the log4j
            logging classes from running within the CF instance. A basic class
            that simply imports the logging classes and trys to do a log can
            confirm it. We filed a bug report with Macromedia with code to
            duplicate the problem but have not received a response.

            We have a huge project and deadline looming and therefore had to
            abandon our effort to use Hiernate with CF at the moment. I am
            confident the same problems will not necessarily exist when using a
            different J2ee app server such as JBoss or even just Tomcat. However,
            our company is heavily invested in Macromedia technologies and we
            would have a hard time getting management to approve a switch from
            JRun to something else.

            My co-worker and I will probably join your open-source effort to get
            CF and Hibernate working. We may not be extremely active for a month
            or so while we finish the project we are in the middle of. I have
            included the steps that got it to work on the Mac OS X JRun/CF setup
            below. Good luck!

            -------------------------------------------
            1. Put the following Hibernate files into
            {application.home}/servers/cfusion/cfusion/WEB-INF/lib directory:

            cglib-full-2.0.2.jar
            commons-collections-2.1.1.jar
            commons-logging-1.0.4.jar
            dom4j-1.4.jar
            ehcache-0.9.jar
            hibernate2.jar
            jta.jar
            odmg-3.0.jar

            DO NOT include the log4j.jar as it will conflict with what CF loaded.

            2. Expand the {application.home}/lib/webservices.jar file. Remove the
            "logging" folder from within the org/apache/commons directory.
            Recreate the webservices.jar
            ie: From within the webservices folder run the following command:
            jar cvf ../webservices.jar *

            3. Expand the {application.home}/servers/cfusion/cfusion/WEB-INF/cfusion/lib/webservices.jar
            file. Remove the "logging" folder from within the org/apache/commons
            directory. Recreate this webservices.jar
            ie: From within the webservices folder run the following command:
            jar cvf ../webservices.jar *

            ----------------------------------------------------------------


            On Thu, 03 Feb 2005 23:05:34 -0000, mpwoodward2 <mpwoodward@...> wrote:
            >
            >
            > --- In flexcoders@yahoogroups.com, Michael McKellip
            > <michael.mckellip@g...> wrote:
            > > Cathy,
            > >
            > > Success! Thanks very much to you and Peter we have a workaround. There
            > > is definitely a classloader issue between CFMX / JRun 4 and the
            > > commons-logging classes. The end result is a user will be unable to
            > > access any classes that use the commons-logging.jar classes from
            > > within ColdFusion. In our case, we wanted to use a Hibernate backend
            > > developed for a Flex app from within another app developed in CF /
            > > Mach II. Hibernate uses the logging framework alot.
            >
            > I've been working with Hibernate in Java lately and of course would
            > love to have this same functionality for my CF apps, so this has
            > definitely piqued my interest. My main question is this: now that you
            > have Hibernate loading from CF, are you using Java objects with it, or
            > have you figured out a way to persist CFCs using Hibernate?
            >
            > Any details you can give on the specifics of what you're doing would
            > be greatly appreciated.
            >
            > Thanks,
            > Matt
            >
            >
            > Yahoo! Groups Links
            >
            >
            >
            >
            >
          Your message has been successfully submitted and would be delivered to recipients shortly.