Ejb não consigo conectar com o banco

estou tentando aprender ejb soh t to com uma dificuldade na hora de fazer uma conexao com o banco de dados
ta dando o seguinte erro.


         Exception in thread "main" java.lang.NullPointerException
        at ejb.CadastraBeanBean.cadCurso(CadastraBeanBean.java:33)
       

este erro ta ocorrendo na hora q eu faço qualquer coisa com entitymanager

cliente

     @EJB
    private static CadastraBeanLocal cad = new CadastraBeanBean();

    public static void main(String[] args) {

        Curso curso = new Curso();
        curso.setNome(" AJAX ");
        cad.cadCurso(curso);
        curso.setNome(" XML ");
        cad.cadCurso(curso);
        curso.setNome(" PROGRAMAÇÃO ");
        cad.cadCurso(curso);
        System.out.println("testando");
        List<Curso> lstCurso = cad.getCursos();
        for (int i = 0; i < lstCurso.size(); i++) {
            System.out.println(lstCurso.get(i).getNome());
        }

    }
}

bean

@Stateless(mappedName="cliente")
public class CadastraBeanBean implements CadastraBeanLocal {

    private List<Curso> cursos;
    @PersistenceContext(unitName="trabalhoPU")
    EntityManager entitymanager;


    public CadastraBeanBean() {
  
        cursos = new ArrayList();
    }

    public void cadCurso(Curso curso) {   
        entitymanager.getTransaction().begin(); //por exemplo o erro acontece aki
        entitymanager.persist(curso);
        entitymanager.getTransaction().commit();
    }

    public List<Curso> getCursos() {      
        cursos = entitymanager.createQuery(" select * from Curso ").getResultList();
        return cursos;
    }
}

unidade de persistencia

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  <persistence-unit name="trabalhoPU" transaction-type="JTA">
    <jta-data-source>postgres</jta-data-source>
    <properties/>
  </persistence-unit>
</persistence>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Resource Definitions //EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_3.dtd">
<resources>
  <jdbc-resource enabled="true" jndi-name="postgres" object-type="user" pool-name="post-gre-sqlPool"/>
  <jdbc-connection-pool allow-non-component-callers="false" associate-with-thread="false" connection-creation-retry-attempts="0" connection-creation-retry-interval-in-seconds="10" connection-leak-reclaim="false" connection-leak-timeout-in-seconds="0" connection-validation-method="auto-commit" datasource-classname="org.postgresql.ds.PGSimpleDataSource" fail-all-connections="false" idle-timeout-in-seconds="300" is-connection-validation-required="false" is-isolation-level-guaranteed="true" lazy-connection-association="false" lazy-connection-enlistment="false" match-connections="false" max-connection-usage-count="0" max-pool-size="32" max-wait-time-in-millis="60000" name="post-gre-sqlPool" non-transactional-connections="false" pool-resize-quantity="2" res-type="javax.sql.DataSource" statement-timeout-in-seconds="-1" steady-pool-size="8" validate-atmost-once-period-in-seconds="0" wrap-jdbc-objects="false">
    <property name="databaseName" value="postgres"/>
    <property name="serverName" value="localhost"/>
    <property name="portNumber" value="5432"/>
    <property name="User" value="postgres"/>
    <property name="Password" value="postgres"/>
    <property name="URL" value="jdbc:postgresql://localhost:5432/postgres"/>
    <property name="driverClass" value="org.postgresql.Driver"/>
  </jdbc-connection-pool>
</resources>