java.lang.ClassCastException, jboss-4.0.3SP1, JMX service, webservice

View: New views
3 Messages — Rating Filter:   Alert me  

java.lang.ClassCastException, jboss-4.0.3SP1, JMX service, webservice

by popianovka :: Rate this Message:

| View Threaded | Show Only this Message

[u][b]Problem :[/b][/u]
I'm try to use the lookup("Quartz") Scheduler object, but can't cast it. I'm getting
a ClassCastException. I'm doing this in a webservice methode..
(using netbeans 9 beta). Datasource and JMX Quartz service seem to be installed in Jboss....

If You look at the test code I have written, It seems that the reference to a Schedule object exists !

What s wrong ?

Thanks !
[i](I have tried usinging the Quarts servlet, but how should I get the servlet context from a webservice methode (axis) ?)[/i]

[u][b]Code:[/b][/u]
InitialContext iniCtx = new InitialContext();
Object a = iniCtx.lookup(jndiName);
String aa= a.getClass().toString();
String aaa=a.toString();
System.out.println(aa);  --->SHOWS "class org.quartz.impl.StdScheduler"
System.out.println(aaa); -->SHOWS "org.quartz.impl.StdScheduler@1891842"

 try{org.quartz.Scheduler s=(org.quartz.Scheduler)a;} catch(Exception ee) {System.out.println(ee);}
->SHOWS  
":java.lang.ClassCastException:org.quartz.impl.StdScheduler"          

try{org.quartz.impl.StdScheduler ss=(org.quartz.impl.StdScheduler)a;} catch(Exception eee){System.out.println(eee);}
-->SHOWS
java.lang.ClassCastException: org.quartz.impl.StdScheduler


[u][b]noquartzjtds-ds.xml[/b][/u]

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <no-tx-datasource>
    <jndi-name>jdbc/QuartzDSjensen</jndi-name>
    <connection-url>jdbc:jtds:sqlserver://localhost:1433/quartz;tds=8.0;lastupdatecount=true</connection-url>
    <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
    <user-name>sa</user-name>
    <password>123456</password>
    <min-pool-size>5</min-pool-size>
    <max-pool-size>20</max-pool-size>
    <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>      
  </no-tx-datasource>
</datasources>


[u][b]JBOSS quartz-service.xml file :[/b][/u]

<?xml version="1.0" encoding="UTF-8"?>
<server>
  <classpath codebase="." archives="jtds-1.2.jar"/>
  <mbean code="org.quartz.ee.jmx.jboss.QuartzService"
      name="user:service=QuartzService,name=QuartzService">
     <depends>jboss.jca:service=DataSourceBinding,name=QuartzDS</depends>    
   <attribute name="Properties">
      # Default Properties file for use by StdSchedulerFactory
      # to create a Quartz Scheduler Instance, if a different
      # properties file is not explicitly specified.
      # org.quartz.impl.jdbcjobstore.JobStoreCMT
      # org.quartz.scheduler.classLoadHelper.class =
     
      org.quartz.scheduler.instanceName = DefaultQuartzScheduler
      org.quartz.scheduler.rmi.export = false
      org.quartz.scheduler.rmi.proxy = false
      org.quartz.scheduler.xaTransacted = false
      # jobStore
      org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
      org.quartz.jobStore.driverDelegateClass =  org.quartz.impl.jdbcjobstore.MSSQLDelegate
      org.quartz.jobStore.dataSource = HKTGANDS
      # org.quartz.jobStore.nonManagedTXDataSource =
      org.quartz.jobStore.tablePrefix = QRTZ_
      #ThreadPool
      org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool
      org.quartz.threadPool.threadCount = 5
      org.quartz.threadPool.threadPriority = 4
      # dataSource
      org.quartz.dataSource.HKTGANDS.jndiURL = java:QuartzDS
    </attribute>
   </mbean>
</server>
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=22945&messageID=44343#44343

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: java.lang.ClassCastException, jboss-4.0.3SP1, JMX service, webservice

by popianovka :: Rate this Message:

| View Threaded | Show Only this Message

This is probably a classloading issue.  Make sure the quartz jars are in one place, and that they aren't being loaded twice, once by your web app and once by your j2ee app.  (You can look at the two StdScheduler classloaders to verify my theory)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=22945&messageID=44346#44346

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: java.lang.ClassCastException, jboss-4.0.3SP1, JMX service, webservice

by popianovka :: Rate this Message:

| View Threaded | Show Only this Message

Thanks !

It solved the problem !

I let the Jboss keep the the jar files (Server/lib) because of the JMX Quarts managed bean.¨

I deployed the war file without the Quartz files (webservice services), and now it works !

Tore Gard Andersen
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=22945&messageID=44518#44518

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...