2 Replies Latest reply on Dec 27, 2011 7:37 PM by eevictim

    Error Configuration File bc4j.xcfg is not found in the classpath

      I am new to JDeveloper and ADF, and am suffering through the steep learning curve. This story may prove useful to someone, someday.

      I just finished resolving a “bc4j.xcfg is not found in the classpath” error and it added another level of understanding to how things are glued together.

      There is a back story. I had made a first pass at creating a test application. When I was done I started “enhancing” the application. One of the changes was to add a column to a view in the database. Try as I might I could not get that change propagated to the business component. This is still on my to-figure-out list. In frustration I dropped the model and recreated it from the database tables and views. Testing it with the “AppModule” in the model project I could see the view with the new column. However, when I went to run one of my old jspx pages, I now got the dreaded “bc4j.xcfg is not found in the classpath” – and this was for a page that was not using my updated view. As the military expression goes, “Whiskey Tango Foxtrot”.

      It is now working again, and here is what I found.

      I noticed in the error message that it could not find “/cloudapp1/common/bc4j.xcfg”. When I searched for the file I found it in /cloudapp1/model/common/bc4j.xcfg. I went to the project properties for the model project and on the “Project Source Paths” node I saw at the bottom of the page Default Package: cloudapp1.model. Ah Ha! That is where the /cloudapp1/model structure came from. Then I remembered that the first time through I had changed the default package to just cloudapp1. Part of my experimenting with the product. When I quickly rebuilt the model project I did not do that.
      Next I found the DataBindings.cpx that one note alluded to. It is in the ViewController project. There I found an “OC4JDataControl” section. In there was and entry Package=”cloudapp1”. This was the original package name. When I rebuilt the model, this was not updated. Anyway, I changed it to Package=”cloudapp1.model”. [ Insight:  When you first build an app it can make some good guesses about what is needed, but when you start adding and dropping projects it is much harder to guess how they are glued together.]

      Raising a cup of coffee in triumph I re-ran the test page.

      Dang! Still a bc4j.xcfg not found in the classpath – but this time the path mentioned matched the path where I knew the file to be.

      I am nothing if not stubborn. I knew the problem just had to be in the ViewController project, because the AppModule in the model project worked. So, I started going through all of the project properties. I finally came across something called “Dependencies” that had big ugly red circles with an x in them. Ah ha. This is what tells the ViewController what other projects (like the business model project) this ViewController is dependent on. Although the editing process it not obvious I eventually pointed it to the new model project. [Deepening insight.]

      When I re-ran the test page it worked! Coffee finished. Story with a happy ending.

      1.     Make sure the package name in the ViewController DataBindings.cpx matches the one in your model project.
      2.     Make sure the ViewController Dependencies entry points to the model project.