3 Replies Latest reply on Feb 15, 2002 1:15 PM by one_each

    How do I attack a InstantiationException on a finder?

    one_each

      I'm attempting to configure JBoss (2.4.3) to talk to our legacy application (Progress database) and am having some problems. The Progress logfile indicates that JBoss is connected, however any finder (I've tried findByPrimaryKey and findAll) fail.

      To make matters more complicated, I'm trying to configure our development environment (TogetherSoft ControlCenter) to do all of the work to create a CMB entity bean.


      This is one of the snippits I'm testing with. In this case, the findAll is the cause of the exception.

      Object objref = initial.lookup("testing.UsersBean");
      UsersHome home =
      (UsersHome) PortableRemoteObject.narrow(objref,
      UsersHome.class);
      Collection c = home.findAll();
      System.out.println(c.size());
      )

      Here is the stack trace from JBoss.

      [UsersBean 02-14 10:48:21] TRANSACTION ROLLBACK EXCEPTION:Could not instantiate bean; nested exception is:
      java.lang.InstantiationException: testing.UsersBean; nested exception is:
      java.rmi.ServerException: Could not instantiate bean; nested exception is:
      java.lang.InstantiationException: testing.UsersBean
      [UsersBean 02-14 10:48:21] java.rmi.ServerException: Could not instantiate bean; nested exception is:
      [UsersBean 02-14 10:48:21] java.lang.InstantiationException: testing.UsersBean
      [UsersBean 02-14 10:48:21] java.lang.InstantiationException: testing.UsersBean
      [UsersBean 02-14 10:48:21] at java.lang.Class.newInstance0(Native Method)
      [UsersBean 02-14 10:48:21] at java.lang.Class.newInstance(Class.java:237)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.Container.createBeanClassInstance(Container.java:159)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.AbstractInstancePool.get(AbstractInstancePool.java:143)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstanceInterceptor.java:143)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterceptor.java:108)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeNext(TxInterceptorCMT.java:135)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:307)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:86)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:103)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:106)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:420)
      [UsersBean 02-14 10:48:21] at org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker.invokeHome(JRMPContainerInvoker.java:372)
      [UsersBean 02-14 10:48:21] at java.lang.reflect.Method.invoke(Native Method)
      [UsersBean 02-14 10:48:21] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:241)
      [UsersBean 02-14 10:48:21] at sun.rmi.transport.Transport$1.run(Transport.java:152)
      [UsersBean 02-14 10:48:21] at java.security.AccessController.doPrivileged(Native Method)
      [UsersBean 02-14 10:48:21] at sun.rmi.transport.Transport.serviceCall(Transport.java:148)
      [UsersBean 02-14 10:48:21] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:465)
      [UsersBean 02-14 10:48:21] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:706)
      [UsersBean 02-14 10:48:21] at java.lang.Thread.run(Thread.java:484)


      Sorry, but this is all the information I have to go on. Anyone have an idea as to what is going on or know how to get the container to print out a little more information as to why it cannot create the bean instance?

      TIA,
      Gary Clark
      Senior Programmer
      JELD-WEN, inc.

        • 1. Re: How do I attack a InstantiationException on a finder?
          one_each

          I hate to reply to my own post, but someone else may run into the same issues and the exception is not very helpful. :)

          It seems that when TogetherSoft generated the bean it made the class abstract. This caused the JBoss deployer to not generate the jaws.xml file and lead to all kinds of problems.

          Oh, well. Live and learn.

          • 2. Re: How do I attack a InstantiationException on a finder?
            davidjencks

            Perhaps together thinks you want cmp2 ejbs?

            You might want to look at xdoclet for an alternative code generation approach.

            • 3. Re: How do I attack a InstantiationException on a finder?
              one_each

              Thanks for the tip, but I found that if I tell TogetherSoft to use a Generic 1.1 EJB server when generating from a database, it will generate the correct code.

              In all fairness, the JBoss plugin was not written by TogetherSoft. This adds an extra step that we should not need to do, but it still MUCH easier then hand coding entity beans to match an existing database (about 2 min on my PII/450 to go from nothing to deployed bean).

              Again, thanks for your help.