3 Replies Latest reply on May 21, 2012 10:35 AM by maulattu

    Error JBAS011440 with JBoss 7.1.1: persistence unit not found

    maulattu Newbie

      Hi all,


      I'm developing a simple example with jboss 7.1.1 under Windows using persistence APIs.

      The database driver installation (both postgres as well as mysql) were ok, as well as the datasource creation:


      16:18:02,496 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class org.postgresql.Driver (version 9.0)

      16:18:02,507 INFO  [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)


      16:18:03,314 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [ java : jboss / datasources / hibernatepg]

      16:18:03,314 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java : jboss / datasources / ExampleDS]

      16:18:03,445 INFO  [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010400: Bound data source [java:/MySqlDS]


      I created the persistence.xml file under META-INF directory:

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence version="2.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_2_0.xsd">

          <persistence-unit name="persistenceUnit" transaction-type="JTA">




                  <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />





      Even following these tutorials:




      There's no way to let reachable this datasource in a singleton ejb:



      public class SingletonBean {


         @PersistenceContext(unitName = "persistenceUnit")

          private EntityManager em;




      In fact I've this error related to such datasource:

      JBAS011440: Can't find a persistence unit named persistenceUnit in deployment "persistence.jar"


      Even if I call the datasource "java:/MySqlDS" with name "persistenceUnit" (now it has name "MySqlDS_Pool") there's no way to have a working and deployable jar file


      Any advice please?


      thank you all guys!