This content has been marked as final.
Show 8 replies
-
1. Re: ClassCastException with JBoss 5.0.0 GA and higher
jaikiran Apr 8, 2009 9:46 AM (in response to krum)i have a ClassCastException: can't cas javax.naming.reference to my EJB
See this http://www.jboss.org/index.html?module=bb&op=viewtopic&t=144888#4186763. In JBossAS-4.x, you just needed the jbossall-client.jar in the client classpath. However in JBossAS-5.x, you have to add jbossall-client.jar and all other jars that are in the MANIFEST.MF of that jar file, in the client's classpath. -
2. Re: ClassCastException with JBoss 5.0.0 GA and higher
krum Apr 8, 2009 10:39 AM (in response to krum)there is nothing about the classpath in the manifest of my jbossall-client.jar ... :s
-
3. Re: ClassCastException with JBoss 5.0.0 GA and higher
krum Apr 8, 2009 10:54 AM (in response to krum)i'm sorry, i dont look at the good jar. it's ok, now i'll see if i could get my ejb with JBoss 5.0.1 GA
-
4. Re: ClassCastException with JBoss 5.0.0 GA and higher
krum Apr 8, 2009 11:04 AM (in response to krum)So thanks, it's ok! i can get my ejb, but now i have this exception:
Exception in thread "main" javax.ejb.EJBException: java.lang.IllegalArgumentException: Wrong target. class thales_isr.bean.MissionBean for public thales_isr.pojo.mission.Mission thales_isr.bean.MissionBean.get(java.lang.String) at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:77) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:659) at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53) at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91) at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908) at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230) Caused by: java.lang.IllegalArgumentException: Wrong target. class thales_isr.bean.MissionBean for public thales_isr.pojo.mission.Mission thales_isr.bean.MissionBean.get(java.lang.String) at org.jboss.aop.joinpoint.MethodInvocation.handleErrors(MethodInvocation.java:151) at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.java:126) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:111) at org.jboss.ejb3.EJBContainerInvocationWrapper.invokeNext(EJBContainerInvocationWrapper.java:69) at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.invoke(InterceptorSequencer.java:73) at org.jboss.ejb3.interceptors.aop.InterceptorSequencer.aroundInvoke(InterceptorSequencer.java:59) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.jboss.aop.advice.PerJoinpointAdvice.invoke(PerJoinpointAdvice.java:174) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.fillMethod(InvocationContextInterceptor.java:72) at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_fillMethod_16785420.invoke(InvocationContextInterceptor_z_fillMethod_16785420.java) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor.setup(InvocationContextInterceptor.java:88) at org.jboss.aop.advice.org.jboss.ejb3.interceptors.aop.InvocationContextInterceptor_z_setup_16785420.invoke(InvocationContextInterceptor_z_setup_16785420.java) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:62) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:60) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:56) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:81) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79) at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:190) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.tx.NullInterceptor.invoke(NullInterceptor.java:42) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.security.Ejb3AuthenticationInterceptorv2.invoke(Ejb3AuthenticationInterceptorv2.java:186) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:41) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.BlockContainerShutdownInterceptor.invoke(BlockContainerShutdownInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.currentinvocation.CurrentInvocationInterceptor.invoke(CurrentInvocationInterceptor.java:67) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.stateful.StatefulContainer.dynamicInvoke(StatefulContainer.java:659) at org.jboss.ejb3.session.InvokableContextClassProxyHack._dynamicInvoke(InvokableContextClassProxyHack.java:53) at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:91) at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82) at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:908) at org.jboss.remoting.transport.socket.ServerThread.completeInvocation(ServerThread.java:742) at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:695) at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:522) at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:230) at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:206) at org.jboss.remoting.Client.invoke(Client.java:1708) at org.jboss.remoting.Client.invoke(Client.java:612) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:60) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62) at $Proxy3.invoke(Unknown Source) at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261) at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101) at $Proxy2.remove(Unknown Source) at thales_isr.test.Main.main(Main.java:495) at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:72) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.security.client.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:65) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:74) at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102) at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:62) at $Proxy3.invoke(Unknown Source) at org.jboss.ejb3.proxy.handler.ProxyInvocationHandlerBase.invoke(ProxyInvocationHandlerBase.java:261) at org.jboss.ejb3.proxy.handler.session.SessionSpecProxyInvocationHandlerBase.invoke(SessionSpecProxyInvocationHandlerBase.java:101) at $Proxy2.remove(Unknown Source) at thales_isr.test.Main.main(Main.java:495)
but it works with JBoss 4.2.2 GA... so i don't understand...
can you help me again? -
5. Re: ClassCastException with JBoss 5.0.0 GA and higher
jaikiran Apr 8, 2009 11:20 AM (in response to krum)at $Proxy2.remove(Unknown Source)
at thales_isr.test.Main.main(Main.java:495)
Could you please post the bean code and the client code? And is this EJB3 or EJB2.x? -
6. Re: ClassCastException with JBoss 5.0.0 GA and higher
krum Apr 9, 2009 3:41 AM (in response to krum)this is EJB3
the bean code:/** * */ package thales_isr.bean; import java.util.ArrayList; import java.util.List; import javax.ejb.Stateful; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import appli.persist.ComintPojo; import appli.pojo.mission.Barrage_JT; import appli.pojo.mission.Barrage_Threat; import appli.pojo.mission.Barrage_jamming_params; import appli.pojo.mission.FFMT; import appli.pojo.mission.FFMT_Surv_Discrete_Freq; import appli.pojo.mission.FFST; import appli.pojo.mission.FFST_Surv_Freq_Plan; import appli.pojo.mission.Frequency_Channel; import appli.pojo.mission.Jamming_Freq_Sub_Range; import appli.pojo.mission.Jamming_Frequency_Plan; import appli.pojo.mission.Jamming_Frequency_Range; import appli.pojo.mission.List_Tech_Analysis_Params; import appli.pojo.mission.Mission; import appli.pojo.mission.Selective_JT; import appli.pojo.mission.Selective_Jamming_Params; import appli.pojo.mission.Station; import appli.pojo.mission.Task; /** * @author krumula * @param <Mission> * */ @Stateful public class MissionBean implements ComintPojo<Mission> { @PersistenceContext(unitName="persist") EntityManager em; /** * this method update a mission * @see appli.persist.ComintPojo#update(java.lang.Object) */ @Override public void update(Mission pojo) { ArrayList<Barrage_jamming_params> bjpList = getBarrageJammingParams(pojo); ArrayList<List_Tech_Analysis_Params> ltapList = getListTechAnalysisParams(pojo); ArrayList<Selective_Jamming_Params> sjpList = getSelectiveJammingParams(pojo); update(bjpList, ltapList, sjpList); em.merge(pojo); } /** * This method save or update the objects need to be saved before the mission * @param bjpList * @param ltapList * @param sjpList */ private void update(ArrayList<Barrage_jamming_params> bjpList, ArrayList<List_Tech_Analysis_Params> ltapList, ArrayList<Selective_Jamming_Params> sjpList) { for (Selective_Jamming_Params sjp : sjpList) { em.merge(sjp); } for (Barrage_jamming_params bjp : bjpList) { em.merge(bjp); } for (List_Tech_Analysis_Params ltap : ltapList) { em.merge(ltap); } } /** * this method get the mission which have this primary key * @see appli.persist.ComintPojo#get(java.lang.String) */ @Override public Mission get(String primaryKey) { return em.getReference(Mission.class, primaryKey); } /** * this method get a list of Mission which correspond of the request * @see appli.persist.ComintPojo#listOf(java.lang.String) */ @SuppressWarnings("unchecked") @Override public List<Mission> listOf(String request) { ArrayList<Mission> result = (ArrayList<Mission>) em.createQuery(request).getResultList(); return result; } /** * this method remove a mission * @see appli.persist.ComintPojo#remove(java.lang.Object) */ @Override public void remove(Mission pojo) { Mission result = em.merge(pojo); em.remove(result); } /** * this method save a mission * @see appli.persist.ComintPojo#save(java.lang.Object) */ @Override public void save(Mission pojo) { ArrayList<Barrage_jamming_params> bjpList = getBarrageJammingParams(pojo); ArrayList<List_Tech_Analysis_Params> ltapList = getListTechAnalysisParams(pojo); ArrayList<Selective_Jamming_Params> sjpList = getSelectiveJammingParams(pojo); save(bjpList, ltapList, sjpList); em.persist(pojo); } /** * This method save or update the objects need to be saved before the mission * @param bjpList * @param ltapList * @param sjpList */ private void save(ArrayList<Barrage_jamming_params> bjpList, ArrayList<List_Tech_Analysis_Params> ltapList, ArrayList<Selective_Jamming_Params> sjpList) { for (Selective_Jamming_Params sjp : sjpList) { em.persist(sjp); } for (Barrage_jamming_params bjp : bjpList) { em.persist(bjp); } for (List_Tech_Analysis_Params ltap : ltapList) { em.persist(ltap); } } /** * Get the list of Barrage_Jamming_Params to save or update before the persistence of the mission * @param pojo * @return list the list of Barrage_Jamming_Params */ private ArrayList<Barrage_jamming_params> getBarrageJammingParams( Mission pojo) { ArrayList<Barrage_jamming_params> list = new ArrayList<Barrage_jamming_params>(); for (Station station : pojo.getStations()) { for (Task task : station.getTaches()) { if(task instanceof Barrage_JT){ for (Barrage_Threat bt : ((Barrage_JT) task).getBarrageThreat()) { list.add(bt.getParams()); } } } } return list; } /** * Get the list of List_Tech_Analysis_Params to save or update before the persistence of the mission * @param pojo * @return list the list of List_Tech_Analysis_Params */ private ArrayList<List_Tech_Analysis_Params> getListTechAnalysisParams( Mission pojo) { ArrayList<List_Tech_Analysis_Params> list = new ArrayList<List_Tech_Analysis_Params>(); for (Station station : pojo.getStations()) { for (Task task : station.getTaches()) { if(task instanceof FFST){ list.add(((FFST_Surv_Freq_Plan)((FFST) task).getFfstSurFreqPlan()).getTechAnalysis()); } else if (task instanceof FFMT){ for(FFMT_Surv_Discrete_Freq freq :((FFMT) task).getDiscreteFrq()) { list.add(freq.getTechAnalysis()); } } } } return list; } /** * Get the list of Selective_Jamming_Params to save or update before the persistence of the mission * @param pojo * @return list the list of Selective_Jamming_Params */ private ArrayList<Selective_Jamming_Params> getSelectiveJammingParams( Mission pojo) { ArrayList<Selective_Jamming_Params> list = new ArrayList<Selective_Jamming_Params>(); for (Station station : pojo.getStations()) { for (Task task : station.getTaches()) { if(task instanceof Selective_JT){ for(Jamming_Frequency_Plan freq :((Selective_JT) task).getJammingFreqPlan()) { for(Frequency_Channel channel :freq.getFreqChannel()) { list.add(channel.getSelectJammingParams()); } } for(Jamming_Frequency_Range freq :((Selective_JT) task).getJammingFreqRange()) { for(Jamming_Freq_Sub_Range range :freq.getFreqSubRange()) { list.add(range.getSelectJammingParams()); } } } } } return list; } }
and the client code:package appli.test; import java.util.Date; import java.util.HashSet; import java.util.Properties; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import appli.persist.GestionPojo; import appli.pojo.mission.Antenna; import appli.pojo.mission.AttachedFile; import appli.pojo.mission.Barrage_JT; import appli.pojo.mission.Barrage_Threat; import appli.pojo.mission.Barrage_jamming_params; import appli.pojo.mission.FFMT; import appli.pojo.mission.FFMT_Surv_Discrete_Freq; import appli.pojo.mission.FFST; import appli.pojo.mission.FFST_Surv_Freq_Plan; import appli.pojo.mission.Frequency_Channel; import appli.pojo.mission.Jamming_Freq_Sub_Range; import appli.pojo.mission.Jamming_Frequency_Plan; import appli.pojo.mission.Jamming_Frequency_Range; import appli.pojo.mission.List_Tech_Analysis_Params; import appli.pojo.mission.Maneuver; import appli.pojo.mission.Masked_Frequency; import appli.pojo.mission.Masked_Sub_Band; import appli.pojo.mission.Mission; import appli.pojo.mission.Mission_Entity_Link; import appli.pojo.mission.Protected_Sub_Bands; import appli.pojo.mission.Selective_JT; import appli.pojo.mission.Selective_Jamming_Params; import appli.pojo.mission.Station; import appli.pojo.mission.Task; import appli.pojo.mission.Threat_Sub_Range; public class Main { /** * @param args * @throws NamingException */ public static void main(String[] args) throws NamingException { Mission mission = new Mission(); mission.setActing_operator_name("Mathieu"); mission.setComment("mission de test"); mission.setCreation_date(new Date(2009,01,21)); mission.setCreator_operator_name("remi"); mission.setCreator_position_name("bureau"); mission.setCreator_station_name("ifass-12"); mission.setEffective_end_date(new Date(2009,03,20)); mission.setEffective_start_date(new Date(2009,03,20)); mission.setMission_ID("mission-1"); mission.setName("ma mission"); mission.setPlanned_end_date(new Date(2009,03,19)); mission.setPlanned_start_date(new Date(2009,03,19)); mission.setStatus(2); mission.setStatus_comment("en cours de réalisation par mathieu"); AttachedFile file = new AttachedFile(); file.setCREATION_DATE(new Date(2009,03,20)); file.setDIRECTORY("c:"); file.setEXTENSION(".txt"); file.setFILE_ID("fichier-1"); file.setMission(mission); file.setNAME("fichier"); HashSet<AttachedFile> afList = new HashSet<AttachedFile>(); afList.add(file); mission.setFiles(afList); Mission_Entity_Link mel = new Mission_Entity_Link(); mel.setEntityID("entite-1"); mel.setEntityTableName("table_entite"); mel.setLink_ID("link-1"); mel.setMission(mission); HashSet<Mission_Entity_Link> melSet = new HashSet<Mission_Entity_Link>(); melSet.add(mel); mission.setEntities(melSet); Station station = new Station(); station.setDeploymentComment("deployer"); station.setDeploymentStatus(2); station.setMission(mission); station.setNAME("station 1"); station.setSTATION_ID("station-1"); Maneuver maneuver = new Maneuver(); maneuver.setEffectiveArrivalDate(new Date(2009,03,20)); maneuver.setEffectiveDepartureDate(new Date(2009,03,20)); maneuver.setLatitude(524655); maneuver.setLongitude(688899); maneuver.setManeuver_ID("maneuver-1"); maneuver.setPlannedArrivalDate(new Date(2009,03,20)); maneuver.setPlannedDepartureDate(new Date(2009,03,20)); maneuver.setStation(station); HashSet<Maneuver> maneuverSet = new HashSet<Maneuver>(); maneuverSet.add(maneuver); station.setManoeuvres(maneuverSet); Antenna antenna = new Antenna(); antenna.setAntenna_ID("antenne-1"); antenna.setManeuver(maneuver); antenna.setAntennaName("antenne"); antenna.setElevation(2); antenna.setOrientation(4); antenna.setRfChannelChildren(6); antenna.setRfChannelNnp1(7); antenna.setRfChannelParent(8); HashSet<Antenna> antennaSet = new HashSet<Antenna>(); antennaSet.add(antenna); maneuver.setAntennes(antennaSet); Barrage_JT bjt= new Barrage_JT(); bjt.setActing_operator_name("remi"); bjt.setAutomatic(5); bjt.setComment("tache en cours d'exectuion"); bjt.setCreation_date(new Date(2008,12,28)); bjt.setCreator_operator_name("sebastien"); bjt.setCreator_position_name("CTS"); bjt.setCreator_station_name("machine-2"); bjt.setEffective_end_date(new Date(2009,03,19)); bjt.setEffective_start_date(new Date(2009,03,18)); bjt.setExecutingPosition("desert"); bjt.setName("task 1"); bjt.setBarrageEqiptType(3); bjt.setPlanned_end_date(new Date(2009,03,19)); bjt.setPlanned_start_date(new Date(2009,03,18)); bjt.setPriority(2); bjt.setStation(station); bjt.setStatus(1); bjt.setStatus_comment("en cours..."); bjt.setTask_ID("bjt-1"); bjt.setTaskType(1); bjt.setValidationComment("en attente"); Protected_Sub_Bands psb = new Protected_Sub_Bands(); psb.setSubBandID("subBand-1"); psb.setTask(bjt); psb.setFreqMax(5000); psb.setFreqMin(2500); HashSet<Protected_Sub_Bands> psbSet = new HashSet<Protected_Sub_Bands>(); psbSet.add(psb); bjt.setProtectedSubBand(psbSet); Barrage_Threat bt = new Barrage_Threat(); bt.setEquipmentTypeName("equipement 1"); bt.setThreatID("bt-1"); bt.setDetectionRate(4); bt.setPowerLevel(5); bt.setSequentialStep(7); bt.setTask(bjt); bt.setThresholdMax(500); bt.setThresholdMin(250); Barrage_jamming_params bjp = new Barrage_jamming_params(); bjp.setParamID("bjp-1"); bjp.setJammingSpeed(12); bjp.setJitter(15); bt.setParams(bjp); HashSet<Barrage_Threat> btSet = new HashSet<Barrage_Threat>(); btSet.add(bt); bjp.setBarrageThreat(btSet); bjt.setBarrageThreat(btSet); Threat_Sub_Range tsr = new Threat_Sub_Range(); tsr.setBarrageThreat(bt); tsr.setFreqMax(5000); tsr.setFreqMin(2500); tsr.setSubRangeID("sub-range-1"); HashSet<Threat_Sub_Range> tsbSet = new HashSet<Threat_Sub_Range>(); tsbSet.add(tsr); bt.setSubRange(tsbSet); Selective_JT sjt = new Selective_JT(); sjt.setActing_operator_name("edouard"); sjt.setAutomatic(5); sjt.setComment("tache en cours d'exectuion"); sjt.setCreation_date(new Date(2008,12,28)); sjt.setCreator_operator_name("philippe"); sjt.setCreator_position_name("CRV"); sjt.setCreator_station_name("machine-1"); sjt.setEffective_end_date(new Date(2009,03,01)); sjt.setEffective_start_date(new Date(2009,02,20)); sjt.setExecutingPosition("desert"); sjt.setName("task 2"); sjt.setPlanned_end_date(new Date(2009,02,26)); sjt.setPlanned_start_date(new Date(2009,02,20)); sjt.setPriority(2); sjt.setStation(station); sjt.setStatus(1); sjt.setStatus_comment("en cours..."); sjt.setTask_ID("sjt-1"); sjt.setTaskType(1); sjt.setValidationComment("en attente"); Protected_Sub_Bands psb2 = new Protected_Sub_Bands(); psb2.setSubBandID("subBand-2"); psb2.setTask(sjt); psb2.setFreqMax(5000); psb2.setFreqMin(2500); HashSet<Protected_Sub_Bands> psbSet2 = new HashSet<Protected_Sub_Bands>(); psbSet2.add(psb2); sjt.setProtectedSubBand(psbSet2); Selective_Jamming_Params sjp = new Selective_Jamming_Params(); sjp.setChirpBand(1); sjp.setCombBand(2); sjp.setCombOfRay(3); sjp.setDetectionFilter(4); sjp.setFrequencyDelta(5); sjp.setJammingSpeed(6); sjp.setJammingStep(7); sjp.setJammingTime(8); sjp.setJitter(9); sjp.setLateralBand(10); sjp.setModulation(11); sjp.setModulationRate(12); sjp.setNoise(13); sjp.setOffsetFreq(14); sjp.setParamID("param-1"); sjp.setSpectrumWidth(15); sjp.setSpeedBauds(16); sjp.setSpeedBits(17); sjp.setTone1(18); sjp.setTone2(19); Jamming_Frequency_Plan jfp = new Jamming_Frequency_Plan(); jfp.setPlanID("jfp-1"); jfp.setDynamicEqiptTypeID(3); jfp.setJst(sjt); jfp.setPriority(1); jfp.setSequential(5); Frequency_Channel fc = new Frequency_Channel(); fc.setCentralFreq(3600); fc.setChannelID("channel-1"); fc.setEquipmentTypeName("equipement-1"); fc.setJammingFreqPlan(jfp); fc.setPowerLevel(5); fc.setSelectJammingParams(sjp); fc.setSystematicJamming(9); fc.setThresholdMax(5000); fc.setThresholdMin(345); HashSet<Frequency_Channel> freqChannel = new HashSet<Frequency_Channel>(); freqChannel.add(fc); jfp.setFreqChannel(freqChannel); sjp.setFreqChannel(freqChannel); HashSet<Jamming_Frequency_Plan> jammingFreqPlan = new HashSet<Jamming_Frequency_Plan>(); sjt.setJammingFreqPlan(jammingFreqPlan); Jamming_Frequency_Range jfr = new Jamming_Frequency_Range(); jfr.setDynamicEqiptTypeID(1); jfr.setFreqRangeID("freqRange-1"); jfr.setJst(sjt); jfr.setPriority(2); jfr.setSequential(3); Jamming_Freq_Sub_Range jfsr = new Jamming_Freq_Sub_Range(); jfsr.setEquipmentTypeName("equipement jsfr"); jfsr.setFreqMax(5000); jfsr.setFreqMin(2500); jfsr.setJammingFreqRange(jfr); jfsr.setPowerLevel(1); jfsr.setSelectJammingParams(sjp); jfsr.setSubRangeID("freqSubRange-1"); jfsr.setThresholdMax(500); jfsr.setThresholdMin(150); HashSet<Jamming_Freq_Sub_Range> jammingFreqSubRange = new HashSet<Jamming_Freq_Sub_Range>(); jammingFreqSubRange.add(jfsr); jfr.setFreqSubRange(jammingFreqSubRange); sjp.setFreqSubRange(jammingFreqSubRange); HashSet<Jamming_Frequency_Range> jammingFreqRange = new HashSet<Jamming_Frequency_Range>(); jammingFreqRange.add(jfr); sjt.setJammingFreqRange(jammingFreqRange); Masked_Frequency mf = new Masked_Frequency(); mf.setBandwidth(4900); mf.setJst(sjt); mf.setMaskedFreqID("maskedFrequency-1"); mf.setFreq(5000); HashSet<Masked_Frequency> maskedFreq = new HashSet<Masked_Frequency>(); maskedFreq.add(mf); sjt.setMaskedFreq(maskedFreq); Masked_Sub_Band msb = new Masked_Sub_Band(); msb.setJst(sjt); msb.setFreqMax(5000); msb.setFreqMin(2500); msb.setMaskedSubBandID("MaskedSubBand-1"); HashSet<Masked_Sub_Band> maskedSubBand = new HashSet<Masked_Sub_Band>(); maskedSubBand.add(msb); sjt.setMaskedSubBand(maskedSubBand); FFMT ffmt = new FFMT(); ffmt.setActing_operator_name("pascal"); ffmt.setAutomatic(5); ffmt.setComment("tache en cours d'exectuion"); ffmt.setCreation_date(new Date(2008,11,21)); ffmt.setCreator_operator_name("fred"); ffmt.setCreator_position_name("DTD"); ffmt.setCreator_station_name("machine-1"); ffmt.setEffective_end_date(new Date(2009,02,01)); ffmt.setEffective_start_date(new Date(2009,01,20)); ffmt.setExecutingPosition("foret"); ffmt.setName("task 3"); ffmt.setPlanned_end_date(new Date(2009,02,05)); ffmt.setPlanned_start_date(new Date(2009,01,20)); ffmt.setPriority(2); ffmt.setStation(station); ffmt.setStatus(1); ffmt.setStatus_comment("en cours..."); ffmt.setTask_ID("ffmt-1"); ffmt.setTaskType(1); ffmt.setValidationComment("en attente"); ffmt.setDetectionFilter(6); Protected_Sub_Bands psb3 = new Protected_Sub_Bands(); psb3.setSubBandID("subBand-3"); psb3.setTask(ffmt); psb3.setFreqMax(5000); psb3.setFreqMin(2500); HashSet<Protected_Sub_Bands> psbSet3 = new HashSet<Protected_Sub_Bands>(); psbSet3.add(psb3); ffmt.setProtectedSubBand(psbSet3); List_Tech_Analysis_Params ltap = new List_Tech_Analysis_Params(); ltap.setAlphabet("abcdefgh"); ltap.setBandwith(4900); ltap.setBfo(4); ltap.setCodingProcess("en cours..."); ltap.setFskShift(5); ltap.setIntegerOfModulationStates(6); ltap.setModulation(7); ltap.setParamID("ltap-1"); ltap.setSpeed(8); ltap.setSubCarrierFreq(9); FFMT_Surv_Discrete_Freq ffmtsdf = new FFMT_Surv_Discrete_Freq(); ffmtsdf.setDiscreteFreqID("ffmtsdf-1"); ffmtsdf.setEquipmentTypeName("ffmt equipement"); ffmtsdf.setFfmt(ffmt); ffmtsdf.setFreq(4500); ffmtsdf.setRFHeadPosition(5); ffmtsdf.setThresholdMax(2500); ffmtsdf.setThresholdMin(1000); ffmtsdf.setTechAnalysis(ltap); HashSet<FFMT_Surv_Discrete_Freq> ffmtsdfSet = new HashSet<FFMT_Surv_Discrete_Freq>(); ffmtsdfSet.add(ffmtsdf); ltap.setDiscreteFreq(ffmtsdfSet); ffmt.setDiscreteFrq(ffmtsdfSet); Masked_Frequency mf2 = new Masked_Frequency(); mf2.setBandwidth(3900); mf2.setFfmt(ffmt); mf2.setMaskedFreqID("maskedFrequency-2"); mf2.setFreq(6000); HashSet<Masked_Frequency> maskedFreq2 = new HashSet<Masked_Frequency>(); maskedFreq2.add(mf2); ffmt.setMaskedFreq(maskedFreq2); Masked_Sub_Band msb2 = new Masked_Sub_Band(); msb2.setFfmt(ffmt); msb2.setFreqMax(3500); msb2.setFreqMin(1500); msb2.setMaskedSubBandID("MaskedSubBand-2"); HashSet<Masked_Sub_Band> maskedSubBand2 = new HashSet<Masked_Sub_Band>(); maskedSubBand2.add(msb2); ffmt.setMaskedSubBand(maskedSubBand2); FFST ffst = new FFST(); ffst.setActing_operator_name("pierre"); ffst.setAutomatic(5); ffst.setComment("tache en cours d'exectuion"); ffst.setCreation_date(new Date(2008,11,11)); ffst.setCreator_operator_name("vincent"); ffst.setCreator_position_name("DCD"); ffst.setCreator_station_name("machine-8"); ffst.setEffective_end_date(new Date(2009,02,01)); ffst.setEffective_start_date(new Date(2009,01,20)); ffst.setExecutingPosition("street"); ffst.setName("task 4"); ffst.setPlanned_end_date(new Date(2009,02,01)); ffst.setPlanned_start_date(new Date(2009,01,15)); ffst.setPriority(2); ffst.setStation(station); ffst.setStatus(1); ffst.setStatus_comment("en cours..."); ffst.setTask_ID("ffst-1"); ffst.setTaskType(1); ffst.setValidationComment("en attente"); Protected_Sub_Bands psb4 = new Protected_Sub_Bands(); psb4.setSubBandID("subBand-4"); psb4.setTask(ffst); psb4.setFreqMax(5000); psb4.setFreqMin(2500); HashSet<Protected_Sub_Bands> psbSet4 = new HashSet<Protected_Sub_Bands>(); psbSet4.add(psb4); ffst.setProtectedSubBand(psbSet4); List_Tech_Analysis_Params ltap2 = new List_Tech_Analysis_Params(); ltap2.setAlphabet("ijklmnop"); ltap2.setBandwith(3600); ltap2.setBfo(4); ltap2.setCodingProcess("en cours..."); ltap2.setFskShift(5); ltap2.setIntegerOfModulationStates(6); ltap2.setModulation(7); ltap2.setParamID("ltap-2"); ltap2.setSpeed(8); ltap2.setSubCarrierFreq(9); FFST_Surv_Freq_Plan ffstsfp = new FFST_Surv_Freq_Plan(); ffstsfp.setSurvFreqPlanID("ffstsfp-1"); ffstsfp.setEquipmentTypeName("ffst equipement"); ffstsfp.setFfst(ffst); ffstsfp.setFreqMax(5000); ffstsfp.setFreqMin(2500); ffstsfp.setRFHeadPosition(5); ffstsfp.setThresholdMax(2500); ffstsfp.setThresholdMin(1000); ffstsfp.setTechAnalysis(ltap); ffstsfp.setScanningStep(9); HashSet<FFMT_Surv_Discrete_Freq> ffstsfpSet = new HashSet<FFMT_Surv_Discrete_Freq>(); ffstsfpSet.add(ffmtsdf); ltap2.setDiscreteFreq(ffstsfpSet); ffst.setFfstSurFreqPlan(ffstsfp); Masked_Frequency mf3 = new Masked_Frequency(); mf3.setBandwidth(3900); mf3.setFfst(ffst); mf3.setMaskedFreqID("maskedFrequency-3"); mf3.setFreq(6000); HashSet<Masked_Frequency> maskedFreq3 = new HashSet<Masked_Frequency>(); maskedFreq3.add(mf3); ffst.setMaskedFreq(maskedFreq3); Masked_Sub_Band msb3 = new Masked_Sub_Band(); msb3.setFfst(ffst); msb3.setFreqMax(3500); msb3.setFreqMin(1500); msb3.setMaskedSubBandID("MaskedSubBand-3"); HashSet<Masked_Sub_Band> maskedSubBand3 = new HashSet<Masked_Sub_Band>(); maskedSubBand3.add(msb3); ffst.setMaskedSubBand(maskedSubBand3); HashSet<Task> taskSet = new HashSet<Task>(); taskSet.add(bjt); taskSet.add(sjt); taskSet.add(ffmt); taskSet.add(ffst); station.setTaches(taskSet); HashSet<Station> stationSet = new HashSet<Station>(); stationSet.add(station); mission.setStations(stationSet); Properties prop=new Properties(); prop.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); prop.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces"); prop.put(Context.PROVIDER_URL,"jnp://localhost:1099"); Context context = new InitialContext(prop); GestionPojo<Mission> pojo = (GestionPojo<Mission>) context.lookup("GestionPojoBean/remote"); pojo.remove(st); } }
-
7. Re: ClassCastException with JBoss 5.0.0 GA and higher
krum Apr 15, 2009 3:23 AM (in response to krum)have you got an idea?
-
8. Re: ClassCastException with JBoss 5.0.0 GA and higher
jaikiran Apr 15, 2009 12:59 PM (in response to krum)Could you try renaming the "remove" method on the Stateful bean (and its interface) to something else. Example:
/** * this method remove a mission * @see appli.persist.ComintPojo#remove(java.lang.Object) */ @Override public void testingRemove(Mission pojo) { Mission result = em.merge(pojo); em.remove(result); }
And then in client:pojo.testingRemove(st)
Let us know how it goes.