cancel
Showing results for 
Search instead for 
Did you mean: 

Using Web Dynpro WDUrlGenerator from within J2EE Application deployed on NW

Former Member
0 Kudos

I have two applications deployed on a NetWeaver Application Server 2004s.

1. A Web Dynpro application.

2. A J2EE Application

What I want to do is to be able to build a url to the Web Dynpro application from within the J2EE application. Obviously the problem is using Web Dynpro classes within the J2EE application.

So I edited the Java Build Path of the J2EE application to include the werbdynproservices.jar file and exception.jar files by extending ECLIPSE_HOME variable in the libraries section. I also checked them in Order and Export. I verified the built .war file and it does contain the two .jar files.

This was sufficient to get my project build and deployed, however the servlet in my J2EE application shows NoClassDefFoundException when I run it. My guess is there's more I need to do to get the WDUrlGenerator to run in my J2EE class.

Is this possible or is there a better way? I am trying to avoid the client having to modify a web.xml for each depployment.

Thanks in Advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can create a mini WD component and add this component to your J2EE application. Add a method to the interface that returns the URL you need. Call this method to get the URL in your J2EE app.

You can also create a (WD) webservice to generate the URL. Deploy to the application server. The J2EE app can call this webservice.

Good luck, Roelof

Former Member
0 Kudos

I don't know how to add a Web Dynpro component to a J2EE application, any additional information on that would be helpful.

Another thought..

Is there anyway to execute some code within a Web Dynpro application on server startup? i.e. the code within wdDoInit() is called to initialize the controller / view. Is there anywhere to execute such code when the server starts up (like the load-on-startup parameter for a servlet).

Thanks.

Former Member
0 Kudos

Hi,

You can create the mini WD component in a seperate project.

Create the method you need to call from J2EE in the component's interface. (Implement the method in the controller)

Then, add the component to the public part.

In your J2EE project, add the component you created above to the used DC's. You should be able to call the WD created above.

For the second question: you can add a static block in your class:

static {

Code placed here is executed when the class is referenced for the first time.

}

Good luck, Roelof

Former Member
0 Kudos

Thank you very much for your assistance with this odd problem

Definitely getting closer, but not quite there yet. We aren't using NWDI, we're creating Web Dynpro Applications, so I don't have access to a "public part" as far as I know.

I put some code in a static block in my controller, and this code does get run the first time the application is launched, however it does not get executed on a server reboot. I still have to "touch" the application.

This code sets up a TimerTask which runs some background process once a day. I want this service to load on server boot up so the end user doesn't have to open a page or click a button to start the task.

This code for this background process is defined in a Web Dynpro application, thus my need to discover the URL for the web dynpro application. If the code in the static block was executed during the "Starting Applications" phase of the server bootup, this would have been perfect. But as it sits now, I still have to "load" the application in a browser to get this code to run.

Any ideas?

Former Member
0 Kudos

[http://help.sap.com/saphelp_nw04s/helpdata/en/94/0a5b422f786255e10000000a155106/frameset.htm]

Set startup mode in application-j2ee-engine.xml to "always"

Former Member
0 Kudos

This looks like what I want, but I am unable to test it.

I found the application-j2ee-engine.xml file under the <project-root>/gen_wdp folder. I then attempted to open it with the SAP EARDD editor. It opens with the Source tab selected. If I try to click the General tab I get an error saying:

"The source page has errors. Other pages cannot be used until these erros are corrected."

I see nothing wrong with the XML document. It's source is here:


<?xml version="1.0" encoding="UTF-8"?>
<application-j2ee-engine>
    <provider-name>local</provider-name>  
    <modules-additional>
    <module>
      <entry-name>EVENTS_WorkflowNotification.wda</entry-name> 
      <container-type>webdynpro</container-type> 
    </module>
  </modules-additional>
</application-j2ee-engine>

When I deploy the application, everything works fine. I was going to edit the XML document by hand, but of course there is no DTD listed so I don't know what's supposed to go in there without the Editor doing it for me.

Getting closer. Thanks so much.

Former Member
0 Kudos

Hmm. I see that the WD framework generates the xml file during build.

You can try this:

Look into the build.xml file where the xml file is copied from

(typically something like:

<descriptor type="application-j2ee-engine.xml" file="C:\Documents and Settings\<your name>\.dtc\0\t\FEE82A2F2D33C070F55B194A4D149F63/gen_wdp/application-j2ee-engine.xml"/>)

and add the line manually, as the last element (see DTD from SAP documentation):

<start-up mode="always"/>

Then build and deploy.

Hope this works.

Good luck, Roelof

Edited by: R. Knibbe on Feb 17, 2009 4:01 PM

Former Member
0 Kudos

> Definitely getting closer, but not quite there yet. We aren't using NWDI, we're creating Web Dynpro Applications, so I don't have access to a "public part" as far as I know.

quote}

Didn't think of it before: instead of creating WD projects and J2EE projects, you can create components of type WD or J2EE. In that case you will have the public parts etc. and you will be able to knot the 2 in 1 and communicate through the interface.

Good luck, Roelof

Answers (0)