cancel
Showing results for 
Search instead for 
Did you mean: 

Job Scheduler

Former Member
0 Kudos

A JNDI context look up of scheduler (as shown below) gives a class cast exception at runtime.

try {	
                 InitialContext ctx = new InitialContext();
	         scheduler = (com.sap.scheduler.api.Scheduler) ctx.lookup("scheduler");
	} catch (NamingException ne) {
	    return;
	}

Runtime gives back com.sap.engine.services.scheduler.impl.Scheduler instead of com.sap.scheduler.api.Scheduler. I followed the same steps as detailed out [here|http://help.sap.com/saphelp_nwce10/helpdata/en/44/3e1ed10610376ee10000000a114a6b/content.htm].

Any pointer will be highly appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

dirk_marwinski
Explorer
0 Kudos

Hi,

can you provide some more information on this? I have never seen this problem, in fact the implementation class that you mention below should not be registered in JNDI.

It would be ideal if you could provide a small test case together with precise version information.

Thanks and best regards,

Dirk Marwinski

Former Member
0 Kudos

Thanks for the follow up. I was trying to execute the Hello Job example. I have followed the steps mentioned in the example and have used the code piece listed [here|http://help.sap.com/saphelp_nwce10/helpdata/en/44/3e1ed10610376ee10000000a114a6b/content.htm] in a Stateless Session Bean. As a result I got the aforementioned output..

KR.

Answers (6)

Answers (6)

Former Member
0 Kudos

Solved as per my comments

Vlado
Advisor
Advisor
0 Kudos

assumed answered as per the last post

dirk_marwinski
Explorer
0 Kudos

Hi,

sorry, I don't have a definite answer, however I have some thoughts, ideas, insights, and pointers. Could you please file a bug report in case this does not help.

As it is visible from the Log.txt, the problem is caused by a ClassCastException:

 Caused by: java.lang.ClassCastException: class com.sap.engine.services.scheduler.impl.ServiceInterfaceDelegate:service:scheduler_com.sap.engine.boot.loader.ResourceMultiParentClassLoader_1afe17b@alive incompatible with interface com.sap.scheduler.api.Scheduler:bala.test/job-scheduler-app_com.sap.engine.boot.loader.ResourceMultiParentClassLoader_1154471_alive

(sorry, had to replace "at" with underscores)

This should not happen as ServiceInterfaceDelegate is an implementation of the interface. The Scheduler interface is normally loaded by the scheduler~runtime class loader (as it is part of it) and the ServiceInterfaceDelegate is loaded by the scheduler class loader. Looking at the trace above you can see that the interface is loaded by the application (bala.test/job-scheduler-app) and the ServiceInterfaceDelegate is loaded by the scheduler service. This would perfectly explain the exception as the interface loaded by another class loader is not considered "compatible".

Did you include the scheduler interface jar into your application and not set a reference to the scheduler~runtime service? This would perfectly explain the exception above.

If that is not the case please have a look at the class loader hierarchy. Make sure one of the parent class loaders of your application is the schedulerruntime class loader. Make sure you don't include the scheduler api jar within any application, library, or service that you reference. You can check the class loader dependencies with the llr telnet command, e.g. llr service:schedulerruntime.

Hope this helps,

Dirk Marwinski

Former Member
0 Kudos

Hello Dirk,

Thanks for the points. Will do my further analysis.

BR,

Bala

Former Member
0 Kudos

Thanks again Dirk for the details.

I was able to solve the problem.Here is what I did after un-deploying all the DCs from the server.

For the job-definition and job-scheduler EJB DCs and the job-definition-app and job-scheduler-app Application DC,

I've established a Run time, Desing time and Deploy time dependency to the SAP

delivered DC tc/je/scheudler/api.

Then on redeployment and testing, I found that the context look-up loads up the proper class implementation

of the Scheduler interface and scheduling happens successfully.

BR,

Bala

Former Member
0 Kudos

Thanks for the note.

I'm sorry. By mistake I closed the thread. The problem has not been resolved. I get the same ClassCastException. The details remain same as explained above.

Here are my DCs:

1. [job-definition|http://www.4shared.com/file/90671863/533066b2/_2__job-definition.html] (EJB DC- Containing the implementation of MDBJobImplementation)

2. [job-definition-app|http://www.4shared.com/file/90671925/dffd6cb4/job-definition-app.html] (Application DC corresponding to the job-definition EJB DC)

3. [job-scheduler|http://www.4shared.com/file/90671968/c520d50d/job-scheduler.html] (EJB DC- Containing the scheduling relevant implementation)

4. [job-scheduler-app|http://www.4shared.com/file/90672013/d70e23/job-scheduler-app.html] (Application DC corresponding to the job-scheduler EJB DC)

5. [wd-job-scheduler|http://www.4shared.com/file/90672071/b883c889/wd-job-scheduler.html] (WD DC that calls a session bean from job-scheduler EJB DC to start the scheduling activity).

6. [Error log|http://www.4shared.com/file/90672207/1d252f15/Log.html] (Log showing the ClassCastException)

Would be great if some one can shed light on this.

Best regards,

Bala

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

assumed answered due to non action

Former Member
0 Kudos

Problem has been resolved.

Vlado
Advisor
Advisor
0 Kudos

[Good forum practice|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] would imply that you share the solution too. Thanks!

dirk_marwinski
Explorer
0 Kudos

Hi,

I haven't seen such a problem. Could you send me your example application via email?

Thanks,

Dirk

Former Member
0 Kudos

Hello Dirk,

The code works perfectly when run from within a WebDynpro application. However, when I expose the EJB method (which gets a JNDI reference to Scheduler ) as a webservice and try to invoke it in the WSNAVIGATOR, it throws the classcastexception.

Any clues?

Best regards,

Bala