I have a simple app that is connecting to a mssql db (not my choice), when I 
try and access the entity manager from within the bean I get a null pointer 
exception. There are no errors when I deploy the ear to the server (hot or cold 
deploy - no errors)

the class code is:

  | package com.wsmp.dao;
  | 
  | import java.util.*;
  | import javax.persistence.*;
  | import javax.annotation.Resource;
  | import javax.ejb.*;
  | 
  | import com.wsmp.dto.*;
  | 
  | @Stateless
  | public class StudentDAO implements StudentDAOInterface
  | {    
  |     @PersistenceContext(unitName="wsmp")
  |     protected EntityManager em;
  |       
  |     public StudentDAO(){}
  |         
  |     public Collection<Student> getStudentList() 
  |     {
  |         Query query = em.createQuery("from STUDENT s"); //Null pointer 
exception here!
  |         return query.getResultList();
  |     }
  | .
  | .
  | .
  | 

mssql-ds.xml file is (running though jTDS)

  | <datasources>
  |    <local-tx-datasource>
  |       <jndi-name>MSSQLDS</jndi-name>
  |       
<connection-url>jdbc:jtds:sqlserver://150.104.62.27:1433/wsmp_t</connection-url>
  |       <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
  |       <user-name>x</user-name>
  |       <password>y</password>
  |       <min-pool-size>5</min-pool-size>
  |       <max-pool-size>20</max-pool-size>
  |       <idle-timeout-minutes>0</idle-timeout-minutes>
  |       <track-statements/>
  |       <metadata>
  |          <type-mapping>MS SQLSERVER2000</type-mapping>
  |       </metadata>
  |    </local-tx-datasource>
  | 
  | </datasources>
  | 

and the persistence.xml file is:


  | <persistence>
  |   <persistence-unit name="wsmp">
  |     <jta-data-source>java:/MSSQLDS</jta-data-source>
  |   </persistence-unit>
  | </persistence>
  | 

any help would be appreciated, I've tried a bunch of things and nothing works - 
probably have done something simple wrong...

cheers
Ray

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

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


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to