Deploy Apache ESME on NetWeaver CE 7.2
Another blog that I wrote in 2011, and never managed to publish on SCN. It may have been a time problem, logon problem or usability problem, honestly I do not remember anymore. Publishing content at my site is way easier for me, so I decided to publish it here. The actual value of the blog is close to nothing. ESME is dead, CE7.2 is on life support and no one will use this technology today. But as I`ve written the content, I`ll publish it anyway. Please note that I did not review the content for correctness. It is as I have found it on my hard drive. I hope I did everything right in 2011.
NetWeaver AS Java is a J2EE server that can be used to deploy more than just SAP applications. In this blog I will show how to deploy a 3rd party WAR: Apache ESME using NWDS. For most Java developers and IT organizations NetWeaver only serves for installing, developing and deploying SAP applications. For everything else another J2EE server is used. That NetWeaver is a full J2EE server and can be used for deploying web applications in the WAR format is mostly ignored. This prejudice comes from the time when NetWeaver Java was associated with NetWeaver 2004(s), that indeed lacked some essential features. But with the latest release (7.2, 7.3) NetWeaver is a standard compliant J2EE server that offers at least the same features as JBoss or Tomcat. To demonstrate that, I will deploy the Apache ESME WAR on NetWeaver CE 7.2. Using that project is interesting, as it not only shows that 3rd party WAR can easily be deployed but also that SAP JVM 6 can run Scalar applications.
To generate the WAR file for ESME get the source from the project homepage and use maven to compile it. This generates the WAR file that needs to be deployed, including all the compiled Java files (class) in the JAR files. The project page states that you can use the tool, but when you do not have access to the CE server, want to integrate it into an EAR project or alter the configuration you’ll have to use NWDS.
First, create an EAR project. Then import the WAR file and assign it to the EAR project.
ESME is using several 3rd party JAR files
In my case, the import report shows no errors, but the import wizard finishes with an error. What gets imported are the project structure and the class files.
The import didn’t include the 3rd party jar files. Either you add them to the web project or make sure they are accessible on the server. Here I will import them directly in the web project. It’s just drag and drop. Open the original WAR file in your ZIP manager and copy the JAR files form WEB-INF/lib. Same for the other files ESME includes in the WAR file that NWDS is not importing. Copy the resulting files to WebContent/
Next is to adjust the web.xml file. Copy the content of the original web.xml file. As the web site states, adjust the resource-ref part. ESME needs a database connection to store its data, so a data source alias has to be made available that ESME can use. Theoretically every database that supports ESME’s JPA mechanism can be used. I ran into problems while trying to use the system DB as you’ll first have to adjust the JPA files of ESME to work together with SAP. It’s easier to use another DB for ESME. Just make sure that the resource exists and is working. I used Apache derby as DB.
<display-name><your display name></display-name>
<description>The filter that intercepts lift calls</description>
Now add the EAR project to an SAP server and deploy it. During deploy of the EAR file the WAR file will be automatically created and added.
Result: Apache ESME running on CE 7.2