OFBiz
  1. OFBiz
  2. OFBIZ-4659 Umbrella task for jackrabbit integration
  3. OFBIZ-4812

Avoid the ClassNotFoundException on the jdbc driver used by jackrabbit component

    Details

    • Type: Sub-task Sub-task
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: SVN trunk
    • Fix Version/s: None
    • Component/s: framework
    • Labels:
      None
    • Environment:

      WXP SP3, Sun SDK 1.6.0_30, PostgreSQL 9.2

      Description

      Hi

      When running ofbiz under Eclipse with the sources directories as classpath and not the ofbiz-*.jar, the jcr component fails to load the jdbc driver because jackrabbit-core is using Class.forName() instead of using the current classloader of the thread. see https://issues.apache.org/jira/browse/JCR-3288

      I provide with this issue a jackrabbit-core-2.3.3.jar patched as described in the JCR-3288 issue.

      Rgds

      1. ofbiz.log
        76 kB
        Francis ANDRE
      2. jackrabbit-core-2.3.3.jar
        2.14 MB
        Francis ANDRE

        Issue Links

          Activity

          Hide
          Francis ANDRE added a comment -

          This is the log of starting ofbiz under Eclipse when not using the patched jar. The ofbiz startup process fails with a ClassNotFoundException and then System.exit().

          Show
          Francis ANDRE added a comment - This is the log of starting ofbiz under Eclipse when not using the patched jar. The ofbiz startup process fails with a ClassNotFoundException and then System.exit().
          Hide
          Francis ANDRE added a comment -

          You miss an important point: all those improvements are for allowing hot replacement of class when running under the debug mode in Eclipse, which you cannot do if you remotely debug a ofbiz session started by ant, or you just run ofbiz under Eclipse because in this later case, ofbiz is using the ofbiz-*.jar and thus, one cannot use hot replacement of code. Even in the wiki https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse, it is clearly mentioned by P Gonon that

          "Note that when doing development work, you will have to stop OFBiz, run an Ant build and re-start. Because this method treats OFBiz as a plain Java up, you don't have any automatic classloading as you might be used to when using Eclipse-WTP and developing webapps."

          Thus all those Jira for improvement are to allow a "normal" Eclipse debugging session as usual, with hot replacement of code.

          When you do not want hot replacement of code, the methods stated in the https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse works fine, but this is a different objective.

          Thus, I am in favor to not revert the r1308085 and apply this one, which needs the replacement of the jackrabbit-core-2.3.3.jar by the patched one, otherwise ofbiz stops.

          Show
          Francis ANDRE added a comment - You miss an important point: all those improvements are for allowing hot replacement of class when running under the debug mode in Eclipse, which you cannot do if you remotely debug a ofbiz session started by ant, or you just run ofbiz under Eclipse because in this later case, ofbiz is using the ofbiz-*.jar and thus, one cannot use hot replacement of code. Even in the wiki https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse , it is clearly mentioned by P Gonon that "Note that when doing development work, you will have to stop OFBiz, run an Ant build and re-start. Because this method treats OFBiz as a plain Java up, you don't have any automatic classloading as you might be used to when using Eclipse-WTP and developing webapps." Thus all those Jira for improvement are to allow a "normal" Eclipse debugging session as usual, with hot replacement of code. When you do not want hot replacement of code, the methods stated in the https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse works fine, but this is a different objective. Thus, I am in favor to not revert the r1308085 and apply this one, which needs the replacement of the jackrabbit-core-2.3.3.jar by the patched one, otherwise ofbiz stops.
          Hide
          Jacques Le Roux added a comment -

          I do the same than Sascah, actually this is clearly explained for a long time at https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse

          Francis did you follow those advices before creating OFBIZ-4777?

          Show
          Jacques Le Roux added a comment - I do the same than Sascah, actually this is clearly explained for a long time at https://cwiki.apache.org/confluence/display/OFBIZ/Running+and+Debugging+OFBiz+in+Eclipse Francis did you follow those advices before creating OFBIZ-4777 ?
          Hide
          Jacques Le Roux added a comment -

          I must say I never crossed issues using the other method (direct debug run) as well... I could revert r1308085, Francis?

          Show
          Jacques Le Roux added a comment - I must say I never crossed issues using the other method (direct debug run) as well... I could revert r1308085, Francis?
          Hide
          Sascha Rodekamp added a comment -

          Hm the debug mode also works when starting ofbiz within eclipse, no problems with that. But i use the ofbiz.jar in my classpath and define the sources under source.

          Show
          Sascha Rodekamp added a comment - Hm the debug mode also works when starting ofbiz within eclipse, no problems with that. But i use the ofbiz.jar in my classpath and define the sources under source.
          Hide
          Jacopo Cappellato added a comment - - edited

          As far as I know debug mode works fine if you run ofbiz in debug mode from ant/shell and then connect to it from your IDE.

          Show
          Jacopo Cappellato added a comment - - edited As far as I know debug mode works fine if you run ofbiz in debug mode from ant/shell and then connect to it from your IDE.
          Hide
          Jacques Le Roux added a comment -

          Jacopo,

          • About r1308085: it's really harmless and I can't see any issues with that.
          • r1326300 is really something important for Eclipse users, notably those wich uses releases where the schemas (XSDs) on site are not in sync with their XML files. I still wait Francis's documentation about that on wiki BTW

          I guess Francis is more interested by debugging mode than running in Eclipse. Else I agree it does not make sense.

          Show
          Jacques Le Roux added a comment - Jacopo, About r1308085: it's really harmless and I can't see any issues with that. r1326300 is really something important for Eclipse users, notably those wich uses releases where the schemas (XSDs) on site are not in sync with their XML files. I still wait Francis's documentation about that on wiki BTW I guess Francis is more interested by debugging mode than running in Eclipse. Else I agree it does not make sense.
          Hide
          Jacopo Cappellato added a comment -

          Francis,

          Sascha explained some of the motivations pretty well.
          In addition to this I would like to add:
          1) we should limit as much as possible to commit code for making it compliant with IDEs; for example I don't like the code that Jacques committed in rev. 1308085 and not much the code committed in rev. 1326300
          2) running OFBiz in Eclipse is not the best way to run it; you can do if you like and it works but if it is causing problems you should use ant or the shell;
          3) we should always use officially released jars from other projects; using a patched version (that doesn't even convince the committers of the other project) is not ok, especially if the reason is to make of biz compatible with an IDE

          Show
          Jacopo Cappellato added a comment - Francis, Sascha explained some of the motivations pretty well. In addition to this I would like to add: 1) we should limit as much as possible to commit code for making it compliant with IDEs; for example I don't like the code that Jacques committed in rev. 1308085 and not much the code committed in rev. 1326300 2) running OFBiz in Eclipse is not the best way to run it; you can do if you like and it works but if it is causing problems you should use ant or the shell; 3) we should always use officially released jars from other projects; using a patched version (that doesn't even convince the committers of the other project) is not ok, especially if the reason is to make of biz compatible with an IDE
          Hide
          Sascha Rodekamp added a comment -

          Hi Francis,

          I would avoid to patch single jar files, that increases the maintenance effort.

          As Felix said using Class.forName(String) is problematic in OSGi scenarios. So i will refrain from replacing the jar file and prefer to wait for an official solution.

          But anyway thanks for working on this issue.

          Any options?

          Show
          Sascha Rodekamp added a comment - Hi Francis, I would avoid to patch single jar files, that increases the maintenance effort. As Felix said using Class.forName(String) is problematic in OSGi scenarios. So i will refrain from replacing the jar file and prefer to wait for an official solution. But anyway thanks for working on this issue. Any options?
          Hide
          Francis ANDRE added a comment -

          Hi Jacopo

          I am sorry but I do not understand your point?

          Show
          Francis ANDRE added a comment - Hi Jacopo I am sorry but I do not understand your point?
          Hide
          Jacopo Cappellato added a comment -

          Does it only happen when running OFBiz in eclipse? I would not worry about this in this case.

          Show
          Jacopo Cappellato added a comment - Does it only happen when running OFBiz in eclipse? I would not worry about this in this case.
          Hide
          Francis ANDRE added a comment -

          The patched jar

          Show
          Francis ANDRE added a comment - The patched jar

            People

            • Assignee:
              Unassigned
              Reporter:
              Francis ANDRE
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development