cancel
Showing results for 
Search instead for 
Did you mean: 

Dependencies between J2EE Library DCs

Former Member
0 Kudos

Hi there

I'm currently working on a project for my university using NWDI. I created two J2EE Server Component Library DCs (A and B) which contain one Java DC each to implement the library's logic. This works without any problems. Now i want to reference library B from library A. Therefore i created two public parts in the Java DC contained in library B (compilation and assembly). Then i imported the public parts as Used DCs in library A. The libraries deploy without any problem but I get a ClassDefinitionNotFound / Runtime Exception when I run my application.

Is it possible to create references between two J2EE Server Component Library DCs? If yes, how do I implement this?

Thanks in advance

Message was edited by:

Christian Gaege

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Christian,

in your J2EE Library A you should define J2EE Library B as "Used DC". Make sure the usage is "at runtime" and probably "at deploytime" (to ensure that A cannot be deployed without B.).

Regards,

Marc

Former Member
0 Kudos

Hi Marc,

thank you for your answer.

I did exactly what you say. Library A has a use depency on Library B at compiletime, deploytime and runtime.

I've deployed both libs successfully.

But when I want to use Library A from an EJB (which has a hard reference to Library A set in application-j2ee-engine.xml), i get the following exception when i want to deploy the ejb:

>java.rmi.RemoteException: Error occurred while starting application >fh-furtwangen.de/credit/access/ear and wait.

>Reason: Clusterwide execption: server ID 3913950:Application fh-furtwangen.de/creditaccessear >cannot be started. Reason: it has hard reference to resource fh-furtwangen.decreditlogic with type >library, which is not active on the server.

fh-furtwangen.decreditlogic is Library A (which is already deployed!). The strange thing is:

When i delete the dependency between Lib A and Lib B, I am able to deploy the ejb sucessfully.

In this case, i can use Library A from the EJB at runtime, but when Library A wants to use Library B, a ClassDefNotFoundException occures.

Any ideas?

Thanks,

Christian

Former Member
0 Kudos

Hi Christian,

just for fun I'd try what happens if the EAR only defines a "weak" reference to the library, but I don't think that will work... You could of course assemble both Java DCs into the same J2EE library.

Since this is an issue with the j2ee server itself, not specific to JDI, I'd ask in one of the other forums. From my understanding runtime dependencies should be transitive and if the dependency on B somehow makes A inactive I'd check the deployment logs for library A, but in general I would expect your scenario to work.

Regards,

Marc

Former Member
0 Kudos

Fire up the Visual Administrator for the server in question, and start the Classloader View. Find your library, and see that it does indeed have the correct reference. Make sure you can expand the application details - if you see 'Object not Initialized' or something like that, the object has NOT been deployed correctly.

Do the same for the J2EE application. You should be able to track down what the issue is.

From the error message, I'm thinking that one of the libraries is not deployed. Check under the Libraries tab in the VA to ensure that the library is indeed deployed.

BTW, references are NOT transitive. A -> B, B -> C does NOT imply that A -> C. In other words, if your J2EE application uses both A and B libraries, it must have explicit references to both, even though A references B. See this document for more on class loading in the Java stack:

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/1edf5078-0801-0010-2889-b21...

Former Member
0 Kudos

Hi Ken,

thank you very much for your answer. I will check this and post the results soon.

Cheers

Christian

Answers (0)