Skip to Content
avatar image
Former Member

Question for WD model/NWDI experts

I have a WD that uses a JavaBean model. I'm trying to create a similar version of this application using NWDI. When I run the application, I am getting a runtime error as the framework tries to initialize my View controller - I get a NoClassDefFound on my model classes.

As follows:

My backend is a J2EE DC/application (jdidemo/maint/ejb). The J2EE app has an entity bean and a stateless session bean with CRUD operations (create, read, update, delete). The J2EE app defines a Data Transfer Object (named GreetingDTO) used as a return type or parameter type in some of the session bean's CRUD methods. The public part "client" (type compilation) contains the session bean and the GreetingDTO classes. The public part "ejbjar" (type assembly) contains everything.

My JavaBean model, defined in a Java DC (jdidemo/maint/java), has a business delegate class, named GreetingBizDelegate, that calls the J2EE session bean's CRUD methods and a JavaBean+command pattern class, named GreetingCommandBean. GreetingCommandBean has two properties, one typed as a single GreetingDTO, one a collection of GreetingDTOs. It also has "commands" (methods) that call methods in the GreetingBizDelegate. jdidemo/maint/java uses the "client" public part of jdidemo/maint/ejb (I also defined it to use the "ejbjar" pp, though I don't think it needs it). jdidemo/maint/java defines a pp "build" with the GreetingCommandBean as entity and a pp "assembly" with both GreetingCommandBean and GreetingBizDelegate as entities. [Note: I have designed the overall application in conformity with the 2006 TechEd CD 263 session, <i>Web Dynpro Best Practices for Connecting to Java APIs</i>.]

My WD DC/project (jdidemo/maint/wd) uses "client" and "ejbjar" from jdidemo/maint/ejb and "build" and "assembly" from jdidemo/maint/java. I can import the JavaBean model, establish the model relations, and do the context-to-model binding fine (I am using a custom controller to do this). In that state, I can build, deploy, and run the application without problems.

But when I do the context mapping of the GreetingCommandBean model class to my View, though the application builds and deploys fine, I get a WD runtime error NoClassDefFound for GreetingCommandBean. The line of code causing the error is the InternalMainView line initializing the View's context (currentGreeting is the model property typed as GreetingDTO):

    infoCurrentGreeting = GCIContext.createMappedNode("CurrentGreeting", com.ibm.nwdi.demo.ejb.dto.GreetingDTO.class, true, false, false, ".JavaBeanModelCust.GreetingCommandBean.CurrentGreeting", true, true, null,
      new IGCIAttributeInfo[] {
        GCIContext.createMappedAttribute("maintdate", "maintdate", false),
        GCIContext.createMappedAttribute("greeting", "greeting", false),
        GCIContext.createMappedAttribute("author", "author", false),
        GCIContext.createMappedAttribute("number", "number", false),
      },
      (IGCINodeInfo[])null // no child nodes
    );

I have never had this problem before, where the model import and component-model binding work fine (at design time and runtime) -- so the model classes are obviously recognized -- but context mapping the same model classes to a View causes the problem described.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Dec 13, 2006 at 09:39 AM

    Randy,

    Seems that class com.ibm.nwdi.demo.ejb.dto.GreetingDTO.class available at compile-time but not available at run-time.

    Verify Used DCs in WD components. Most probably DC with aforementioned class has only "built-time" dependency. Then just open properties of WebDynpro project, go to References and add reference to EAR with class.

    Valery Silaev

    SaM Solutions

    http://www.sam-solutions.net

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Valery. Yes, clearly the model class is available at compile-time but not at run-time. My Web Dynpro DC has a Used DC dependency on the "ejbjar" public part (purpose assembly) as well as the "client" public part (purpose compile) of the J2EE EJB Module DC containing GreetingDTO. I though the dependency on the pp of type assembly would satisfy the runtime.

      Also I don't get the following: The runtime error only occurs if I do the context mapping of the model classes from my custom controller to the view. If I eliminate that mapping, but retain the context-to-model-binding in my custom controller, I get no runtime error (unfortunately, I also don't get the desired application functionality!). Perhaps custom controller has a lazy initialization and hasn't been instantiated yet when the view is first displayed.

      I think I have done everything you suggest but will check again. Unfortunately, we have now started an upgrade of our NWDI from NW '04 to NW 2004s, so my development activity is temporarily on hold.

  • avatar image
    Former Member
    Aug 30, 2007 at 10:30 PM

    Randy,

    Did you get a solution to your problem ?? I am having a simillar issue while migrating an ejb from NW 2004 to NW 2004s. The webdynpro application which is trying to call an ejb is giving a classnotdefined exception (though the class is available in the public part - ejbjar (assembly)). The compilation and deployment is just fine, the app is failing at the runtime. Any help is greatly appreciated.

    Thanks,

    Rama

    Add comment
    10|10000 characters needed characters exceeded