It's not a secret anymore!*
The moose likes EJB and other Java EE Technologies and the fly likes java.lang. IllegalStateException: createBean ClassInstance Command == null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "java.lang. IllegalStateException: createBean ClassInstance Command == null" Watch "java.lang. IllegalStateException: createBean ClassInstance Command == null" New topic
Author

java.lang. IllegalStateException: createBean ClassInstance Command == null

mishug Goyal
Ranch Hand

Joined: Aug 19, 2008
Posts: 56
Hello Ranchers !!

I have deployed an EJB application on JBoss 4.0 and it is giving following error while invloking entity bean:-

008-09-11 13:12:03,031 ERROR [org.jboss.ejb.plugins.LogInterceptor] EJBException in method: public abstract org.phoneytunes.ideamg.ejb.eb.MOTransactionLocalBusiness org.phoneytunes.ideamg.ejb.eb.MOTransactionLocalHome.create(java.lang.String,java.lang.String,java.lang.String,java.lang.String,int,java.lang.String) throws javax.ejb.CreateException, causedBy:
java.lang.IllegalStateException: createBeanClassInstanceCommand == null

Could someone please let me know what this error and how to resolve it?

Thanks in advance


SCJP 1.5, SCDJWS 5
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hi there,

We probably need a little more information (code snippets for the code in and around MOTransactionLocalHome)

But if you look at the error message:

java.lang.IllegalStateException: createBeanClassInstanceCommand == null

Is createBeanClassInstanceCommand a variable that you've declared somewhere?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
mishug Goyal
Ranch Hand

Joined: Aug 19, 2008
Posts: 56
Hi Martijn,

1. Here is code for MOTransactionLocalHome :-

import javax.ejb.CreateException;
import javax.ejb.EJBLocalHome;
import javax.ejb.FinderException;


/**
* This is the local-home interface for MOTransaction enterprise bean.
*/
public interface MOTransactionLocalHome extends EJBLocalHome {

MOTransactionLocal findByPrimaryKey(Long key) throws FinderException;

org.phoneytunes.ideamg.ejb.eb.MOTransactionLocalBusiness create(String TransactionId, String Msisdn, String Psms, String Keyword, int LangId, String Message) throws CreateException;


}

2.Is createBeanClassInstanceCommand a variable that you've declared somewhere?---------- No variable defined by this name
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I would google that error (createBeanClassInstanceCommand == null), I got for example the following link:

Someone with same problem

Hope that helps!
mishug Goyal
Ranch Hand

Joined: Aug 19, 2008
Posts: 56
I too myself googled this before posting to java ranch but the suggestion that is given on that link does not work out for my application

means i have not used "entity-command tag" and also standardjbosscmp-jdbc.xml is also fine.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Well this is where is gets fun , couple of questions:

1.) Can you post the contents of your ejb-jar.xml and any corresponding jboss deployment files (jboss-app comes to mind)?

2.) Are you other EJBs deploying OK?

3.) I assume the bean is a Entity (CMP managed) bean?

4.) What's the exact version of Jboss?
mishug Goyal
Ranch Hand

Joined: Aug 19, 2008
Posts: 56
Yes you are right.....so here we go..

1.) the contents of your ejb-jar.xml
------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
<display-name>IdeaMmsGateway-ejb</display-name>
<enterprise-beans>
<session>
<display-name>KeywordFinderSB</display-name>
<ejb-name>KeywordFinderBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.sb.KeywordFinderRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.sb.KeywordFinderRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.sb.KeywordFinderLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.KeywordFinderLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.sb.KeywordFinderBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>jdbc:mysql://192.168.100.126:3306/IdeaMG</description>
<res-ref-name>IdeaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
<session>
<display-name>PriceDetailSB</display-name>
<ejb-name>PriceDetailBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.sb.PriceDetailRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.sb.PriceDetailRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.sb.PriceDetailLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.PriceDetailLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.sb.PriceDetailBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>jdbc:mysql://192.168.100.126:3306/IdeaMG</description>
<res-ref-name>IdeaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
<session>
<display-name>ProcessRespParserSB</display-name>
<ejb-name>ProcessRespParserBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.sb.ProcessRespParserRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.sb.ProcessRespParserRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.sb.ProcessRespParserLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.ProcessRespParserLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.sb.ProcessRespParserBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
<display-name>ServiceFinderSB</display-name>
<ejb-name>ServiceFinderBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.sb.ServiceFinderRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.sb.ServiceFinderRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.sb.ServiceFinderLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.ServiceFinderLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.sb.ServiceFinderBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>jdbc:mysql://192.168.100.126:3306/IdeaMG</description>
<res-ref-name>IdeaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
<session>
<display-name>SessionFinderSB</display-name>
<ejb-name>SessionFinderBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.sb.SessionFinderRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.sb.SessionFinderRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.sb.SessionFinderLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.SessionFinderLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.sb.SessionFinderBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<ejb-local-ref>
<ejb-ref-name>ejb/MOTransactionBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.eb.MOTransactionLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.eb.MOTransactionLocal</local>
<ejb-link>MOTransactionBean</ejb-link>
</ejb-local-ref>
<resource-ref>
<description>jdbc:mysql://192.168.100.126:3306/IdeaMG</description>
<res-ref-name>IdeaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
<session>
<display-name>MmscDetailsSB</display-name>
<ejb-name>MmscDetailsBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.sb.MmscDetailsRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.sb.MmscDetailsRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.sb.MmscDetailsLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.MmscDetailsLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.sb.MmscDetailsBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<resource-ref>
<description>jdbc:mysql://192.168.100.126:3306/IdeaMG</description>
<res-ref-name>IdeaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</session>
<session>
<display-name>URLInvokerSB</display-name>
<ejb-name>URLInvokerBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.sb.URLInvokerRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.sb.URLInvokerRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.sb.URLInvokerLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.URLInvokerLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.sb.URLInvokerBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<entity>
<display-name>MTHandlerEB</display-name>
<ejb-name>MTHandlerBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.eb.MTHandlerRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.eb.MTHandlerRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.eb.MTHandlerLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.eb.MTHandlerLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.eb.MTHandlerBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>
<reentrant>false</reentrant>
<abstract-schema-name>MTHandler</abstract-schema-name>
<resource-ref>
<description>jdbc:mysql://192.168.100.126:3306/IdeaMG</description>
<res-ref-name>IdeaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</entity>
<entity>
<display-name>MOTransactionEB</display-name>
<ejb-name>MOTransactionBean</ejb-name>
<home>org.phoneytunes.ideamg.ejb.eb.MOTransactionRemoteHome</home>
<remote>org.phoneytunes.ideamg.ejb.eb.MOTransactionRemote</remote>
<local-home>org.phoneytunes.ideamg.ejb.eb.MOTransactionLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.eb.MOTransactionLocal</local>
<ejb-class>org.phoneytunes.ideamg.ejb.eb.MOTransactionBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Long</prim-key-class>
<reentrant>false</reentrant>
<abstract-schema-name>MOTransaction</abstract-schema-name>
<resource-ref>
<description>jdbc:mysql://192.168.100.126:3306/IdeaMG</description>
<res-ref-name>IdeaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>KeywordFinderBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>PriceDetailBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>ProcessRespParserBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>ServiceFinderBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>SessionFinderBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>MmscDetailsBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>URLInvokerBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>MTHandlerBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
<container-transaction>
<method>
<ejb-name>MOTransactionBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>


------------------
WEB.XML
-------------
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>SmsReceiver</servlet-name>
<servlet-class>org.phoneytunes.ptmg.mo.servlet.SmsReceiver</servlet-class>
</servlet>
<servlet>
<servlet-name>SampleProcess</servlet-name>
<servlet-class>org.phoneytunes.ptmg.mo.servlet.SampleProcess</servlet-class>
</servlet>
<servlet>
<servlet-name>MmsDownload</servlet-name>
<servlet-class>org.phoneytunes.ptmg.mo.servlet.MmsDownload</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SmsReceiver</servlet-name>
<url-pattern>/SmsReceiver</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SampleProcess</servlet-name>
<url-pattern>/SampleProcess</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>MmsDownload</servlet-name>
<url-pattern>/MmsDld</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
<ejb-local-ref>
<ejb-ref-name>ejb/MmscDetailsBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.sb.MmscDetailsLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.MmscDetailsLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#MmscDetailsBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/KeywordFinderBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.sb.KeywordFinderLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.KeywordFinderLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#KeywordFinderBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/ServiceFinderBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.sb.ServiceFinderLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.ServiceFinderLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#ServiceFinderBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/URLInvokerBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.sb.URLInvokerLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.URLInvokerLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#URLInvokerBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/ProcessRespParserBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.sb.ProcessRespParserLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.ProcessRespParserLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#ProcessRespParserBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/MTHandlerBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.eb.MTHandlerLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.eb.MTHandlerLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#MTHandlerBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/SessionFinderBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.sb.SessionFinderLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.sb.SessionFinderLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#SessionFinderBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/MTHandlerBean1</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.eb.MTHandlerLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.eb.MTHandlerLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#MTHandlerBean</ejb-link>
</ejb-local-ref>
<ejb-local-ref>
<ejb-ref-name>ejb/MOTransactionBean</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>org.phoneytunes.ideamg.ejb.eb.MOTransactionLocalHome</local-home>
<local>org.phoneytunes.ideamg.ejb.eb.MOTransactionLocal</local>
<ejb-link>IdeaMmsGateway-ejb.jar#MOTransactionBean</ejb-link>
</ejb-local-ref>
<resource-ref>
<description>jdbc:mysql://192.168.100.126:3306/IdeaMG</description>
<res-ref-name>IdeaDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
</web-app>


2.) Are you other EJBs deploying OK?

This is the log that got from JBoss....

jboss.j2ee:jndiName=MTHandlerBean,service=EJB state: Created jboss.j2ee:jndiName=MOTransactionBean,service=EJB state: Created jboss.j2ee:jndiName=KeywordFinderBean,service=EJB state: Created jboss.j2ee:jndiName=PriceDetailBean,service=EJB state: Created jboss.j2ee:jndiName=ProcessRespParserBean,service=EJB state: Created jboss.j2ee:jndiName=ServiceFinderBean,service=EJB state: Created jboss.j2ee:jndiName=SessionFinderBean,service=EJB state: Created jboss.j2ee:jndiName=MmscDetailsBean,service=EJB state: Created jboss.j2ee:jndiName=URLInvokerBean,service=EJB state: Created

(These includes all my application beans)

3.) I assume the bean is a Entity (CMP managed) bean?

Yes...bean that got issue is a Entity (CMP managed) bean.
i.e. MOTransactionBean

4.) What's the exact version of Jboss?

jboss-4.0.4.GA
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Hmm, I notice that your other Entity Bean MTHandler doesn't load either, are their any of your Entity beans that do?
mishug Goyal
Ranch Hand

Joined: Aug 19, 2008
Posts: 56
There are only these two entity beans only-
MOTransaction and MTHandler.

Well how do you came to know that MTHandler bean is also not loaded...
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

You didn't mention it being loaded in the log? Can you check again? It will be easier to find the problem if one bean was loaded correctly and the other not
mishug Goyal
Ranch Hand

Joined: Aug 19, 2008
Posts: 56
Hey Martijn,

I got the problem solved....basically the problem was with my entity beans.
As both beans were not loaded so that is why was getting those errors.

Thanks for your co-operation.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Can you post what you did to fix it? It will help other people fix similar problems when they search this forum
mishug Goyal
Ranch Hand

Joined: Aug 19, 2008
Posts: 56
Hi There !!

Basically what i was doing was that i have created CMP entity bean and was interacting with the database and inserting data into it...... so rather CMP, my bean should be BMP. So that is why, whenever i was trying to insert data into table it was giving the illegal State exception.......

I have just then made it BMP and it resolves the exception......
John Wagg
Greenhorn

Joined: Jul 01, 2009
Posts: 1
I've replicated this error deploying on JBoss where I've got an ejbql compilation error. JBoss doesn't say there are any other errors but it then seems that primary key reads even on tables unrelated to any tables in the ejbql can fail with this error. Fix the ejbql and everything works again. This is on JBoss 4.0.1
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang. IllegalStateException: createBean ClassInstance Command == null