Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

Hi all,

in this blog I want to share some details for implementing two workarounds for referencing the EJB DC from the Standalone Portal Application DC in NWDI for 7.3 development.

The reason for the workarounds is very good described by krum.bakalsky in one of the answers to this question: http://scn.sap.com/thread/1900441

Short description: The Portal DC and EJB DC have different Java EE versions (Portal DC => 1.3 and EJB  => 1.5)

In my case I faced a little bit different error message during deployment as in the question I mentioned above :

* EJB Model Builder: "META-INF/ejb-jar.xml" not found. For applications prior Java EE 5 this file is mandatory in EJB modules.[message resource bundle missing], file: btexx.com~frwk~ejb.jar#META-INF/ejb-jar.xml, severity: error

The corresponding ejb-jar.xml was missing at all. It was simply not generated, since I created the EJB via EJB Wizard of the SAP NWDS and the file is not required from Version 5 of Java EE. The deployment of the corresponding EAR file was successful, but the deployment of the Portal Application which referenced the EJB DC failed with the error message above.

To avoid such errors there are two workarounds:

Workaround 1: Remove the reference for the EJB public part of type ASSEMBLY

Workaround 2: Align the versions of both DC components.

In following I want to describe the steps to implement these workarounds in some more details. 

Note: The first workaround is a preferred solution from my opinion, because I can't really estimate the risks of potential problems which can come after the aligning the portal application version to 1.5 (aligning ejb version to 1.3 is useless, since it would mean a step in the past of the java enterprise development :smile: ). However both workarounds worked for me. 

Workaround 1: Remove the reference for the EJB public part of type ASSEMBLY

The EJB DC should normally have already two public parts after creation:

  • client (of type COMPILATION)
  • ejbjar (of type ASSEMBLY)

If you create a dependency to the EJB DC you should disable the reference to the "ejbjar" public part (just uncheck the "Build Time" property in dependency details):


As a result the jar file of the EJB DC will not be included in the generated deployable artifact of your portal applications (you can check it in <DC project name>/gen/default/deploy/<name>.sda) and the next deployment should be successfull.

Workaround 2: Align the versions of both DC components.


The other workaround requires the update of the application.xml file in the generated sda artifact of your Portal application. The generated file by default looks like this:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">

<application>

...

</application>

Indeed for the Java EE 5 applications the content of the application file should be:

<?xml version="1.0" encoding="UTF-8"?>

<application xmlns="http://java.sun.com/xml/ns/javaee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="5"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/application_5.xsd">

...

</application>

This change can be accomplished with following steps:

  1. Extract the file application.xml from <Portal DC project name>/gen/default/deploy/<name>.sda/META-INF
  2. Change the schema as shown above
  3. Create META-INF folder under the root folder of your Portal Application DC project and place the modified file there
  4. Add the newly created META-INF folder as a resource root in DC configuration:

5. Build and deploy the DC

I hope this information will be helpful for all which want to combine the portal and JEE development in the projects. Happy coding! :smile:  

Best regards,

Artem

13 Comments
Labels in this area