-
1. Re: enitiy manager
ge0ffrey May 12, 2008 9:53 AM (in response to kdcosta.mail.dcosta.gmail.com)EntityManager em is probably null? The createQuery method shouldn't return null.
So that means that the em doesn't get injected during deployment, which it should if it's an EJB3 jar deployment with a META-INF/ejb-jar.xml file.Btw, it's very unconventional that you use a capital to start your method and parameter names: it makes your code harder to read, but it shouldn't cause any errors.
-
2. Re: enitiy manager
kdcosta.mail.dcosta.gmail.com May 12, 2008 10:41 AM (in response to kdcosta.mail.dcosta.gmail.com)Thank you a lot for the tip.
im entirely new to this.
here is my ejb-jar.xml.
plz go through this and tell me if i need to change anything, inorder to make the entitymanager ready.<?xml version="1.0" encoding="UTF-8"?> <ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0"> <interceptors> <interceptor> <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class> </interceptor> </interceptors> <assembly-descriptor> <interceptor-binding> <ejb-name>*</ejb-name> <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class> </interceptor-binding> </assembly-descriptor> </ejb-jar>
-
3. Re: enitiy manager
vasana May 12, 2008 11:39 AM (in response to kdcosta.mail.dcosta.gmail.com)how is your EntityManager named in components.xml?
-
4. Re: enitiy manager
kdcosta.mail.dcosta.gmail.com May 12, 2008 11:52 AM (in response to kdcosta.mail.dcosta.gmail.com)here is my components.xml
<?xml version="1.0" encoding="UTF-8"?> <components xmlns="http://jboss.com/products/seam/components" xmlns:core="http://jboss.com/products/seam/core" xmlns:drools="http://jboss.com/products/seam/drools" xmlns:security="http://jboss.com/products/seam/security" xmlns:mail="http://jboss.com/products/seam/mail" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-1.2.xsd http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-1.2.xsd http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd"> <core:init debug="true" jndi-pattern="@jndiPattern@"/> <core:manager concurrent-request-timeout="500" conversation-timeout="120000" conversation-id-parameter="cid" conversation-is-long-running-parameter="clr"/> <core:managed-persistence-context name="entityManager" auto-create="true" persistence-unit-jndi-name="java:/AWBEntityManagerFactory"/> <core:ejb installed="@embeddedEjb@"/> <drools:rule-base name="securityRules"> <drools:rule-files> <value>/security.drl</value> </drools:rule-files> </drools:rule-base> <security:identity authenticate-method="#{authenticator.authenticate}" security-rules="#{securityRules}"/> <event type="org.jboss.seam.notLoggedIn"> <action expression="#{redirect.captureCurrentView}"/> </event> <event type="org.jboss.seam.postAuthenticate"> <action expression="#{redirect.returnToCapturedView}"/> </event> <mail:mail-session host="localhost" port="2525" username="test" password="test" /> <!-- For use with jBPM pageflow or process management --> <!-- <core:jbpm> <core:process-definitions></core:process-definitions> <core:pageflow-definitions></core:pageflow-definitions> </core:jbpm> --> </components>
Any idea why the EntityManager is null????
plz help ....... -
5. Re: enitiy manager
heshuhua May 12, 2008 12:31 PM (in response to kdcosta.mail.dcosta.gmail.com)Sounds strange?
are you sure you have place the bean in ejb package? -
6. Re: enitiy manager
kdcosta.mail.dcosta.gmail.com May 12, 2008 12:34 PM (in response to kdcosta.mail.dcosta.gmail.com)Yes the bean is in ejb package itself.....
-
7. Re: enitiy manager
heshuhua May 12, 2008 12:41 PM (in response to kdcosta.mail.dcosta.gmail.com)then have you place the datasouce file in deploy directory?
-
8. Re: enitiy manager
kdcosta.mail.dcosta.gmail.com May 12, 2008 12:50 PM (in response to kdcosta.mail.dcosta.gmail.com)the datasource file given below is in the deploy folder
<?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>AWBDatasource</jndi-name> <connection-url>jdbc:mysql://localhost:3306/awb001</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>root</user-name> <password>root</password> <!-- <exception-sorter-class-name> org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter </exception-sorter-class-name> <metadata> <type-mapping>mySQL</type-mapping> </metadata> --> </local-tx-datasource> </datasources>