cancel
Showing results for 
Search instead for 
Did you mean: 

JAX-WS 2.1.3 on NetWeaver CE 7.1 SP3

Former Member
0 Kudos

Is it possible to override the JAX-WS implementation provided by NetWeaver 7.1 SP3 using the “heavy resources” classloader?

On JBoss, using a different runtime implementation for JAX-WS as that of JBoss is not a problem. You can correctly use the class loader hierarchy to solve this problem.

I need JAX-WS 2.1.3 because I’m using its streaming implementation for MTOM.

Thanks,

Radu

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Radu,

Did you ever get any further with this?

We are attempting to do the same, but are running into difficulties when deploying - for some reason the classes cannot be compiled once they hit the server....

Did you find the same issue, or were you able to get it working ok?

Regards,

Andrew

Former Member
0 Kudos

Hi Andrew,

I've deployed the JAX-WS 2.1.3 jars inside the library-container of NetWeaver and then I've used a new "child-first" class loader to load all these jars together with web services entry points. This class loader is activated by new WSServlet and WSServletContext implementations. Pretty complex.

Regards,

Radu

Former Member
0 Kudos

Hi Radu.

I`ve faced with exactly same problem. Times went by, but maybe you have some code examples of WSServlet and WSServletContext implementations with classloading?

Thanks in advance.

Best regards, Sergey.

Former Member
0 Kudos

Hi Sergey,

the current solution is to use the "Heavy Class loader" of NetWeaver to load the binaries of JAX-WS before the binaries of NetWeaver's JAX-WS implementation.

Here is an extract of the documentation:

.....

Heavy class loaders load application classes with the highest priority.

How They Work

Heavy loaders work in the following manner:

  • They are created with the resources located in the lib folder in the root of the EAR or in the folder defined as a value of XML tag <library-directory>application.xml, only when the application version is Java EE 5. If the application is developed before Java EE 5, then the empty XML tag <enableHeavyClassloadingBeforeJavaEE5 />META-INF\applicaton-service.xml
  • It is the first in the parent list. This guarantees the following delegation order when loading a resource:
    • Heavy loader (and its parent, respectively)
    • Default references, specified by the containers during deploy. Usually contain the standard Java EE APIs.
    • Application-specific references (specified in the application-j2ee-engine.xml)
    • All other application resources contained in the EAR
Activating Heavy Loaders

To activate the heavy loaders:

.......


And you have to use in the calling components "prepend=true", like here:

<reference reference-type="hard" prepend="true">


You can use NetWeaver Telnet-Admin to get the class loader hierarchy for each deployed component and so to check if JAX-WS libraries are correctly loaded.


Regards,

Radu


Former Member
0 Kudos

Hi Radu.

Thanks for your answer! I`ve come up with Heavy classloader.

Now I can see appropriate record in Java Class Loader Viewer, the thread method getResource() for javax/xml/ws and javax/xml/bind returns the path of heavy classloader.

Generally I try to use Metro 2.3 framework inside the SAP Java proxy runtime. The JAX-WS 2.2.8 and JAX-B 2.2.7 are required to use this framework. The documentation talk that to use Metro I need to endorse (or in my case to load heavy) to libs jaxws-api.jar and jaxb-api.jar .

But when I try to run web-service I`ve got exception:

java.lang.RuntimeException: Method not supported

at com.sap.engine.services.webservices.espbase.client.jaxws.core.SAPServiceDelegate.createDispatch(SAPServiceDelegate.java:678)

at javax.xml.ws.Service.createDispatch(Service.java:361)

at MyClass.TrustPluginImpl.invokeRST(TrustPluginImpl.java:396)

at MyClass.TrustPluginImpl.process(TrustPluginImpl.java:120)

I`m quite confused with line "com.sap.engine.services.webservices.espbase.client.jaxws.coreSAPServiceDelegate.createDispatch". Looks like JAX-WS still refers to SAP ws libraries.

Maybe you have some suggestions about this issue?

Best regards,

Sergey.

Former Member
0 Kudos

Hi Sergey,

"heavy loading" only the interface jars is not enough. You have to "heavy load" the implementation jars too.

Here is an example of the provider.xml for jax-ws deployed as a NetWeaver library. Perhaps it helps you further...

<?xml version="1.0" ?>

<provider-descriptor>

.....

    <references>

        <reference type="library" strength="strong" provider-name="sap.com">servlet</reference>

        <reference type="library" strength="strong" provider-name="sap.com">ejb_api</reference>

        <reference type="library" strength="strong" provider-name="sap.com">javax~persistence~api</reference>

        <reference type="library" strength="strong" provider-name="sap.com">tc~je~portlet~plb</reference>

    </references>

    <jars>

        <jar-name>lib/FastInfoset.jar</jar-name>

        <jar-name>lib/gmbal-api-only.jar</jar-name>

        <jar-name>lib/ha-api.jar</jar-name>

        <jar-name>lib/javax.annotation.jar</jar-name>

        <jar-name>lib/javax.mail_1.4.jar</jar-name>

        <jar-name>lib/jaxb-api.jar</jar-name>

        <jar-name>lib/jaxb-impl.jar</jar-name>

        <jar-name>lib/jaxb-xjc.jar</jar-name>

        <jar-name>lib/jaxws-api.jar</jar-name>

        <jar-name>lib/jaxws-rt.jar</jar-name>

        <jar-name>lib/jaxws-tools.jar</jar-name>

        <jar-name>lib/jsr181-api.jar</jar-name>

        <jar-name>lib/management-api.jar</jar-name>

        <jar-name>lib/mimepull.jar</jar-name>

        <jar-name>lib/policy.jar</jar-name>

        <jar-name>lib/stax-ex.jar</jar-name>

        <jar-name>lib/stax2-api.jar</jar-name>

        <jar-name>lib/streambuffer.jar</jar-name>

        <jar-name>lib/woodstox-core-asl.jar</jar-name>

    </jars>

</provider-descriptor>

.....

Regards,

Radu

Former Member
0 Kudos

Hi, Radu.

That did the trick. Thanks again!

But now I`ve got following exception:

javax.xml.ws.WebServiceException: com.sun.xml.ws.policy.PolicyException: JAX-WS 2.1 API is loaded from file:/usr/sap/server/DVEBMGS00/exe/sapjvm_6/jre/lib/rt.jar, But JAX-WS runtime requires JAX-WS 2.2 API. Use the endorsed standards override mechanism to load JAX-WS 2.2 API

This strange, because Metro framework tries to use libs from JVM, but not from heavy classloader.

Radu, have you even faced this problem? Is the endorsed standards override mechanism applied to SAP JVM?

Best regards,

Sergey.

Former Member
0 Kudos

Hi Sergey,

I suppose that the deployed application which calls your new "JAX-WS 2.2" library (which now contains the APIs and the implementation jars) doesn't use "prepend=true" in its "application-j2ee-engine.xml" configuration file.

The other metro jars should be contained in this application and not in the new JAX-WS 2.2 component library.

Here is a sample of such a file ("my-jaxws" is the name of the new JAX-WS library component) :

...

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

<application-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">

  <reference reference-type="hard" prepend="true">

    <reference-target provider-name="xxx.com" target-type="library">

           my-jaxws

    </reference-target>

  </reference>

  <provider-name>xxx.com</provider-name> 

  <start-up mode="always"/>

</application-j2ee-engine>

......

Hope it helps!

Regards,

Radu

Former Member
0 Kudos

Hi, Radu.

Thanks for your answer.

The project has the following structure:

HeavyResources_EAR

Application_EAR

EJB

The HeavyResources_EAR contains JAX-WS libs.

The Application_EAR refers to EJB.

EJB contains Metro jars.

After compilation the Application_EAR contains ejb.jar and Metro jars.

The Application_EAR`s application-j2ee-engine.xml :

<application-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">

    <reference reference-type="hard" prepend="true">

        <reference-target provider-name="sap.com" target-type="application">HeavyResources_EAR</reference-target>

    </reference>

<provider-name>com.sap</provider-name>

<fail-over-enable mode="disable" xsi:type="fail-over-enableType_disable"/>

<start-up mode="always"/>

</application-j2ee-engine>

The attribute prepend="true" is incuded to application-j2ee-engine.xml. Also I note that NWDS 7.31 xml editor marks this attribute as red (wrong), but the application is deployed successfully.

What`s wrong with project structure?

Thanks.

Best regards,

Sergey.

Former Member
0 Kudos

Hi Sergey,

the EJB component (which contains the Metro jars) should also have a "prepend=true" reference to HeavyResources_EAR.

Here are some links regarding the NetWeaver "Heavy Loader" concept:

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60642a88-95fe-2b10-d387-a245d48fc...

Using Heavy Class Loaders - Developing Java EE 5 Applications - SAP Library

Specific Class Loading Use Cases - Developing Java EE 5 Applications - SAP Library

Using the Telnet admin application, you can check for each deployed component the class loader hierarchy.

I hope that your NW version doesn't have a "bug" regarding this issue...

Regards,

Radu

Former Member
0 Kudos

Radu,

thanks for links.


the EJB component (which contains the Metro jars) should also have a "prepend=true" reference to HeavyResources_EAR.

EJB is deployed as a part of EAR, so, I think, EJB can`t have reference to application.

Only application-to-application reference can be maintained.

So in my case Application_EAR with EJB has been already referenced to HeavyResources_EAR.

Or I`ve missed something important?

Best regards,

Sergey.

Former Member
0 Kudos

Hi Sergey,

   We have faced one problem which is similar with what you mentioned here. Our project is using a jax-ws library. We have built it successfully into Heavy Loader Library. However when we try to refer to those libraries in our EJB project it shows that Build Errors to indicate that the libraries are missing then the ejb project cannot be built and deploy to the server.

Pls. helps me with this problem. Thanks

Former Member
0 Kudos

Hi.

Is your EJB project linked to EAR project properly?

Please, check Java EE Module Dependencies in EAR project properties. All required libs should be checkboxed and in case of Heavy Class Loader should be checked as "In Lib Dir".

Then check Java EE Module Dependencies in EJB project properties. If EJB to EAR link is ok, all libs is showed as Available depended JARs.

Hope, this help.

Best regards,

Sergey.

Former Member
0 Kudos

Hi Sergey,

  Thank a lot for your suggestion. Actually our library JAX-WS 2.1.3 is successfully deployed in Server. I can see them in class loader. There are two points i think it causes the error:

1. JAX-WS library depends on some other libraries such as jabx, servlet, jsr  which are described in manifest of JAX-WS. We are using JAX-WS 2.1.3  and then we have to search in vain for corresponding dependency library which JAX-WS 2.1.3 is using but no luck. Finally we google them and add manually to library and Class Loader accepts them and we can deploy the jars into server. But i don't think it is the best way and can result in errors.

2. In ejb project J2EE perspective in NWDS we don't have application-j2ee-engine.xml but only ejb-j2ee-engine.xml. In normal process of development and deployment ejb in SAP Netweaver we have to build ejb project first then wrap it into DC to deploy on J2EE server application. How ever without the jars file we event can't compile the ejbproject. We have also tried to add refference to ejb-j2ee-engine.xml but the server's jar libraries does't appeare there in J2EE Module dependency.

Can you explain more detail how we can refer the JAX-WS jars to our ejb project and dependencies library?

Many great thanks

Best Regards,

Former Member
0 Kudos

Hi.

In my case I used EAR project instead of DC to deploy application, so application-j2ee-engine.xml was placed in META-INF directory automatically.

Also in my project i used JAX-WS RI, so all required jars had already been included in archive, I didn`t need to assemble jars.

I just added all jars to EAR project in lib directory (as Heavy ClassLoader), refered EJB project to EAR project and deployed EAR to AS.

Best regards,

Sergey.

Former Member
0 Kudos

Hi Sergey,

  You are rock, the problem has solved and now we can compile and deploy our project into server without any problems.

Thanks a lot, you saved me weeks of search.