cancel
Showing results for 
Search instead for 
Did you mean: 

applocking Error

Former Member
0 Kudos

Hi All,

I want to do locking of a single row for table in databse using JDBC connection.

I am Using Stateless session bean for connection.

I am using following code for locking

Context initialContext = new InitialContext();

TableLocking locking = (TableLocking) initialContext.lookup(TableLocking.JNDI_NAME);

And Follwoing code for

public void lock(byte lifetime,

Connection connection,

String tableName,

Map primaryKeys,

char mode)

throws LockException,

TechnicalLockException,

IllegalArgumentException;

I have added <b>applocking service</b> in my USED component of EJB project.

I am not getting any error at build time.

But at Runtime it is not able to find TableLocking class.

<b>java.lang.NoClassDefFoundError: com/sap/engine/services/applocking/TableLocking</b>

Do i need to add the dependency at some other place also ??

Or how do i access that class ??

Can any one give some input about this problem??

Thanks and Regards,

Shruti.

Accepted Solutions (1)

Accepted Solutions (1)

sridhar_k2
Active Contributor
0 Kudos

Shruti,

You don't have build errors, bcz you added used component to the EJB.

There could be two reason for your error. <b>java.lang.NoClassDefFoundError: com/sap/engine/services/applocking/TableLocking</b>

1) Have you deployed your EJB?

2) Check for the JNDI Name? Name should match what you have given in EJB - ejb-j2ee-engine.xml file.

Regards,

Sridhar

Former Member
0 Kudos

Hi Sridhar,

1)I have deployed EJB properly, My EAR is also deployed successfully.

2)I the method

TableLocking locking = (TableLocking) initialContext.lookup(TableLocking.JNDI_NAME);

JNDI name of the Table Locking class is to be used, and in tutorial it is given that JNDI name is contained in the constant <b>TableLocking.JNDI_NAME</b>

So i don have to use JNDI name of the MyBean in any of the method, as i am exposing bean as WS and running the WS.

So i am not able to figure to out the Problem.

Thanks and Regards,

Shruti.

Answers (1)

Answers (1)

former_member197348
Active Contributor
0 Kudos

Hi Shruthi,

How did add the applocking service? If you add it as an external jar it should be available in build time or as an usedDC it should be available in runtime.

regards,

Siva

Former Member
0 Kudos

Hi Siva,

I have added it as Used Dc in my EJB. So m not getting any build time error.

While adding it to the used Dc i have alos selected <b>runtime</b> option ,but still at runtime i am getting the error.

So if you can give some input regarding the problem.

Thanks and Regards,

Shruti.

former_member197348
Active Contributor
0 Kudos

Hi Shruthi,

What is the type of DC (Is it <b>external library</b> or anything else?)

regards,

Siva

Former Member
0 Kudos

Hi Siva,

I have added applocking services into my used dc from Software component <b>SAP_J2EE_1</b> and checked runtime dependency also.

I have also tried to add these jars into my project, by adding them into one External Library Project and then using dependency from that Library project.

But still giving the same problem.

former_member197348
Active Contributor
0 Kudos

Hi Shruthi,

You have tried out everything. Why don't you create an OSS message?

regards,

Siva

former_member197348
Active Contributor
0 Kudos

Hi Shruthi,

Just to confirm which type of PP you have created?

regards,

Siva