0 Replies Latest reply on Sep 24, 2007 12:15 PM by Joe Brutto

    Connecting to Hibernate

    Joe Brutto Newbie


      I have been working on a very simple EJB 3 sample setup for myself and am working on the persistence setup for testing simple data storage via an EntityManager. The problem is that I am unable to connect to the internal HSQL database using my configurations. I would appreciate if someone could help me out.

      The following are the steps I took to attempt this database setup:

      1. Install JBoss w/ the JEMS Installer (using all the defaults)
      2. Start the server
      3. Drop my Ejb3Example-ds.xml file into the deploy folde

      <?xml version="1.0" encoding="UTF-8"?>
       <track-statements />
       <type-mapping>Hypersonic SQL</type-mapping>
       <!-- This mbean can be used when using in process persistent db -->
       <mbean code="org.jboss.jdbc.HypersonicDatabase"
       <attribute name="Database">Ejb3ExampleDB</attribute>
       <attribute name="InProcessMode">true</attribute>

      4. Build my application source and package it into a Jar including my persistence.xml (sp?) file within the META-INF directory

      <?xml version="1.0" encoding="UTF-8"?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence"
       xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
       <persistence-unit name="Ejb3Example">
       <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
       <property name="hibernate.hbm2ddl.auto" value="create-drop" />

      5. Drop my Jar into the deploy folder with my DAO class set up as follows:

      public class MyDaoBean implements MyDaoLocal, MyDaoRemote
       @PersistenceContext(unitName = "Ejb3Example")
       private EntityManager entityManager;
       private Logger logger;
       public void init() {
       // attribute initialization
       logger = Logger.getLogger("Ejb3ExampleStorageManager");
       // core logging
       logger.info("EJB 3 Example storage initialized.");
       logger.info("Storage flush mode: " + entityManager.getFlushMode());
       public void ping() {
       logger.debug("Object Storage Ping");
       public void create(Serializable obj) {
       logger.info("Persis requested for " + obj.getClass().getName());
       public <T> T find(Class<T> objectType, UUID primaryKey) {
       logger.info("Lookup requested for " + objectType.getName() + "/" + primaryKey);
       return entityManager.find(objectType, primaryKey);

      The problems that I get are exceptions thrown apparently relating to authentication errors (larger stack trace available upon request):

      org.jboss.resource.JBossResourceException: No matching credentials in Subject!
      org.jboss.util.NestedSQLException: No matching credentials in Subject!; - nested throwable: (org.jboss.resource.JBossResourceException: No matching credentials in Subject!)
      Caused by: org.jboss.resource.JBossResourceException: No matching credentials in Subject!
      ... etc.

      What am I doing wrong?