How to reference the MDM Java API during development and runtime
Although there are several ways to include
and reference the MDM Java API in your Java projects, I am describing here the best practice of doing it.
Typically your Java application will be
deployed on the SAP NetWeaver Application Server, either as a J2EE or Web
Dynpro application. The JAR files of the API should not be included in the application archive itself, but rather
referenced only – both during development and runtime. The API is deployed as a library on the application server.
This gives you the possibility to easily update the API:
- On the application server by simply deploying a new version of the API.
This can be done by an admin without the help of a developer.
- On the machines used for development without the need to update several projects.
Download the MDM Java API
.zip on the installation
media you received. You can download it also, especially important after an
update of the MDM Server, from the SAP Service Marketplace: http://service.sap.com/swdc
-> Support Packages and Patches
-> Entry by Application Group
-> SAP NetWeaver
-> SAP MDM
-> SAP MDM 5.5
-> MDM JAVA API
During development in NWDS
Unpack the archive with the JAR files and
the Javadoc of the MDM Java API on your PC. Copy or move all the JAR files into any folder. Always use the same folder
name every time you update to a new version. Example folder name: C:\MDMJavaAPI
In the Preferences dialog of the
NWDS, go to Java – Classpath Variables and create a new variable with the
name SAP_MDM_JAVA_API and the path set to the folder of step 1.
In the properties dialog of your NWDS
project, go to Java Build Path – + Libraries +and
add each JAR file of the API using the Add Variable button. You
need to select the variable created in step 2, click on Extend and
select all 6 JAR files (+mdm4j.jar, mdm-admin.jar,
mdm-common.jar, mdm-core.jar, mdm-data.jar, mdm-protocol.jar+).
If you are developing an J2EE
application: Open the deployment descriptor application-j2ee-engine.xml
and create a reference to the MDM Java API using the values:
– Reference target: com.sap.mdm.tech.mdm4j
– Reference type: hard
– Reference target type: library
– Provider name: sap.com
If you are developing a Web Dynpro
application: Open the properties dialog of the project, go to +Web
Dynpro References+ – Library References and add a new entry for the MDM Java
API using the name com.sap.mdm.tech.mdm4j.</li>
Deploy on the application server
Deploy the MDM Java API using the SCA named