I am unable to successfully create an EntityManager (returns null) using:
- jboss 4.0.3RC1
- operating system: Win2K
- database: MS SQL Server 2k

Tried to apply concepts in the EJB3 turorials, and scanned the forums for last 
3 days, and tried many different configs/suggestions, but no success... any 
help is appreciated!

***

Configuration/Code details follow:

- the entity-manager/name configured within persistence.xml is "bgsdb" and is 
used as the PersistenceContext unitName (code fragment shown later); the 
EntityManager appears to be established based upon server.log information 
(again, fragment provided below)
- standardjaws.xml and standardjbosscmp-jdbc.xml are configured to use MS SQL 
Server (server.log confirms that it can connect)
- mssql-ds.xml appears configured properly (within deploy directory)

*** persistence.xml (start) ***
<entity-manager>
  bgsdb
  org.hibernate.ejb.HibernatePersistence
  <jta-data-source>java:/MSSQLDS</jta-data-source>
  
    
    
  
</entity-manager>
*** persistence.xml (end) ***


Note: the class (code fragment below) is instantiated within a stateless 
session bean ("execute" method is called from this stateless session bean)
*** Code fragment (start) ***

package com.....

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

public class CLITest {

  @PersistenceContext(unitName="bgsdb")
  EntityManager em;

  public String execute()
    throws com.brodagroup.exception.XException {

    System.out.println( "emb:  CLITest started........");
    System.out.println( "emb: em: " + em );
    System.out.println( "emb: em (string): " + em.toString() );
:    
:
:
:    
  }

}

*** Code fragment (end) ***

Upon executing the code, the EntityManager returned is null (expert from 
server.log is listed below)

*** server.log - error (start) ***
2005-08-04 22:37:25,015 INFO  [STDOUT] emb:  CLITest started........
2005-08-04 22:37:25,015 INFO  [STDOUT] emb: em: null
2005-08-04 22:37:25,015 INFO  [STDOUT] javax.ejb.EJBException: null; 
CausedByException is:
        null
2005-08-04 22:37:25,015 INFO  [STDOUT]  at 
org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:46)...........
*** server.log - error (end) ***

*** server.log - EntityManager appears configured (start) ***
2005-08-04 22:28:54,180 INFO  [org.jboss.ejb3.Ejb3Module] Create EntityManager 
with JNDI name: bgsdb
*** server.log - EntityManager appears configured (end) ***

*** server.log - SQL SERVER connection established (start) ***
2005-08-04 22:28:52,037 INFO  
[org.hibernate.connection.DatasourceConnectionProvider] Using datasource: 
java:/MSSQLDS
*** server.log - SQL SERVER connection established (end) ***



View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3888570#3888570

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3888570


-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to