cancel
Showing results for 
Search instead for 
Did you mean: 

Where to put the external jar files in a DC.

Former Member
0 Kudos

Hello,

I am struggling to find the reason for ClassNotFoundException at the line


Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");

The class path already has sqljdbc.jar (from the <DC name>/lib folder) which includes the class "com.microsoft.sqlserver.jdbc.SQLServerDriver"

Can any body tell me how to fix this.

Thanks

Srinivas

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Go through this blog completely you will have a better understanding ..

/people/bertram.ganz/blog/2008/11/24/how-to-use-external-jar-files-in-web-dynpro-development-components

Hope this helps you..

Regards,

Saleem

Former Member
0 Kudos

Thanks for your helpful information.

I am following this /people/raphael.vogel/blog/2008/05/05/how-to-use-external-libraries-in-the-sap-component-model-part-ii to create an assembly public part and a compilation public part for the external lib DC.

what you mentioned:


if you are using DCs create a DC of type External library. and paste the sqljdbc.jar in lib folder and create public parts (for both the compile and runtime availability)and build the DC(its important).so that this jar file will be available for the other DCs. Now in your Webdynpro DC use the DC(External Library) as Used component in DC Metadata and build and deploy. This will definetly solves the issue.

How should I create public parts for both the compile and runtime availability ?

Thanks

Srinivas

Former Member
0 Kudos

Hi,

Go to your external DC, go to public parts in DC meta data section and create a public part by selecting the first radio button which represents the public part used for compilation and the next radio button represents for runtime.

So create two public parts and try to add them as used dc's in which you are using it.

Hope this helps you..

Regards,

Saleem

Former Member
0 Kudos

Hi Srinivas,

Are you using CE 7.1 or NW 7.0.?

The Public parts have to be of type Compilation and Assembly.

In case of CE 7.1 go to the Development Infrastructure Perspective and right click on DC ->Show In -> Component Properties.

In the Public Parts tab you will have to create the two public parts (one of type compilation and the other assembly).

You have to create these two Public parts because the DC with the libraries is not a deployable component.

The compile time Public part allows any other DC to use the functionalities exposed through the public part.

But, in order to deploy the DC you have to have a Assembly Public Part. When any other DC uses this assembly public part they will all bundle the library DC and deploy it.

Regards,

Kartikaye

Former Member
0 Kudos

I am using NW 7.0. The external library DC, project doesn't show up under "WebDynpro Explorer tab". It only shows in the Navigator tab.

As a result, I cannot goto DC MetaData-->Public Parts.

This is why am not able to create Public Parts for the External DC project...

Former Member
0 Kudos

Hi Srinivas,

To create a public part of an external library DC go to the Development Configurations Perspective

(Click on Window in the Toolbar -> Open Perspective -> Other -> Development Configuration).

Click on the Development Area you are working on Local Development or a Track.

Then Click on your Software Component and then you external library DC.

You will see a DC Meta Data node under it .

Click on the DC MetaData. It will have two child nodes: DC Definitions and Public Parts.

Create the required Public Parts there.

Regards,

Kartikaye

Former Member
0 Kudos

Hi Kartikaye,

While adding this External Lib DC as a used DC .

I checked Build Time and Run Time check boxes.

When I deploy, I still see same exception. ClassNotFound

Did I do anything wrong while adding the used DC.

Former Member
0 Kudos

Hi Srinivas,

Firstly check if you have added both the public parts to the Using DC. In case, of SAP NW 7.0 the two public parts should be of type API and Compilation.

Follow the same process as described in the weblog, but in case of SAP NW 7.0 use the J2EE Server library Component instead of Enterprise Application.

This basically done so that now the library is available through the Enterprise application / J2EE Server library component. But, if its a library going to be used a single web dynpro application you need not implement this component. Directly in your web dynpro you define a dependence for the DC

Read some of the old weblogs on external libraries:

/people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas

/people/valery.silaev/blog/2005/09/14/a-bit-of-impractical-scripting-for-web-dynpro

The two weblogs have both the approaches.

Regards,

kartikaye

Former Member
0 Kudos

Hi Kartikaye,

I followed this blog that you mentioned in your reply:

/people/bala.krishnan2/blog/2006/09/25/bid-adieu-to-bots--using-captchas

This seemed to work. But now I get a different exception (SQL Exception)


Cannot open database "<dbname>" requested by the login. The login failed.

at the line


Connection con = DriverManager.getConnection("jdbc:sqlserver://<IP:1433>"+";database="<dbname>","uid","pwd");

I am able to connect using sql express interface using the same user id/password .

Does it mean, the IP am using is wrong ????

Thanks

Srinivas

nitin_mahajan2
Contributor
0 Kudos

Hi,

Though creating public parts look easy, but you have to be very sure of the radio buttons you select.

As you already know you will have to create two public parts one for compile time and another for run time. Make sure you select the

Classes for compiletime public part and sources for runtime public part.

check here

http://help.sap.com/saphelp_nw04s/helpdata/en/43/c14b960c3a19f0e10000000a1553f6/frameset.htm

Also the purpose of public parts

http://help.sap.com/saphelp_nw04/helpdata/en/80/096744c271f8408bae38a49d556c80/frameset.htm

Two options,

Purpose Provides an API for developing/compiling other DCs

This option is used for creating a compile time public part

Purpose Can be packaged into other build results (e.g. SDAs)

This option is used for run time and buildtime

Again while adding the public parts as used DCs, you don't need to enter any specific code. Just add these as a Used DCs.

Make sure for the compile time public part, you have the design time property set to true

and for runtime, you have design time set to false and build and run time set to true

I had issues with these checkboxes in my project, so make sure you take care of this.

Also, the source external jar dc should be deployed on the server where your consuming DC is deployed.

Once done, you do not need any code in your local project to consume these libraries, they will work as local libraries.

Hope this explanation works for you and help.

Regards,

Nitin

Former Member
0 Kudos

Adding external library works fine as am not getting ClassNotFound exception anymore.

But, I get a different exception (SQL Exception)

Cannot open database "<dbname>" requested by the login. The login failed.

at the line


Connection con = DriverManager.getConnection("jdbc:sqlserver://<IP:1433>"+";database="<dbname>","uid","pwd");

The userID and Pwd, work fine.

Any ideas on what the exception means, ...

Thanks

Srinivas

Former Member
0 Kudos

Hi Srinivas,

Try checking the following two things:

1. URL provided for connecting to the database

2. Check whether the user Id and password used have enough access to open the database.

Regards,

Ponraj M

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi

You have not mentioned whether you are using the Webdynpro or PDK application for the development.

i can give u some tips assuming its a webdynpro application just try it out:

1) keep the required jar file sqljdbc.jar in src-->library or under lib folder of src and deploy once again and check if it does not work then

2) if you are using DCs create a DC of type External library. and paste the sqljdbc.jar in lib folder and create public parts (for both the compile and runtime availability)and build the DC(its important).so that this jar file will be available for the other DCs. Now in your Webdynpro DC use the DC(External Library) as Used component in DC Metadata and build and deploy. This will definetly solves the issue.

All the best.

Regards

Prasad.