on 04-22-2009 8:28 AM
Hello Friends
I am trying this concept of Job Scheduler API of Netweaver for the first time . The problem that I am encountering is , after successfull deployment of my application DC , I cant see the job created by me in the job definations on server
I am laying down the approach that I took for the development of job : -
1) I created one EJB Module DC( sample_mdb_session ) and created one Message Driven bean
( JobBean ) and laid down the logic to be run on the execution of job
I have also included the scheduler api in the build path of my DC
2) nextly I created the required job-definition.xml and did the changes in ejb-j2ee.xml
ejb-j2ee.xml
<enterprise-beans>
<enterprise-bean>
<ejb-name>com.sap.scheduler.examples.session.JobBean</ejb-name>
<jndi-name>JobBean</jndi-name>
<resource-ref>
<res-ref-name>JobQueueFactory</res-ref-name>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>JobQueue</message-destination-ref-name>
<jndi-name>JobQueue</jndi-name>
</message-destination-ref>
</enterprise-bean>
</enterprise-beans>
_job-definitons.xml_
<job-definitions>
<job-definition name="JobBean"
description="Logs a string and calculates its length">
<job-definition-parameter name="UserName"
data-type="String"
direction="IN"/>
<job-definition-parameter name="NameLength"
data-type="Integer"
direction="OUT"/>
</job-definition>
</job-definitions>
3) In the application DC( sample_application_dc ) I did the required changes in application-j2ee-engine.xml
<application-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="application-j2ee-engine.xsd">
<reference reference-type="hard">
<reference-target provider-name="sap.com" target-type= "service">
scheduler~runtime
</reference-target>
</reference>
<modules-additional>
<module>
<entry-name>demo.sap.com~sample_mdb_session.jar</entry-name>
<container-type>scheduler~container</container-type>
</module>
</modules-additional>
</application-j2ee-engine>
The document that i had reffered to construct everything was actually dealing with an EJB project and a respective .ear project, things were working fine till the time I was dealing with local EJB projects but as soon as I started working with DCs , the problems occured
And when i deployed the application on the server it is deployed successfully , but I cant see the job in job definitions in SAP Netweaver Administrator > java scheduler section
What i am doubting is that the changes that i did in the xmls are not apt , so If any one on the forum has done the scheduling job earlier can please send the required xml code as that may help in solving the problem
Edited by: Smriti_techno on Apr 22, 2009 9:28 AM
Thanks for pointing that out. Not sure how it happened -
I was able to move a bit further with this but now I am getting a new error in my ejb-j2ee-engine.xml -
Description Resource Path Location Type
cvc-complex-type.2.4.a: Invalid content was found starting with element 'message-props'. One of '{ejb-ref, ejb-local-ref, resource-ref, resource-env-ref, message-destination-ref, server-component-ref, ior-security-config, bean-props}' is expected. ejb-j2ee-engine.xml LocalDevelopmentLocalDevelopmentpdf(2fejb~demo.sap.com/bin/META-INF line 8 XML Problem
<?xml version="1.0" encoding="UTF-8"?>
<ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="ejb-j2ee-engine_3_0.xsd">
<enterprise-beans>
<enterprise-bean>
<ejb-name>HelloWorldBean</ejb-name>
<jndi-name>HelloWorldBean</jndi-name>
<message-props> //this is where NWDS is showing error
<destination-name>JobQueue</destination-name>
<connection-factory-name>JobQueueFactory</connection-factory-name>
</message-props>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
job-definition.xml is
<?xml version="1.0" encoding="UTF-8"?>
<job-definitions>
<job-definition name="HelloWorldBean"
description="Logs a string and calculates its length">
<job-definition-parameter name="UserName"
data-type="String" direction="IN" />
<job-definition-parameter name="NameLength"
data-type="Integer" direction="OUT" />
</job-definition>
</job-definitions>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shiv
First of all, the reason for the previous problem is unmatched job definition names between job-definition.xml and MDB anotation for message selector - they must be equal as described [here|http://help.sap.com/saphelp_nwce72/helpdata/en/4a/685eb452175135e10000000a42189b/frameset.htm].
In your job-definition.xml the name is HelloWorldBean and in your anotation this name is HelloWorldJob.
You should decide which name you would like to use.
Second - for the xml validation issue that the IDE is complaining about - there is no attribute "message-props" for the EJB project version 3.0. You can use "bean-props" instead.
In more details, there are 2 options to define ejb-j2ee-engine.xml:
1. For EJB 2.1 projects:
-
<?xml version="1.0" encoding="UTF-8"?> <ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <enterprise-beans> <enterprise-bean> <ejb-name>HelloWorldBean</ejb-name> <jndi-name>HelloWorldBean</jndi-name> <message-props> <destination-name>JobQueue</destination-name> <connection-factory-name>JobQueueFactory</connection-factory-name> </message-props> </enterprise-bean> </enterprise-beans> </ejb-j2ee-engine>
2. For EJB 3.0 projects
-
<?xml version="1.0" encoding="UTF-8"?> <ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="ejb-j2ee-engine_3_0.xsd"> <enterprise-beans> <enterprise-bean> <ejb-name>HelloWorldBean</ejb-name> <jndi-name>HelloWorldBean</jndi-name> <bean-props> <property> <property-name>destination-name</property-name> <property-value>JobQueue</property-value> </property> <property> <property-name>connection-factory-name</property-name> <property-value>JobQueueFactory</property-value> </property> </bean-props> </enterprise-bean> </enterprise-beans> </ejb-j2ee-engine>
Cheers!
Vladislav
Hi Vladislav,
Thanks for the response.
The changes in ejb-j2ee-engine.xml does work now.
As far as job-definition.xml is concerned , I think the names I had kept were same. In my first post, the name was "HelloWorldJob" and in the second post I had created another project and changed the name. Thats the reason there were two different name. I guess the problem was that I was keeping my Java class under src folder whereas it should be under ejbmodule folder.
I really appreciate your help.
Thanks a ton.
Cheers,
Shiv
I was not naming the xml properly
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Smriti,
I am having the same problem what you faced when I moved from EJB Project to EJB DC for the scheduler API.
The exception I am getting is -
Description:
1. ASJ.dpl_ds.006193 Error while deploying ear file E:\usr\sap\CE2\J91\j2ee\cluster\server0\temp\tcbldeploy_controller\archives\764\demo.sap.com~helloworldear.ear; nested exception is:
com.sap.engine.services.deploy.container.DeploymentException: Deployment of jobs in application [demo.sap.com/helloworldear] failed, reason is : [There is no bean for job definition "HelloWorldJob".]
Bean class
package org.csagroup;
import java.util.logging.Logger;
import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import com.sap.scheduler.runtime.JobContext;
import com.sap.scheduler.runtime.mdb.MDBJobImplementation;
//Specify message selector
//and destination type
@MessageDriven(activationConfig={
@ActivationConfigProperty(propertyName="messageSelector", propertyValue="JobDefinition='HelloWorldJob'"),
@ActivationConfigProperty(propertyName="destinationType",propertyValue="javax.jms.Queue")})
public class HelloWorldBean extends MDBJobImplementation {
public void onJob(JobContext ctx) {
//Implement business logic
Logger log = ctx.getLogger();
log.info("Hello World!");
}
}
ejb-j2ee-engine.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<enterprise-beans>
<enterprise-bean>
<ejb-name>org.csagroup.HelloWorldBean</ejb-name>
<jndi-name>HelloWorldBean</jndi-name>
<resource-ref>
<res-ref-name>JobQueueFactory</res-ref-name>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>JobQueue</message-destination-ref-name>
<jndi-name>JobQueue</jndi-name>
</message-destination-ref>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
job-definition.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<enterprise-beans>
<enterprise-bean>
<ejb-name>org.csagroup.HelloWorldBean</ejb-name>
<jndi-name>HelloWorldBean</jndi-name>
<resource-ref>
<res-ref-name>JobQueueFactory</res-ref-name>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>JobQueue</message-destination-ref-name>
<jndi-name>JobQueue</jndi-name>
</message-destination-ref>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
application-j2ee-engine.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-j2ee-engine xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<enterprise-beans>
<enterprise-bean>
<ejb-name>org.csagroup.HelloWorldBean</ejb-name>
<jndi-name>HelloWorldBean</jndi-name>
<resource-ref>
<res-ref-name>JobQueueFactory</res-ref-name>
</resource-ref>
<message-destination-ref>
<message-destination-ref-name>JobQueue</message-destination-ref-name>
<jndi-name>JobQueue</jndi-name>
</message-destination-ref>
</enterprise-bean>
</enterprise-beans>
</ejb-j2ee-engine>
I would really appreciate if you could help me with this.
Thanks in advance.
Hi Smriti,
I am trying to implement job scheduler in Webdyn pro java NWDS 7.3. I've follwed the pdf : http://scn.sap.com/docs/DOC-2665
and i've done some changes required for 7.3.
The same changes are are done in ejb-j2ee-engine.xml, job-definition.xml and application-j2ee-engine.xml as you have mentioned.
But when i deployed the application on the server it is deployed successfully , but I cant see the job in job definitions in SAP Netweaver Administrator > java scheduler section.
Can u please help me what changes have you done in naming the xml.
Thanks in advance.
problem solved
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.