Jpa-hibernate error while starting the service

后端 未结 2 1838
予麋鹿
予麋鹿 2021-01-16 06:03

Below is the error from the log that i see after starting the service... can you help resolving this issue.

2013-08-22 10:35:37,111 | DEBUG | l Console Threa         


        
2条回答
  •  我在风中等你
    2021-01-16 06:38

    In case you use Aries JPA you should see two EntityManagerFactory services:

    • jpa-container picks up your bundle with the persistence.xml and creates an Entity manager factory
    • jpa-container-context picks up every EntityManagerFactory service and makes a new managed EntityManagerFactory service with the (org.apache.aries.jpa.proxy.factory=true) service property key-value pair

    The second does not exist in your environment. There can be two causes:

    • aries-jpa-container-context is not in your OSGi environment or it is not in ACTIVE state
    • The original EntityManagerFactory service is not registered as some dependency is missing

    You can check it if you open an OSGi console and check what services available. If there is no EntityManagerFactory service at all, the second is your problem.

    Check if all of your bundles are active! If they are, check if you have all the services that jpa-container needs: TransactionManager, DataSource or DataSourceFactory and a javax.persistence.spi.PersistenceProvider service for Hibernate. If any of the services are missing aries-jpa-container will pick up your bundle but will never create the EntityManagerFactory.

    I implemented an own jpa-container that works almost the same way as aries-jpa-container. If you replace the aries-jpa-container (only that one, the jpa-container-context should be left there) it will log more messages at INFO level for you what is missing. The container is available here. A sample application is available that uses hibernate is available at https://github.com/everit-org/osgi-hibernate. After running "mvn install" you will find itests/core/target/eosgi-itests-dist/equinox a subfolder where you can start the working application with on equinox server with bin/runconsole.sh.

提交回复
热议问题