[JBoss-user] [Persistence,JBoss/CMP, Hibernate, Database] - Re: EJB CMP problem with Hibernate
Hi. It works well now. I had forgotten to change the hibernate property transaction.factory_class to org.hibernate.transaction.JTATransactionFactory With this change, all it works well. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3892192#3892192 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3892192 --- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence,JBoss/CMP, Hibernate, Database] - EJB CMP problem with Hibernate
Hi, all. I have an application with JBoss 4.0.2 with Hibernate 3 and Jbpm 3. Also, the application has an EJB to give remote access to the application. The issue is that my first intention was to have a CMT EJB. In this way, my application didn't have any persistent code (no transaction was started , commited or rollbacked). The method only gets a JbpmSession (a Jbpm object that wraps an Hibernate Session object) and closes it at its end. On the other hand, the ejb-jar.xml has the next code | | | http://java.sun.com/dtd/ejb-jar_2_0.dtd";> | | | | | | | | EJB Gateway entre la aplicaciĆ³n stand-alone SWING de Savia y la interfaz de reglas de negocio de la Web del Funcionario | WorkFlow | | WorkFlow | | org.ildefe.ejb.interfaces.WorkFlowHome | org.ildefe.ejb.interfaces.WorkFlow | org.ildefe.ejb.interfaces.WorkFlowLocalHome | org.ildefe.ejb.interfaces.WorkFlowLocal | org.ildefe.ejb.impl.WorkFlowSession | Stateless | Container | | | | | | | | | WorkFlow | * | | Required | | | | | But, when I executed a method that writes data in the DB, the method works well (no exception is thrown and the return value is correct), but NO COMMIT was executed by the container on the DB ,i.e., the data was not persisted in the DB. So, I had to change to BMP instead CMP. In the new EJB the data is persisted (in the code, I begin the transaction and commit the transaction). Why doesn't CMP work well? Thanks in advance to any comment. Bye. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3891789#3891789 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3891789 --- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Persistence,JBoss/CMP, Hibernate, Database] - AbstractPersistetCollection local class incompatible
Hi, all. I'm developing an application in JBoss 4.0.2 with Hibernate 3 and Jbpm 3. Also, I have an EJB for give access to a Swing remote client. Also, the EJB is a BMP (I'm going to put another topic that why I've chosed BMP instead CMP, beacuse something was wrong). I have the next problem: If I call the next method of the EJB List getInstancesByUser(Tercero user){ ... } I obtain the next exception: | | java.lang.reflect.UndeclaredThrowableException | at $Proxy1.executeCommand(Unknown Source) | at test.command.WorkFlowEJBTerceroCommandTest.testClientEJB(WorkFlowEJBTerceroCommandTest.java:28) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:324) | at junit.framework.TestCase.runTest(TestCase.java:154) | at junit.framework.TestCase.runBare(TestCase.java:127) | at junit.framework.TestResult$1.protect(TestResult.java:106) | at junit.framework.TestResult.runProtected(TestResult.java:124) | at junit.framework.TestResult.run(TestResult.java:109) | at junit.framework.TestCase.run(TestCase.java:118) | at junit.framework.TestSuite.runTest(TestSuite.java:208) | at junit.framework.TestSuite.run(TestSuite.java:203) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194) | Caused by: java.io.InvalidClassException: org.hibernate.collection.AbstractPersistentCollection; local class incompatible: stream classdesc serialVersionUID = 7663409046372276524, local class serialVersionUID = -7982170513654570219 | at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:463) | at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521) | at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435) | at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521) | at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435) | at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626) | at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274) | at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845) | at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769) | at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646) | at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274) | at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845) | at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769) | at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646) | at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274) | at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324) | at java.util.ArrayList.readObject(ArrayList.java:547) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:324) | at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:838) | at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1746) | at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646) | at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274) | at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1845) | at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1769) | at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1646) | at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274) | at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324) | at java.rmi.MarshalledObject.get(MarshalledObject.java:135) | at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:119) | at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227) | at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167) | at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46) | at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)No existen tramites para el tercero cuyo dni es
[JBoss-user] [EJB/JBoss] - Re: EJB Strange ClassCastException
Hi, all. It works well!! I was using MyEclipse to create the EAR of my application. By default, the MyEclipse adds the dependant Java projects (in this case, the App.jar, where resides my business rules) to the WEB-INF/lib of the WAR file. I've changed this default behaviour and now it works (one of the class where I was getting the ClassCastException was loaded by the WebClassloader). View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3891019#3891019 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3891019 --- SF.Net email is Sponsored by the Better Software Conference & EXPO September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: EJB Strange ClassCastException
OK. I think this is the typical case when the class bytecode is equal, but the classes are loaded by different classloaders (if this was not the case, the web application would fail and the application only fails when I access it through the EJB). In any case, here is the trace of the exception: | 14:34:37,859 ERROR [LogInterceptor] EJBException in method: public abstract org.ildefe.webfciobusiness.command.interfaces.Command org.ildefe.ejb.interfaces.WorkFlow.executeCommand(org.ildefe.webfciobusiness.command.interfaces.Command) throws java.rmi.RemoteException,javax.ejb.EJBException, causedBy: | org.ildefe.webfciobusiness.exceptions.AppException | at org.ildefe.webfciobusiness.command.impl.TerceroCommand.execute(TerceroCommand.java:61) | at org.ildefe.ejb.impl.WorkFlow.executeCommand(WorkFlow.java:69) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:324) | at org.jboss.invocation.Invocation.performCall(Invocation.java:345) | at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:214) | at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185) | at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:130) | at org.jboss.webservice.server.ServiceEndpointInterceptor.invoke(ServiceEndpointInterceptor.java:51) | at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48) | at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105) | at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:335) | at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:166) | at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:139) | at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192) | at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122) | at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:624) | at org.jboss.ejb.Container.invoke(Container.java:873) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:324) | at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141) | at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80) | at org.jboss.mx.server.Invocation.invoke(Invocation.java:72) | at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249) | at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644) | at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:805) | at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:406) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:324) | at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) | at sun.rmi.transport.Transport$1.run(Transport.java:148) | at java.security.AccessController.doPrivileged(Native Method) | at sun.rmi.transport.Transport.serviceCall(Transport.java:144) | at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460) | at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701) | at java.lang.Thread.run(Thread.java:534) | Caused by: java.lang.ClassCastException | at org.ildefe.webfciobusiness.dao.impl.UsuarioDAOHibernateImpl.getTerceroByDNI(UsuarioDAOHibernateImpl.java:83) | at org.ildefe.webfciobusiness.command.impl.TerceroCommand.execute(TerceroCommand.java:53) | ... 41 more | Causada por: | java.lang.ClassCastException | at org.ildefe.webfciobusiness.dao.impl.UsuarioDAOHibernateImpl.getTerceroByDNI(UsuarioDAOHibernateImpl.java:83) | at org.ildefe.webfciobusiness.command.impl.TerceroCommand.execute(TerceroCommand.java:53) | at org.ildefe.ejb.impl.WorkFlow.executeCommand(WorkFlow.java:69) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAcce
[JBoss-user] [EJB/JBoss] - EJB Strange ClassCastException
Hi. I have a very strange ClassCastException that I'm going to try to explain in detail. I have an EAR application, with a WAR, an EJB JAR and some other JARs. The structure is like that: App.EAR: WebApp.war (struts files and jsps) App.jar (business objects and business rules) EJBApp.jar (bridge to access App.jar remotely) otherjar1.jar otherjar2.jar .. The project evolved in this way. I had a web application, and possibly, they told me that another application could call this application remotely through an EJB. So, I made an EAR application with a WAR (with struts and jsps) and a JAR with all my business code. In this way, the action classes of the WAR call the business Java classes of the App.JAR. By the way, the MANIFEST.MF of the WAR file has a list of all the jars used in the application,i.e., App.jar and the rest of the other tools jars. In this way, these classes would be visibles from any part of the application. The next step, was that I had to create and EJB for the other application. The functionality would be the same between both applications (my original web application and the remote application). In this way, my web application gives the same functionality that the remote Swing application that access through the EJB. Web Application ->(access) Business Rules (App.jar through WAR) Swing Application -> (access) Business Rules (App.jar through EJB) For the EJB I use the Command Pattern. This is (basically) the code of the EJB: | public Command executeCommand(Command comando) throws EJBException { | try { | comando.execute(); | } catch (AppException ex) { | throw new EJBException(ex); | } | return comando; | } | So, to make a functionality, I use the next Command class (I only show the execute method code) that I pass to the EJB as the Command argument: | public void execute() throws AppException { | Session session = null; | JbpmSession jbpmSession = null; | try { | session = PersistenceUtil.getSession(); | jbpmSession = PersistenceUtil.getJbpmSession(); | | if(getTercero().getDni() != null && !"".equals(getTercero().getDni())){ | UsuarioDAOHibernateImpl usuarioDAO = new UsuarioDAOHibernateImpl(); | if(usuarioDAO.getTerceroByDNI(new Long(getTercero().getDni()).longValue()) != null){ | this.setTercero(usuarioDAO.getTerceroByDNI(new Long(getTercero().getDni()).longValue(), session)); | ProcessInstanceDAOHibernateImpl processInstanceDAO = new ProcessInstanceDAOHibernateImpl(); | setTramitesTercero(processInstanceDAO.getTramitesTercero(usuarioDAO.getTerceroByDNI(new Long(getTercero().getDni()).longValue()).getDni(), session, jbpmSession)); | } | } | } catch (Exception e) { | throw new AppException(e); | }finally{ | try { | PersistenceUtil.closeJbpmSession(jbpmSession); | PersistenceUtil.closeSession(session); | } catch (InfrastructureException e) { | throw new AppException("Error al intentar cerrar las sesiones de Hibernate (Session y JbpmSession)", e); | } | } | } | Note: As you can see, my application uses Hibernate and Jbpm. Well. When I try to execute the functionality through the web tier all goes well.But when I try to test the EJB through a JUnit Test (a standalone application from my Eclipse IDE), I get a ClassCastExcpetion in the next point. When the execute code shown earlier is in | usuarioDAO.getTerceroByDNI(new Long(getTercero().getDni()).longValue(), session) | I get the ClassCastException. The UsuarioDAOHibernateImpl is a business plain java class that resides in the App.jar. The UsuarioDAOHibernateImpl.getTerceroByDNI method code is as follows: | public Tercero getTerceroByDNI(long dni, Session session){ | // Se crea la query con los parametros | Tercero tercero = null; | Query q = session.createQuery("from Tercero t where t.dni=:dni"); | q.setLong("dni",dni); | tercero = (Tercero)q.uniqueResult(); | return tercero; | } | The ClassCastException is thrown in this line | tercero = (Tercero)q.uniqueResult(); | Note: The Tercero class is a POJO class that resides in the App.jar. I don't understand this ClassCastException. I thought that as I have specified in the MANIFEST.MF, the classes in the App.jar would be shared by all the application
[JBoss-user] [Security & JAAS/JBoss] - Re: Problem with logout with FORM based authentication and s
The issue is that my application is made with Struts and Tiles, and the menu tile (in summary, a JSP page) is composed by a public part and another private part that only can be accesed when a validated user (I've made the validation with a login form) has been logged. The implementation of the menu tile is more or less like above code. I've used Struts logic tags. | | ... Public menu components (login access included). | | | . Private menu components for a validated user (logout access included) . | | Note: The '*' can be substituted by a concrete role as needed, of course. On the other hand, there are more ways of implementing this functionality, but I thought that this was the cleanest way to do this. As I mentioned before, in the previous topics, the logout functionality is implemented by session.invalidate(), but that action doesn't remove the request's user principal, so the first time the logout is called, the private menu part keeps showed and the public menu part remains hidden. But, the second time the logout function is called, then, the user principal doesn't exist and the public part of the menu is showed. If you tell me that I can not remove the user principal from the request (by the way, it's logical), then I suppose I'll have to think another implementation of the menu tile. Thanks a lot for your comments. Juanjo View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3876105#3876105 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3876105 --- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: Problem with logout with FORM based authentication and s
And how I could remove the request principal? Thanks again. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3876056#3876056 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3876056 --- This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Problem with logout with FORM based authentication and sessi
Hi to all. I've read in the forum that when any web application has FORM based security, the way you can implement logout is making session.invalidate() I don't have problems when I request a resource under security protection. The form is showed to me and I validate correctly. The issue is that in my application I have a logout function to remove the userPrincipal stored in the request. The implementation of this logout function is session.invalidate(). But, after invalidate the session, the userPrincipal is still in the request. For example, I can see it with this code: | request.getSession().invalidate(); | System.out.println("The user is in the request after logging out: "); | System.out.println( request.getUserPrincipal()!=null?"SI":"NO"); | And I can see in the console the answer "YES". Anybody can help me, please? Thanks a lot in advance P.S.: I'm using JBoss 4.0.1 P.S.: If I use two consecutive times the logout function, then the userPrincipal does not exists. This is, to effectively logout the user, I have to click twice in the logout place of the web application. Of course, this is a not desired behaviour.But, why session.invalidate() works the second time and doesn't work the first time I call it? View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3875898#3875898 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3875898 --- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Security & JAAS/JBoss] - Re: How to logout a user?
Hi. I have the same problem. I'm trying to code a logout function for my web application. That is, I have a FORM authentication and when I have a user validated, I want to code a logout function. But if I try to make a Session.invalidate() after a user has been validated, it doesn't work, because if I execute the next code: | request.getSession().invalidate(); | System.out.println("The user is authenticated after session.invalidate():"); | System.out.println( request.getUserPrincipal()!=null?"YES":"NO"); | the standard output show me "YES". Also, I tried a flush of the cache instead a session.invalidate(), but I think this is not the solution for this issue. Thanks in adavance for any kind of comment. View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3875894#3875894 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3875894 --- SF.Net email is sponsored by: Tell us your software development plans! Take this survey and enter to win a one-year sub to SourceForge.net Plus IDC's 2005 look-ahead and a copy of this survey Click here to start! http://www.idcswdc.com/cgi-bin/survey?id=105hix ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - Re: ClassCastException when obtaining a Remote Interface fro
Hi, again. The interfaces are remote (I don't run the junit client inside JBoss,but in a different virtual machine). But, don't worry. It works fine now!!! The error was mine. The issue was that the Remote Interface name (HelloWorld) and the bean class had the same name, and when the Eclipse shows the different classes to fix the import errors, I chose unintentionally the bean class instead the interface class. I've changed the class and it works. But thanks a lot for your attention and your time. Bye View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3874796#3874796 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3874796 --- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [EJB/JBoss] - ClassCastException when obtaining a Remote Interface from th
Hi. First of all, I'm using JBoss 4.0.1 and Eclipse 3.0.1M6 with MyEclipse. I've deployed a Stateless Session Bean in the server and it's ok. In fact, when I see the jmx-console in the JNDI view I can see the values for the EJB deployed. The issue is that when I try to access the EJB through a client (in my case a JUnit Test Case class, but also I've tried with a standalone application), always I get a ClassCastException. The method of the client code I'm calling is: | public void testClientEJB(){ | Properties props = new Properties(); | props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); | props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces"); | props.put(Context.PROVIDER_URL, "localhost:3332"); | try{ | InitialContext ctx = new InitialContext(props); | assertTrue(ctx!=null); | Object ref = ctx.lookup("ejb/HelloWorld"); | System.out.println("Got a reference to the EJB"); | HelloWorldHome pruebaHome = (HelloWorldHome) PortableRemoteObject.narrow(ref,HelloWorldHome.class); | assertTrue(pruebaHome!=null); | HelloWorld pruebaServer = (HelloWorld) pruebaHome.create(); | System.out.println(pruebaServer.execute()); | }catch (Exception e){ | e.printStackTrace(); | } | } | And the console output is: | Got a reference to the EJB | java.lang.ClassCastException | at client.HelloWorldClientTest.testClientEJB(HelloWorldClientTest.java:29) | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) | at java.lang.reflect.Method.invoke(Method.java:324) | at junit.framework.TestCase.runTest(TestCase.java:154) | at junit.framework.TestCase.runBare(TestCase.java:127) | at junit.framework.TestResult$1.protect(TestResult.java:106) | at junit.framework.TestResult.runProtected(TestResult.java:124) | at junit.framework.TestResult.run(TestResult.java:109) | at junit.framework.TestCase.run(TestCase.java:118) | at junit.framework.TestSuite.runTest(TestSuite.java:208) | at junit.framework.TestSuite.run(TestSuite.java:203) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342) | at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194) | Note: The line 29 in testClient is when I try to obtain the Remote Interface from the create method of the home interface,i.e., | HelloWorld pruebaServer = (HelloWorld) pruebaHome.create(); | Of course, I have in the classpath client the jbossall-client.jar I've had the Eclipse EJB Project linked as a Project required on the build path (to make the interfaces classes available to the application) and the error was there. I've tried to export a jar with the classes of the EJB and include this jar in the classpath of the application and the error continued there. Someone has experienced this kind of error? Thanks a lot View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3874789#3874789 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3874789 --- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user
[JBoss-user] [Beginners Corner] - Re: JNDI problem with initial context instantiation
Hi. Probably, you don't have in your client the classes needed. Put, for example, the jbossall-client.jar in the classpath of your client application. You can find this jar in the client directory of your jboss server. Good luck. Bye View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3874613#3874613 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3874613 --- This SF.Net email is sponsored by: New Crystal Reports XI. Version 11 adds new functionality designed to reduce time involved in creating, integrating, and deploying reporting solutions. Free runtime info, new features, or free trial, at: http://www.businessobjects.com/devxi/728 ___ JBoss-user mailing list JBoss-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jboss-user