cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate SAP_MANIFEST.MF using Ant

Former Member
0 Kudos

Hi,

I am trying to migrate a J2EE application to SAP j2EE Engine from JBoss AS. We already have an extensive Ant build file that builds .war for Tomcat, .ear for JBoss etc. I would like to modify this build file so it can also build a .ear for SAP.

I have spent quitte some time browsing the forums and I saw some suggestions that there is an Ant task that I could use:

com.sap.sdm.ant.JarSAP

However, I cannot find this class in SDM.jar of SAP 6.40... Has this class been removed? Am I looking for it at the wrong place? Is there a better way to build an ear for SAP? I don't want to use the SAP build tools because we already have a working Ant script and we need to support multiple application servers, not just SAP.

Any help would be greatly appreciated (and rewarded with points :).

-Stijn

Related forum topics:

-


Creating SDA's (or other suitable archives) using ANT

Deployable DC's

Building EAR-files with ANT

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Its not advisable to create SAP_MANIFEST.MF since

SAP_MANIFEST.MF contains only information for SAP's software logistic process. It is not designed to be changed or created , because the format may change in the future

Alernative approach would be to use deploy tool or EAR Generator tool for ear generation which you could easliy integrate with ant.

Here is the link for that http://help.sap.com/saphelp_nw04/helpdata/en/c1/f6a282078245e99654b99ffb13c508/frameset.htm

Hope this helps , if yes please dont forget to reward suitable points

regards

rajeshkr

You can find the help

Former Member
0 Kudos

Thanks Rajesh!

I'd like to reward your answer but the radio buttons are not appearing?

I'd like to use eargenerator.bat. I copied entire directory 'deploying' to our build dir, but it doesn't work:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sap/engine/offline/OfflineToolStart

I need to be able to build the .ear 'offline', on the developers machine. The developer will possibly not have SAP installed... Is there some jar I need to include? Or is it not possible to build the ear without SAP tools?

Former Member
0 Kudos

Never mind, it was just a wrong path...

I have it running now, but the .ear that is generated cannot be deployed to SAP:

Summary:
========
  There were 1 archives selected.
  0 archives successfully loaded.
   Loading of 1 archives failed.

Details:
========
1) Error loading archive 
    C:stijnwbackend.ear
    (server side name is: C:stijnwbackend.ear)
    com.sap.sdm.util.sduread.IllFormattedSduFileException: The information about the development component 
found in the SDA C:stijnwbackend.ear is either missing or incomplete!
Manifest attributes are missing or have badly formatted value:
attribute keylocation is missing
attribute keyname is missing
attribute keyvendor is missing
attribute keycounter is missing
------------------------------------------------------

How do I tell the eargenerator to generate SAP_MANIFEST.MF? It is not in the generated .ear...

-Stijn

Former Member
0 Kudos

I am now able to run the eargenerator tool. However, inside the generated .ear, there is no SAP_manifest.mf. I have studied the DTD for eargenerator-config.xml, but I don't see how I should instruct eargenerator to include a sap_manifest.mf inside the generated .ear...

Here is my eargenerator-config.xml:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE ear-generator [
<!ELEMENT ear-generator (ear)+>
<!ELEMENT ear (project-dir?, pathname, displayname, small-icon?, large-icon?, description?, (jar|war|client|file|rar)+)>
<!ELEMENT project-dir (#PCDATA)>
<!ELEMENT jar (pathname, entryname, is-loaded, altdd*)>
<!ELEMENT war (pathname, entryname, contextroot,is-loaded, altdd*)>
<!ELEMENT client (pathname, entryname, is-loaded, altdd*)>
<!ELEMENT file (pathname, entryname)>
<!ELEMENT rar (pathname, entryname, is-loaded, altdd*)>
<!ELEMENT altdd (pathname, elname)>
<!ATTLIST altdd use-alternative (yes|no) #REQUIRED>
<!ELEMENT elname (#PCDATA)>
<!ELEMENT pathname (#PCDATA)>
<!ELEMENT entryname (#PCDATA)>
<!ELEMENT displayname (#PCDATA)>
<!ELEMENT small-icon (#PCDATA)>
<!ELEMENT large-icon (#PCDATA)>
<!ELEMENT description (#PCDATA)>
<!ELEMENT contextroot (#PCDATA)>
<!ELEMENT is-loaded (#PCDATA)>
]>

<ear-generator>
  <ear>
    <project-dir>
      C:StijnSAP integrationWMtmp
    </project-dir>
    <pathname>deploy/backend.ear</pathname>
    <displayname>WM83 backend</displayname>
    <file>
      <pathname>BACKEND.MF</pathname>
      <entryname>META-INFMANIFEST.MF</entryname>
    </file>
    <war>
      <pathname>deploybackend.war</pathname>
      <entryname>backend.war</entryname>
      <contextroot>web</contextroot>
      <is-loaded>false</is-loaded>
      <!--  altdd use-alternative="yes">
        <pathname>nowNeptun_jarAltDD.xml</pathname>
        <elname>Helper</elname>
      </altdd -->
      <!-- altdd use-alternative="yes">
        <pathname>nowNeptun_jarAltDD.xml</pathname>
        <elname>Neptun</elname>
      </altdd -->
    </war>
  </ear>
</ear-generator>

What am I missing here? Since eargenerator generates ears for SAP I would expect it to include sap_manifest.mf, but it doesn't. Should I provide it with one? Any tips would be greatly appreciated.

-Stijn

Former Member
0 Kudos

Hi

You will have to provide all the SAP_MANIFEST.MF location, the eargenerator does not generate it.

Alernatively you can find the JarSAP related jars in

the plugins folder of the NWDS(

C:\Program Files\SAP\JDT\eclipse\plugins\com.sap.ide.eclipse.jarsap\lib). Not very sure how to use

this. also let me know if you could get use it .

Hope this helps .Please do not forget to reward ponts ,if helpful

regards

rajeshkr

Message was edited by: Rajesh K. R.

Former Member
0 Kudos

Thanks Rajesh, I'll check out JarSAP and let you know if/how it works out.

There must be some problem with the point rewarding system because today I can reward points and previously I could not. I gave both your answers points. Thanks!

I still wonder, in your first message you said: "Its not advisable to create SAP_MANIFEST.MF ... It is not designed to be changed or created..."

So if I should not create it myself and eargenerator does not create it either, then where should I get it from? At the moment I am guessing JarSAP?...

-Stijn

Message was edited by: Stijn de Witt

Former Member
0 Kudos

Hi

I tried to use JarSap , but it only returns the version info , unfortunately there is no documentation for that .

Regarding the statement :"Its not advisable to create SAP_MANIFEST.MF ... It is not designed to be changed or created..." - SAP does not recommend creation or edition of SAP_MANIFEST.MF as its used internally only for SAP sepcific components.

Alternatively You could try using the SAP_MANIFEST.MF file created by the EAR generation in the NWDS for eargenerator tool.

Hope this helps , if not you could raise a query to the SAP customer support regarding this .

Please donot forget to reward points if you find it helpful .

regards

rajeshkr

Former Member
0 Kudos

Stijn,

Are you already successfull in generating the ear file?

If yes, I would love to know the solution.

Jan

Former Member
0 Kudos

I can generate the ear file, but at the moment I am manually (!!) adding sap_manifest.mf and other sap-specific config files to it...

I am disappointed that I have not been able to find a tool / ant-task which does the job of generating these files. At the moment I have a bunch of hand-written (! If you happen to find any, please let me know!

With kind regards,

-Stijn

Former Member
0 Kudos

I agree.

What I have done to generate the manifest files from an ant task, and simple use the zip task to make the ear file. But it is producing the files I need. So for me it's okay now.

Herewith I provide you (and all others who wnat to use ANT for EAR and Deploy) with my files. You can easily adapt them to your own needs.

BUILD.XML

[code]

<project name="BoonApp" default="build" basedir="d:\my projects\SAP\BoonApp">

<description>

Deploy BoonApp Application to SAP Web AS

</description>

<property name="deploy.base.dir"

location="c:\usr\sap\j2e\jc00\j2ee\deploying" />

<property name="deploy.lib.dir"

location="${deploy.base.dir}\lib" />

<property name="deploy.manager.config"

location="$\deploy-manager-config.xml" /> <property name="earfile" value="${ant.project.name}.ear" /> <property name="jardir" value="d:\my projects\SAP\Boon" /> <!-- ============================================= Build the EAR file ============================================= --> <target name="ear" depends="checkearuptodate" unless="ear.uptodate"> <tstamp> <format property="buildTime" pattern="yyyy.MM.dd.hh.mm.ss"/> </tstamp> <manifest file="META-INF\MANIFEST.MF"> <attribute name="Implementation-Title" value="${ant.project.name}"/> <attribute name="Specification-Vendor" value="SAP AG"/> <attribute name="Implementation-Vendor-Id" value="mycompany.com"/> <attribute name="Implementation-Version" value="$"/> </manifest> <manifest file="META-INF\SAP_MANIFEST.MF"> <attribute name="Ext-SDM-SDA-Comp-Version" value="1"/> <attribute name="softwaretype" value="J2EE"/> <attribute name="JarSAP-Version" value="20041217.1600"/> <attribute name="JarSAPProcessing-Version" value="20060104.1634"/> <attribute name="deployfile" value="sda-dd.xml"/> <attribute name="keyname" value="${ant.project.name}"/> <attribute name="keyvendor" value="mycompany.com"/> <attribute name="keylocation" value="localhost"/> <attribute name="keycounter" value="$"/> <attribute name="componentelement" value="&lt;componentelement name=&quot;${ant.project.name}&quot; vendor=&quot;sap.com&quot; componenttype=&quot;DC&quot; subsystem=&quot;NO_SUBSYS&quot; location=&quot;localhost&quot; counter=&quot;$&quot; deltaversion=&quot;F&quot; updateversion=&quot;LB-20060523162952&quot; componentprovider=&quot;localhost&quot;/&gt;"/> <attribute name="JarSL-Version" value="20060106.1831"/> <attribute name="compress" value="true"/> </manifest> <echo file="META-INF\sda-dd.xml" message="&lt;SDA&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;SoftwareType&gt;J2EE&lt;/SoftwareType&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;engine-deployment-descriptor version=&quot;2.0&quot;&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;variable-name&gt;com.sap.dc_name&lt;/variable-name&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;variable-name&gt;com.sap.dc_vendor&lt;/variable-name&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;variable-name&gt;com.sap.sld.GatewayHost&lt;/variable-name&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;variable-name&gt;com.sap.sld.GatewayService&lt;/variable-name&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/substitution-variable&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/engine-deployment-descriptor&gt;" /> <echo file="META-INF\sda-dd.xml" append="true" message="&lt;/SDA&gt;" /> <zip destfile="$"> <fileset dir="$" includes="*/.jar" /> <fileset dir="$"

includes="META-INF/**"/>

</zip>

<delete file="META-INF\sda-dd.xml" />

<delete file="META-INF\MANIFEST.MF" />

<delete file="META-INF\SAP_MANIFEST.MF" />

</target>

<!--

=============================================

Deploy the EAR to the Web AS

=============================================

-->

<target name="build" depends="ear" unless="ear.uptodate">

<java dir="${deploy.base.dir}"

classname="com.sap.engine.offline.OfflineToolStart"

fork="yes">

<arg value="com.sap.engine.deploy.manager.DeployManagerImpl" />

<arg value=";.\lib"/>

<arg value="${deploy.manager.config}"/>

<classpath>

<pathelement location="${deploy.lib.dir}/launcher.jar"/>

</classpath>

</java>

</target>

<!--

=============================================

Check if the EAR file is up to date

=============================================

-->

<target name="checkearuptodate">

<condition property="ear.uptodate">

<and>

<uptodate targetfile="$"> <srcfiles dir="$" includes="*/.jar" /> </uptodate> <uptodate targetfile="$">

<srcfiles dir="META-INF"

includes="*" />

</uptodate>

</and>

</condition>

</target>

<!--

=============================================

Rebuild and deploy the BoonApp application

=============================================

-->

<target name="rebuild"

depends="clean, build">

</target>

<!--

=============================================

Clean the EAR file up to force a rebuild

=============================================

-->

<target name="clean">

<delete file="$" />

</target>

</project>

[/code]

And this is the contents of the deploy-manager xml file

[code]

<deploy-manager-config>

<version-id></version-id>

<project-dir></project-dir>

<deployable-object action-type="deploy">

<ear-file>

<ear-path>d:\my projects\SAP\boonapp\boonapp.ear</ear-path>

</ear-file>

</deployable-object>

<login-info>

<host>192.168.0.35</host>

<port>50004</port>

<transport-protocol>None</transport-protocol>

<user-name>Administrator</user-name>

<user-password>mylittlesecret</user-password>

</login-info>

<user-role-mapping>

<role-name>unknown role</role-name>

</user-role-mapping>

<library-info></library-info>

<supports>

<support>p4</support>

</supports>

<deployment-properties>

<property></property>

</deployment-properties>

<repl-var-properties></repl-var-properties>

<log-file>d:\my projects\SAP\boonapp\deployer_log.txt</log-file>

</deploy-manager-config>[/code]

Answers (1)

Answers (1)

Former Member
0 Kudos

Thanks Jan, this is very helpfull. I rewarded you 10 points.

-Stijn

Former Member
0 Kudos

Aargh...my first points!!

That really proves that I am slipping down to the SAP world.

C# and .Net are damping down to sweet memories.

I am smashing up my life....