cancel
Showing results for 
Search instead for 
Did you mean: 

Pointing to internal DTDs

Former Member
0 Kudos

Hello Experts,

I have a web application with two projects (web appl. project and enterprise appl. project). NDS automatically generates deployment descriptors web.xml and application.xml.

These files have the following code


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                         "http://java.sun.com/dtd/web-app_2_3.dtd">...........
------------------------AND-----------
<?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">....

I am trying to change both the files to point to dtds hosted on our company's internal server. They are the exact same DTDs that are at the sites(java.sun.com) found in the default deployment descriptor.

I get a deployment time error as mentioned below


java.lang.RuntimeException: ERROR: Cannot initialize EARReader: com.sap.engine.services.deploy.exceptions.BaseEarException: EAR C:usrsapJ2EJC00SDMrootoriginsap.comTestDBlocalhost2006.02.13.15.53.45temp36342TestDB.ear is not J2EE 1.2 compliant and cannot be converted to J2EE 1.3.Exception is: com.sap.engine.services.deploy.exceptions.BaseEarException: EAR C:usrsapJ2EJC00SDMrootoriginsap.comSamplelocalhost2006.02.13.15.53.45temp36342Sample.ear is not J2EE 1.2 compliant and cannot be converted to J2EE 1.3.
	at com.sap.engine.services.deploy.converter.EARConverter.convert(EARConverter.java:102)
	at com.sap.engine.deploy.manager.DeployManagerImpl.setEar(DeployManagerImpl.java:444)
....
...

As you see, it says its not of compatible version. I made sure that the DTDs are same. I even tried placing the DTDs internal to the deployment descriptors to confirm they are correct and they infact did deploy fine then.

Is there a reason why its saying so?

Thanks in advance,

Kiran

Accepted Solutions (1)

Accepted Solutions (1)

former_member184385
Active Participant
0 Kudos

Kumar,

leave the DTD definitions alone. Unless use change the entity resolvers, which check this DTDs, you shant change them!

Note: DTD definitions are like prefix/namespace definitions in xml. This is just a convention, there is no access to the urls mentioned there!

Regards

Gregor

Former Member
0 Kudos

Gregor,

I think you are right as I remember working on my laptop not connected to the internet and still able to deploy/run my web applications which have their descriptors pointing to an internet site like java.sun.com

Thank you,

Kiran

Former Member
0 Kudos

I still feel that the parser while parsing the application.xml does validate against the DTD hosted on java.sun.com as our application did fail to deploy once before when we couldn't reach the java.sun.com for some technical reasons.

There have been discussions about this here<u>http://www.xml.com/pub/a/2000/11/29/deviant.html</u> which has other links in it talking extensively about the problems with PUBLIC and SYSTEM identifiers referencing to DTDs on external websites.

Theoritically, XML 1.0 specifies that the parser should first derefence the PUBLIC identifier and in case it cannot find any associated URI, it should then use the SYSTEM identifier to access the DTDs. Unfortunately, the spec makes this optional, making this all more complex as each vendor implements its parser in this own way.

The solution as described is to use an Entity Management System with a resolver and catalog files to save DTDs on the application server and use them instead of depending on the network to validate your xmls against DTDs. Some servers like WebLogic provide such kind of features where in the server also provides caching of these DTDs.

I was wondering if such kind of support is offered by SAP WAS 6.40. I tried finding documentation related but to couldn't find any.

If anyone can through some light into this issue, that would be greatly appreciated.

Thanks,

Kiran

Answers (2)

Answers (2)

former_member184385
Active Participant
0 Kudos

Kiran,

I'm really surprised by your findings.

My knowledge about DTD handling roots from reading source code of struts and other OSS. There, DTD's public IDs were used, to mark a certain version of the following xml document, as should be the case for WDDs too. This way, the xml document processor, not necessarily the xml parser, is able to handle different version of xml document.

Struts and the other packages always had the DTD, though having its public IDs in the form of WWW URLs, somewhere internal to the software, accessible to the class loader. I wonder then, if SAP's WDD handling code is behaving here differently?

Regards

Gregor

Former Member
0 Kudos

Gregor,

Thanks for your time. What exactly do you mean by WDD?

As I said, my findings are from reading different articles and trying few things in my local server and I might not be accurate.

I just wonder why changing the system identifier from "http://java.sun.com/dtd/application_1_3.dtd" to "http://MyCompany/dtd/application_1_3.dtd" in the application.xml doesn't work when both the DTDs are same.

Regards,

Kiran

former_member184385
Active Participant
0 Kudos

Kiran,

the system id is like a contract, where

- the client (xml document author) states, that his document complies to the mentioned DTD

- the server reads the DTD id (not the DTD content) and checks, whether it can support the following document, complying to the mentioned DTD id (aka. document version).

Key is here the DTD id not the DTD content, that's why producing a different DTD id with an equal content doesn't work. afaik, the xml parser doesn't go through the trouble, checking the xml document structure against the stated dtd. I wonder if there are processors, which can do that at all. afaik this was one of the reasons, why xml schema was introduced.

Regards

Gregor

BTW. An Analogy from the Java world would be the == operator and the equals method.

PS. WDD = web deployment descriptor (not something you wouldn't know yourself already)

Former Member
0 Kudos

Upon doing some research, I found that the public identifier <b>"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN</b> by default points to <b>http://java.sun.com/dtd/web-app_2_3.dtd</b> and simply replacing the URL doesn't suffice.

The resolution is to write up a catalog file with key/value pairs or public-identifier/uri. But, I am not sure where this catalog file needs to be placed on the SAP NetWeaver Application Server. I couldn't find any 'How to..' document. Any pointers appreciated.

Thanks,

Kiran