cancel
Showing results for 
Search instead for 
Did you mean: 

How to deploy Used DC Java code along with Web Dynpro project DC

Former Member
0 Kudos

Hello, I am having trouble getting the code from a Used DC deployed along with my Web Dynpro app.

Here's the scenario:

1) Create a Java project DC. It contains a bunch of 'common code' java source code.

2) Expose the common code by creating Public Part in the Java Project DC

3) In my Web Dynpro project DC create Used DC pointing to the public part defined in the Java project DC

4) Write code in Web Dynpro project that refers to java classes in my Java project DC - The Web Dynpro project builds with no errors so it's obviously finding the java code from my Java project.

5) Deploy the Web Dynpro project - No problems listed here either.

6) Try to run my app. Fails with a "java.lang.NoClassDefFoundError" that states it can't find the java classes in my Java project

This is something that I do all the time with J2EE Enterprise Application projects and it works fine.

It appears that in Web Dynpro there is some additional step(s) necessary to get the code from the Java project deployed along with the Web Dynpro project.

Has anyone experienced this and, more importantly, does someone have a solution?

Thanks!

David

Accepted Solutions (1)

Accepted Solutions (1)

Jeff-Gebo
Advisor
Advisor
0 Kudos

Hi David,

how are your Java DCs/External Lib DCs being deployed? As part of the WD DC or as part of a J2EE Library DC? If it is part of a J2EE Library DC then you need a reference to it made in the WD Project Properties...the same thing would have to be done in a J2EE Application, this is done in the application-j2ee-engine.xml deployment descriptor. Now if the common code is supposed to get deployed with your J2EE application then you must setup a used DC reference to the public part of type "Can be packaged with other build results" in your Enterprise Application DC to the common code DC.

Now if your external libs/Java DCs are being deployed with the WD DC then this should work...so something would have to be wrong with your public parts/used dcs. If this is the case you might take a look at what gets pulled into the resulting EAR of the WD DC build. You would need a used DC reference to the public part of type "Can be packaged with other build results" that you created on the Java DC/External Lib DC. Its a little different with WD DCs than it is with J2EE DCs...since J2EE DCs are seperated into the deployable DC (Enterprise App DC - only needs references to the deployable public parts) and the Web/EJB DCs (these only need references to the API public parts). WD DCs are deployable and contain UI code, so they need a reference to both kind of public parts from the common code DCs (in the case that this code needs to be deployed with your WD DC).

Anyway, some clairification would help on how your common code is supposed to get deployed. With the WD DC or with the use of a J2EE Library DC?

Cheers,

Jeff

Former Member
0 Kudos

Turns out all I was doing wrong was selecting the "Deploy Time" checkbox when creating the deploy Public Part.

Once I recreated the public part but only with the "Build Time" checkbox selected everything worked fine.

Thanks everyone for your help.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi David,

there is a tutorial regarding exactly this: https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/600cb8d1-a8be-2910-a0b1-f13d32d4...

kind regards

stefanie

Jeff-Gebo
Advisor
Advisor
0 Kudos

Hi David,

From what I can tell you are creating Used DC References to Public Parts of external lib DCs. You must be selecting the Deploy Time dependency checkbox when connecting your WD DC to the external lib public part. Since external lib DCs are not deployable to J2EE Engine (they must be part of J2EE Library DC or some other deployable DC) it is not valid to make a deploy time dependency to them and thus your warnings you are seeing.

Anyway, your external lib/Java DC code either needs to be deployed onto the server with a J2EE Library DC, or it needs to become part of the WD DC. My personal opinion would be to use the J2EE Library DC if this code is used by many applications. That would mean you would need to make a reference from you WD DC to the J2EE library DC so that at runtime your WD DC can find the java classes it needs. This is done in the WD Project Properties. Open the project properties and go to Web Dynpro References > Library References and add a new reference to your J2EE Library App. At deploy time the engine will then make sure to link your WD project to that of the J2EE library so that it can load the classes.

This link in help has a good example of this (how to use the UME libraries already deployed on the server): http://help.sap.com/saphelp_nw2004s/helpdata/en/f9/ce747474574fdb8a79fed77ea075f8/frameset.htm

Hope this helps.

Jeff

Former Member
0 Kudos

Thanks Jeff. If I could ask a couple of follow-up questions...

The process I've described (you actually worked with us to set it up : ) works fine for normal web projects. But when I try to do the same process with web dynpro projects it falls apart.

I'll try what you've described but I'm curious why our normal process doesn't work. Just to review the steps:

1) Create a java project or an external library project.

2) Expose java packages (in java project) or jars (in external library project) as public parts

3) Create Used DCs in web module project or web dynpro project.

So far, the steps are exactly the same whether it's going to be used by web app or web dynpro app. The only difference I can see is that a web module project is not 'deployable' by itself where a web dynpro project IS.

4) In order to be able to deploy the web module project it has to be 'bound'/'tied' to a Java Enterprise project. This is not necessary for a web dynpro project since it is deployable by itself.

So my question is still: Why do I have to put the public parts of my java project and/or external library project in some OTHER deployable project before they can be used by a web dynpro project when deploying?

Sorry to be dense but I really need to understand this.

Thanks for your patience.

David.

Former Member
0 Kudos

I found something on OSS that seemed to deal with this.

Note 1021176 says that in this kind of case you can't right-click on the web dynpro app and choose "deploy new archive and run"

Instead you have to right-click on the development component and choose "Build". Then you have to right-click on the development component again and choose "Deploy"

Once the deploy has finished you have to run the app by right-clicking on it and choosing the "Run" option instead of the "deploy new archive and run"

I've done that but I still can't get it to work.

I just opened an OSS message on this but I'll paste the text of my message here in hopes that someone in this community will have an answer.

Thanks in advance for any help.

====== OSS message ===

I have a bunch of common code in separate DCs that I expose as Public Parts. Some of the code is in DCs of type External Library and some is in type of Java. For each DC I create a public part for compilation (choosing the "Provides an API for developing/compiling other DCs" radio button) and one for deployment (choosing the "Can be packaged into other build results" radio button).

Then I refer to the Public Parts by creating Used DCs in my Web Dynpro DC. I create a Used DC for the compile (by checking the "Build Time" checkbox only) and one for the deploy (by checking the "Build Time" and "Deploy Time" checkboxes). The other two checkboxes ("Design Time" and "Run Time") are left unchecked as is their default state. The runtime qualifier dropdown is also left in its default state which is with neither option selected.

In my Web Dynpro code I use classes from my common code and the web dynpro code compiles fine. However when I try to do a Development Component Build I get the following warnings:

Warning: Deploy-time dependency to [my DC name] is not allowed and will be ignored (development component type Java (sap.com) has incompatible runtime type).
Warning: Deploy-time dependency to [my DC name] is not allowed and will be ignored (development component type Java (sap.com) has incompatible runtime type).
Warning: No runtime information available for development component type External Library (sap.com), cannot validate deploy-time dependency.
Warning: No runtime information available for development component type External Library (sap.com), cannot validate deploy-time dependency.
Warning: No runtime information available for development component type External Library (sap.com), cannot validate deploy-time dependency.
Warning: No runtime information available for development component type External Library (sap.com), cannot validate deploy-time dependency.
Warning: Deploy-time dependency to [my DC name] is not allowed and will be ignored (development component type Java (sap.com) has incompatible runtime type).
Warning: Deploy-time dependency to [my DC name] is not allowed and will be ignored (development component type Java (sap.com) has incompatible runtime type).

If I then try to do a Development Component Deploy I get the following warnings

deployment not executed : file:/C:/WINNT/Temp/temp22716fe.com~reg~dzp_wdp.ear
Unresolved dependencies found for the following SDAs:

1.: development component 'reg/dzp_wdp'/'fe.com'/'NP1_PISNDBOX_D'/'20070510152501'/'0'
dependency: 
       name:     'reg/3p/antlr_extlib'
     vendor:     'fe.com'

There is no component either in SDM repository or in Deployment batch that resolves the dependency.
dependency: 
       name:     'reg/3p/jakarta_oro_extlib'
     vendor:     'fe.com'

There is no component either in SDM repository or in Deployment batch that resolves the dependency.
dependency: 
       name:     'reg/3p/domino_extlib'
     vendor:     'fe.com'

There is no component either in SDM repository or in Deployment batch that resolves the dependency.
dependency: 
       name:     'reg/3p/apache_commons_extlib'
     vendor:     'fe.com'

There is no component either in SDM repository or in Deployment batch that resolves the dependency.

Deployment will be aborted.

Deployment exception : Got problems during deployment

This is the exact same process I use when using common code in J2EE webapps. Is there something different I need to do in a web dynpro app to make this work?

former_member182372
Active Contributor
0 Kudos

Hi David,

Add Java DC to Enterprise Application DC and don`t forget to add shared reference to it from WD DC.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Thanks Maksim. I just want to clarify what you're saying. Do you mean that I need to create an Enterprise Application DC and reference THAT DC in the Web Dynpro DC?

If that IS what you meant, then could you please explain what I would expose as a public part from the enterprise app DC?

former_member182372
Active Contributor
0 Kudos

Hi David,

EAR DC is only to deploy java classes (runtime availability). You can still use public parts from java DC in WD DC. But sharing reference should be to EAR DC NOT to Java DC.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Maksim, I understand what the EAR DC is for. That's why I was asking my followup question.

If I create an EAR DC then I'm going to also have to create a Web DC (not web dynpro) and tie that web DC to the EAR DC. When I deploy the EAR DC it'll get all my code out to the server but that still doesn't tell me how the Web Dynpro DC will be able to access the Java DC code once it's deployed.

former_member182372
Active Contributor
0 Kudos

>>If I create an EAR DC then I'm going to also have to create a Web DC (not web >>dynpro) and tie that web DC to the EAR DC.

Not Web but just Java. Purpose type for used dc should be Assemble.

>>When I deploy the EAR DC it'll get all my code out to the server but that still >>doesn't tell me how the Web Dynpro DC will be able to access the Java DC >>code once it's deployed.

On design time - through Java DC public part. On runtime - through sharing reference.

Former Member
0 Kudos

Maksim. I apologize for being slow but I must still be missing something here. I would very much appreciate it if you could review what I've written below and clarify things for me. Based on my knowledge at this time what you're suggesting seems impossible but I am the first to admit that there is a LOT I don't know about this environment yet.

Here's the process:

1) Create Java DC with common code

2) Create Public Part as Package Tree twice. One Public part we call compile and it is defined with the "Provides an API for developing/compiling other DCs" option. The other public part we call deploy and it's defined with the "Can be packaged into other build results" option.

3) Define a Used DC in Web Dynpro DC pointing to the compile public part and check the "Build Time" check box.

4) Define another Used DC in web dynpro DC pointing to the deploy public part and check the "Build Time" and "Deploy Time" check boxes.

5) Build and deploy the Web Dynpro DC

<b>THE NEXT STEP IS WHERE I GET CONFUSED...</b>

6) Create an EAR DC. To my knowledge, you can only associate a Web Module DC with an EAR DC. How do I get the Java DC associated with the EAR DC?

7) Build and deploy the EAR DC.

If I understand you correctly, you're saying that because the EAR DC is deployed to the engine, the Web Dynpro DC should be able to access its classes at runtime.

However, my understanding is that the classes deployed by the EAR are only available within the application context specified in the application.xml file of the EAR DC.

The Web Dynpro DC has its own application.xml file and that has no way of accessing code in other 'applications'.

Thank you very much in advance for any help.