ERLEDIGT
NEIN
NEIN
ANTWORTEN
4
4
ZUGRIFFE
3630
3630
EMPFEHLEN
-
21.05.07 20:43 #1
- Registriert seit
- Apr 2007
- Beiträge
- 2
Hi Leure,
ich versuch nun seid 10 Tagen und Nächten einen einfachen Scheduler unter JBoss zum laufen zu bringen. Ich benutze Eclipse mit der der JBossIDE 2 und JBoss 4. Also folgendes habe ich bereits hinbekommen:
Eine Scheduler-service.xml mit folgendem Inhalt:
Diese XML liegt im richtigen Verzeichnis und wird auch geladen. Leider bekomme ich immer wieder den FehlerCode :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE server> <!-- $Id: scheduler-service.xml,v 1.6 2004/09/02 05:37:26 telrod Exp $ --> <server> <mbean code="org.jboss.varia.scheduler.Scheduler" name="ownm:service=Scheduler"> <attribute name="StartAtStartup">true</attribute> <attribute name="SchedulableClass">de.test.SchedulerTest</attribute> <attribute name="SchedulableArguments">Schedulabe Test,12345</attribute> <attribute name="SchedulableArgumentTypes">java.lang.String,int</attribute> <attribute name="InitialStartDate">0</attribute> <attribute name="SchedulePeriod">10000</attribute> <attribute name="InitialRepetitions">-1</attribute> <depends> <mbean code="javax.management.timer.Timer" name="jboss:service=Timer"/> </depends> </mbean> </server>
Code :1
org.jboss.deployment.DeploymentException: Unexpected error during load of: org.jboss.varia.scheduler.Scheduler, msg=org/jboss/system/ServiceMBean; - nested throwable: (java.lang.ClassNotFoundException: Unexpected error during load of: org.jboss.varia.scheduler.Scheduler, msg=org/jboss/system/ServiceMBean)
Es scheint so als würde er meine Scheduler Class (de.test.SchedulerTest) nicht finden. Wie muß ich die wohin publishen damit JBoss sie finden und laden kann?
Vielen dank für eure Hilfe.
-
21.05.07 21:04 #2
- Registriert seit
- Jun 2002
- Ort
- Saarbrücken (Saarland)
- Beiträge
- 9.886
- Blog-Einträge
- 29
Hallo,
Unser zu Schedulender Task:
Code java:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
/** * */ package de.tutorials.training.jboss.scheduler; import java.util.Date; import org.jboss.varia.scheduler.Schedulable; /** * @author Tom * */ public class SchedulingExample implements Schedulable { String property1; String property2; long property3; public SchedulingExample(String property1, String property2, long property3) { super(); this.property1 = property1; this.property2 = property2; this.property3 = property3; } @Override public void perform(Date arg0, long arg1) { System.out.println("Scheduling: " + getClass() + " at: " + arg0 + " arg1: " + arg1 + " p1:" + property1 + " p2: " + property2 + " p3: " + property3); } public String getProperty1() { return property1; } public void setProperty1(String property1) { this.property1 = property1; } public String getProperty2() { return property2; } public void setProperty2(String property2) { this.property2 = property2; } public long getProperty3() { return property3; } public void setProperty3(long property3) { this.property3 = property3; } }
Als jar exportieren nach %JBOSS_HOME%/server/%SERVER_CONFIG%/lib
Eintrag in scheduler-service.xml
Code xml:1 2 3 4 5 6 7 8 9 10 11 12
<mbean code="org.jboss.varia.scheduler.Scheduler" name="de.tutorials:service=Scheduler"> <attribute name="StartAtStartup">true</attribute> <attribute name="SchedulableClass">de.tutorials.training.jboss.scheduler.SchedulingExample</attribute> <attribute name="SchedulableArguments">Gugu,Gaga,12345</attribute> <attribute name="SchedulableArgumentTypes">java.lang.String,java.lang.String,long</attribute> <attribute name="InitialStartDate">0</attribute> <attribute name="SchedulePeriod">10000</attribute> <attribute name="InitialRepetitions">-1</attribute> <attribute name="FixedRate">true</attribute> </mbean>
Ich starte den Server in der All Konfiguration:
Ausgabe:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13
... 21:02:16,781 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/ 21:02:17,125 INFO [Http11BaseProtocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080 21:02:17,266 INFO [ChannelSocket] JK: ajp13 listening on /0.0.0.0:8009 21:02:17,297 INFO [JkMain] Jk running ID=0 time=0/78 config=null 21:02:17,312 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)] Started in 28s:140ms 21:02:20,000 INFO [STDOUT] Scheduling: class de.tutorials.training.jboss.scheduler.SchedulingExample at: Mon May 21 21:02:20 CEST 2007 arg1: -1 p1:Gugu p2: Gaga p3: 12345 21:02:30,000 INFO [STDOUT] Scheduling: class de.tutorials.training.jboss.scheduler.SchedulingExample at: Mon May 21 21:02:30 CEST 2007 arg1: -1 p1:Gugu p2: Gaga p3: 12345 21:02:40,000 INFO [STDOUT] Scheduling: class de.tutorials.training.jboss.scheduler.SchedulingExample at: Mon May 21 21:02:40 CEST 2007 arg1: -1 p1:Gugu p2: Gaga p3: 12345 21:02:50,000 INFO [STDOUT] Scheduling: class de.tutorials.training.jboss.scheduler.SchedulingExample at: Mon May 21 21:02:50 CEST 2007 arg1: -1 p1:Gugu p2: Gaga p3: 12345 21:03:00,000 INFO [STDOUT] Scheduling: class de.tutorials.training.jboss.scheduler.SchedulingExample at: Mon May 21 21:03:00 CEST 2007 arg1: -1 p1:Gugu p2: Gaga p3: 12345 21:03:10,000 INFO [STDOUT] Scheduling: class de.tutorials.training.jboss.scheduler.SchedulingExample at: Mon May 21 21:03:10 CEST 2007 arg1: -1 p1:Gugu p2: Gaga p3: 12345 21:03:20,000 INFO [STDOUT] Scheduling: class de.tutorials.training.jboss.scheduler.SchedulingExample at: Mon May 21 21:03:20 CEST 2007 arg1: -1 p1:Gugu p2: Gaga p3: 12345
In der JMX-Console siehst du dann den Scheduler im Namespace: de.tutorials
Gruß TomJava rocks!
How to become a good Java Programmer?
Does IT in Java and .Net
The only valid measurement of code quality: WTFs / minute
Blog
Xing
Twitter
-
21.05.07 21:36 #3
- Registriert seit
- Apr 2007
- Beiträge
- 2
Vielen Dank für deine Antwort. Leider funtzt das auch nicht. Aber ich glaube das liegt daran das er die Jar nicht lädt. Müssen die %JBOSS_HOME%, %Server% und %SERVER_CONFIG% als umgebungsvariablen gesetzt sein? Wenn ja wo müssen die genau hin?
-
15.12.09 13:34 #4Ontology777 Tutorials.de Gastzugang
Wie kann ich im scheduler-service.xml angeben wo meine aufzurufende Klasse liegt wenn sie in einem EAR File ist? Hatte sie vorher in einem Jar im Deploy Verzeichnis und konnte sie korrekt folgendermassen angeben:
<classpath codebase="deploy" archives="casex-base-int.jar"/>
Ich habe das Jar nun in ein EAR gepackt und ins deploy Verzeichnis kopiert. Nun weiss ich nicht wie ich den classpath Tag anpassen muss.
Kann mir da jemand helfen?
Vielen Dank
-
Hallo Thomas,
ich habe eine Frage zur scheduler-service.xml
Es gibt zwei Möglichkeiten für diese Datei:
To setup a Scheduler in a service.xml file using a Schedulable class add this code snippet and adjust it to your needs:
<mbean code="org.jboss.util.Scheduler" name=":service=Scheduler">
<attribute name="SchedulableClass">org.jboss.util.Scheduler$SchedulableExample</attribute>
<attribute name="SchedulableArguments">Schedulabe Test,12345</attribute>
<attribute name="SchedulableArgumentTypes">java.lang.String,int</attribute>
<attribute name="InitialStartDate">0</attribute>
<attribute name="SchedulePeriod">10000</attribute>
<attribute name="InitialRepetitions">-1</attribute>
<attribute name="StartAtStartup">true</attribute>
</mbean>
To setup a Scheduler in a service.xml file using a Schedulable MBean add this code snippet and adjust it to your needs:
<mbean code="org.jboss.util.SchedulableExample" name="jboss:type=example,name=schedulable">
</mbean>
<mbean code="org.jboss.util.Scheduler" name="jboss:service=Scheduler">
<attribute name="StartAtStartup">true</attribute>
<attribute name="SchedulableMBean">jboss:type=example,name=schedulable</attribute>
<attribute name="SchedulableMBeanMethod">hit( NOTIFICATION, DATE, REPETITIONS, SCHEDULER_NAME, java.lang.String )</attribute>
<attribute name="InitialStartDate">NOW</attribute>
<attribute name="SchedulePeriod">10000</attribute>
<attribute name="InitialRepetitions">10</attribute>
</mbean>
Du benutzt die erste und was ist der Vorteil von Mbeans?
Danke.
Ähnliche Themen
-
wer kann mir helfen zum thema ik und robotern in cinema bitte bitte
Von o0philipp0o im Forum Cinema 4DAntworten: 2Letzter Beitrag: 08.07.07, 16:46 -
Neuling... Bitte Helfen...
Von illuVision im Forum PhotoshopAntworten: 7Letzter Beitrag: 01.08.06, 18:28 -
Bitte Helfen
Von Nohh im Forum PHPAntworten: 6Letzter Beitrag: 26.09.05, 05:35 -
Wer kann mir da BITTE BITTE helfen
Von Lillymaus im Forum PhotoshopAntworten: 13Letzter Beitrag: 04.01.05, 12:06 -
Bitte bitte helfen: Einbinden unter Knoppix
Von meilon im Forum Linux & UnixAntworten: 1Letzter Beitrag: 01.06.04, 14:04





Zitieren

Login





