12 Replies Latest reply on Nov 14, 2001 1:58 PM by jsents

    char used in methods of EJB session beans

    jsents

      The following method is causing the error listed below. Can we not use "char" as a type in methods of session beans or do they all arguements need to be objects? Or is there something that I am doing wrong?

      Thanks for any help,
      Josh

      Method on the bean, notice first arg is char:
      public String registerRqstr(char acType, String asAssn, String asvUsers, String asvPassword) throws RcException
      {

      return com.rc.framework.RqstrMngrBeanFinal.registerRqstr(acType, asAssn, asvUsers, asvPassword);
      }



      Error:
      [AutoDeployer] Starting
      [AutoDeployer] Watching D:\RcDepWarJB
      [AutoDeployer] Auto deploy of file:/D:/RcDepWarJB/sys.jar
      [J2EE Deployer Default] Deploy J2EE application: file:/D:/RcDepWarJB/sys.jar
      [J2eeDeployer] Create application sys.jar
      [J2eeDeployer] install EJB module sys.jar
      [Container factory] Deploying:file:/D:/JBoss_Tomcat/jboss/tmp/deploy/Default/sys.jar
      [Verifier] Verifying file:/D:/JBoss_Tomcat/jboss/tmp/deploy/Default/sys.jar/ejb1001.jar
      [Container factory] Deploying Col_label
      [Container factory] Deploying Col_list
      [Container factory] Deploying Msg
      [Container factory] Deploying Msg_ref
      [Container factory] Deploying Page_col
      [Container factory] Deploying User_page
      [Container factory] Deploying Col_labelTv
      [Container factory] Deploying Col_listTv
      [Container factory] Deploying ColLabelDg
      [Container factory] Deploying ColListDg
      [Container factory] Deploying MsgTv
      [Container factory] Deploying Msg_refTv
      [Container factory] Deploying MsgDg
      [Container factory] Deploying MsgRefDg
      [Container factory] Deploying Page_colTv
      [Container factory] Deploying PageColDg
      [Container factory] Deploying User_pageTv
      [Container factory] Deploying UserPageDg
      [Container factory] Deploying AssnMngr
      [Container factory] Deploying MessagePc
      [Container factory] Deploying RqstrMngr
      [Container factory] Deploying UserMngr
      [J2EE Deployer Default] Starting sys.jar failed!
      [Default] java.lang.NoClassDefFoundError: java/lang/Char
      [Default] at $Proxy16.(Unknown Source)
      [Default]
      [Default] at java.lang.reflect.Constructor.newInstance(Native Method)
      [Default]
      [Default] at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:562)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp13.server.JRMPContainerInvoker.init(JRMPContainerInvoker.java:80)
      [Default]
      [Default] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.init(JRMPContainerInvoker.java:258)
      [Default]
      [Default] at org.jboss.ejb.StatelessSessionContainer.init(StatelessSessionContainer.java:165)
      [Default]
      [Default] at org.jboss.ejb.Application.init(Application.java:202)
      [Default]
      [Default] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:372)
      [Default]
      [Default] at org.jboss.ejb.ContainerFactory.deploy(ContainerFactory.java:304)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [Default]
      [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [Default]
      [Default] at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:494)
      [Default]
      [Default] at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:468)
      [Default]
      [Default] at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:208)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [Default]
      [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [Default]
      [Default] at org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:379)
      [Default]
      [Default] at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:217)
      [Default]
      [Default] at org.jboss.ejb.AutoDeployer.startService(AutoDeployer.java:353)
      [Default]
      [Default] at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:107)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [Default]
      [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [Default]
      [Default] at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:836)
      [Default]
      [Default] at $Proxy0.start(Unknown Source)
      [Default]
      [Default] at org.jboss.util.ServiceControl.start(ServiceControl.java:81)
      [Default]
      [Default] at java.lang.reflect.Method.invoke(Native Method)
      [Default]
      [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [Default]
      [Default] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [Default]
      [Default] at org.jboss.Main.(Main.java:221)
      [Default]
      [Default] at org.jboss.Main$1.run(Main.java:127)
      [Default]
      [Default] at java.security.AccessController.doPrivileged(Native Method)
      [Default]
      [Default] at org.jboss.Main.main(Main.java:123)
      [Default]
      [J2EE Deployer Default] Module sys.jar is not running
      [J2EE Deployer Default] Destroying application sys.jar
      [AutoDeployer] Deployment failed:file:/D:/RcDepWarJB/sys.jar
      [AutoDeployer] org.jboss.deployment.J2eeDeploymentException: Error while starting sys.jar: java/lang/Char, Cause: java.lang.NoClassDefFoundError: java/lang/Char
      [AutoDeployer] at org.jboss.deployment.J2eeDeployer.startModules(J2eeDeployer.java:524)
      [AutoDeployer] at org.jboss.deployment.J2eeDeployer.startApplication(J2eeDeployer.java:468)
      [AutoDeployer] at org.jboss.deployment.J2eeDeployer.deploy(J2eeDeployer.java:208)
      [AutoDeployer] at java.lang.reflect.Method.invoke(Native Method)
      [AutoDeployer] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [AutoDeployer] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [AutoDeployer] at org.jboss.ejb.AutoDeployer.deploy(AutoDeployer.java:379)
      [AutoDeployer] at org.jboss.ejb.AutoDeployer.run(AutoDeployer.java:217)
      [AutoDeployer] at org.jboss.ejb.AutoDeployer.startService(AutoDeployer.java:353)
      [AutoDeployer] at org.jboss.util.ServiceMBeanSupport.start(ServiceMBeanSupport.java:107)
      [AutoDeployer] at java.lang.reflect.Method.invoke(Native Method)
      [AutoDeployer] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [AutoDeployer] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [AutoDeployer] at org.jboss.configuration.ConfigurationService$ServiceProxy.invoke(ConfigurationService.java:836)
      [AutoDeployer] at $Proxy0.start(Unknown Source)
      [AutoDeployer] at org.jboss.util.ServiceControl.start(ServiceControl.java:81)
      [AutoDeployer] at java.lang.reflect.Method.invoke(Native Method)
      [AutoDeployer] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1628)
      [AutoDeployer] at com.sun.management.jmx.MBeanServerImpl.invoke(MBeanServerImpl.java:1523)
      [AutoDeployer] at org.jboss.Main.(Main.java:221)
      [AutoDeployer] at org.jboss.Main$1.run(Main.java:127)
      [AutoDeployer] at java.security.AccessController.doPrivileged(Native Method)
      [AutoDeployer] at org.jboss.Main.main(Main.java:123)
      [AutoDeployer] Started
      [JMXAdaptorService] Starting
      [JMXAdaptorService] Started
      [RMIConnectorService] Starting
      [RMIConnectorService] Started
      [MailService] Starting
      [MailService] Mail Service 'Mail' bound to java:/Mail
      [MailService] Started
      [Service Control] Started 48 services
      [Default] JBoss 2.4.3 Started in 0m:11s

        • 1. Re: char used in methods of EJB session beans
          jsents

          I have been looking into this and have discovered it is the remote that is causing the problem.

          Below is the remote of the session bean. If I take out the method with "char" on it will deploy. With the "char" arg method in the remote will not deploy and gives the error in my prior post. This remote (with the method having a "char" arg) has been working in Weblogic so I don't think I am breaking any spec rules by passing a "char" arg.

          Any advice or help would be great.
          Thanks
          Josh




          package com.rc.summit.ejb.sys;

          import java.rmi.*;
          import javax.ejb.*;

          public interface RqstrMngr extends EJBObject, Remote {

          public String getAttribute(String astrRqstrID, String astrAttribute) throws com.rc.framework.RcException, RemoteException;

          public com.rc.framework.Rqstr getRqstr(String astrRqstrID) throws com.rc.framework.RcException, RemoteException;

          //This line causes an error
          public String registerRqstr(char acType, String asAssn, String asvUsers, String asvPassword) throws com.rc.framework.RcException, RemoteException;

          //This line does not and was put in for testing purposes
          public String registerRqstr(Character acType, String asAssn, String asvUsers, String asvPassword) throws com.rc.framework.RcException, RemoteException;

          public void removeRqstr(String astrRqstrID) throws com.rc.framework.RcException, RemoteException;

          public void setAttribute(String astrRqstrID, String astrAttribute, String astrValue) throws com.rc.framework.RcException, RemoteException;
          }

          • 2. Re: char used in methods of EJB session beans
            pabs

            I had the error when one of my remote methods had a char in it's parameter list. This remote method however, used to work in jboss 2.2.x but now in jboss 2.4.x it dosen't. I changed my char to a String which is a bit annoying but it worked.

            cheers.
            P.



            • 3. Re: char used in methods of EJB session beans
              jsents

              Thanks for your response. I changed the char to a Character class and everything works fine now. Any chance this is a bug in 2.4.

              • 4. Re: char used in methods of EJB session beans
                alexnet

                Hi,
                No it isn't bug in Jboss at all.
                You HAVE TO implement interface 'Serializable' in your argument's object type according to J2EE spec. Primitive types(like char, byte, long) can't be serialized or implement such interface.

                • 5. Re: char used in methods of EJB session beans
                  jsents

                  Thanks Alex, that makes sense to me now. I guess it was just Weblogic letting us go outside the lines.

                  • 6. Re: char used in methods of EJB session beans
                    pazu

                    Isn't every primitive type automatically serializable? For a class to implement the Serializable interface, every field in it must:

                    a) be a primitive, or
                    b) also implement the Serializable inteface

                    • 7. Re: char used in methods of EJB session beans

                      Hi,

                      all primitive type are valid RMI/IIOP types.
                      See: ftp://ftp.omg.org/pub/docs/ptc/99-03-09.pdf

                      So they can be used as arguments as well as return types.

                      I used until today only int and double. Now I tried using a char as argument and got the same deployment failure.

                      The validation is done by:
                      org.jboss.verifier.strategy.AbstractVerifierisRMIIIOPType(Class type)

                      It tests with class.isPrimitive() if the argument is primitive type. (No difference between int and char in the code.)

                      The I removed all my classes from the build directory, built new and restarted jBoss.

                      Then all works fine!!

                      Thats stange and I can't reproduce the failure. Maybe it is a bug in the auto deployer.

                      • 8. Re: char used in methods of EJB session beans
                        alexnet

                        No, primitive type isn't serializable.
                        You said:
                        "...For a class to implement the Serializable...",
                        to be certain primitive types isn't Objects, so you are right about classes and wrong about primitive types.

                        • 9. Re: char used in methods of EJB session beans

                          Alex,

                          I don't said that primitive types are serializable.
                          There are valid RMI/IIOP types. You can find details in the EJB 2.0 spec at page 89 (chap 7.10.4) and the OMG spec I cited last post.

                          Andreas

                          • 10. Re: char used in methods of EJB session beans

                            Alex,

                            please excuse my last post. I saw to late, the You answerd the previous post :-(.

                            Andreas

                            • 11. Re: char used in methods of EJB session beans

                              The error message in the original post is due to a bug in JDK 1.3.0. (the Proxy class attempts to convert primitive type char to class java.lang.Char which does not exist, it should be java.lang.Character)

                              This is fixed in JDK 1.3.1.

                              -- Juha

                              • 12. Re: char used in methods of EJB session beans
                                jsents

                                I replaced my JDK 1.3.0 with JDK 1.3.1 and now passing char works fine.

                                Thank you to everyone who responded!!