[JBoss Seam] - Re: What's wrong with this components.xml / persistence.xml
by mlh496
It seems the entity manager is not getting inject into the right place. I continue to get this error:
Caused by: java.lang.NullPointerException
| at org.jboss.seam.core.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:96)
|
Here are my updated persistence.xml, components.xml and jboss-beans.xml files:
persistence.xml
<persistence>
| <persistence-unit name="omegaFactory">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/omegaDatasource</jta-data-source>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
| <property name="hibernate.transaction.flush_before_completion" value="true"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/omegaEntityDatasource"/>
| <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
| <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
| </properties>
| </persistence-unit>
| </persistence>
|
components.xml
<?xml version="1.0" encoding="UTF-8"?>
| <components xmlns="http://jboss.com/products/seam/components"
| xmlns:core="http://jboss.com/products/seam/core"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation=
| "http://jboss.com/products/seam/core
| http://jboss.com/products/seam/core-1.1.xsd
| http://jboss.com/products/seam/components
| http://jboss.com/products/seam/components-1.1.xsd">
|
| <core:init jndi-pattern="#{ejbName}/local" debug="true"/>
|
| <core:manager conversation-timeout="120000"/>
|
| <core:managed-persistence-context name="entityManager"
| persistence-unit-jndi-name="java:/omegaEntityDatasource"
| auto-create="true"/>
|
|
| <core:ejb installed="true"/>
|
| </components>
jboss-beans.xml
<?xml version="1.0" encoding="UTF-8"?>
|
| <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="urn:jboss:bean-deployer bean-deployer_1_0.xsd"
| xmlns="urn:jboss:bean-deployer:2.0">
|
| <bean name="omegaDatasourceBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
| <property name="driverClass">com.mysql.jdbc.Driver</property>
| <property name="connectionURL">jdbc:mysql://localhost:3306/omega</property>
| <property name="userName"><value class="java.lang.String">username</value></property>
| <property name="password"><value class="java.lang.String">password</value></property>
| <property name="jndiName">java:/omegaDatasource</property>
| <property name="minSize">0</property>
| <property name="maxSize">10</property>
| <property name="blockingTimeout">1000</property>
| <property name="idleTimeout">100000</property>
| <property name="transactionManager"><inject bean="TransactionManager"/></property>
| <property name="cachedConnectionManager"><inject bean="CachedConnectionManager"/></property>
| <property name="initialContextProperties"><inject bean="InitialContextProperties"/></property>
| </bean>
|
| <bean name="omegaDatasource" class="java.lang.Object">
| <constructor factoryMethod="getDatasource">
| <factory bean="omegaDatasourceBootstrap"/>
| </constructor>
| </bean>
| </deployment>
|
Surely some permutation should work. :-)
-Michael
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027375#4027375
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027375
19Â years, 1Â month
[Persistence, JBoss/CMP, Hibernate, Database] - Re: Help understanding ManagedConnectionPool Behaviour
by dmeeuwis
Responding to myself, I've been looking through the JBoss code, and it seems like the connections are managed in internal subpools. Whenever a connection is requested, JBoss tries to allocate from an existing subpool. If there are no free connections in the existings subpools, a new subpool is created, and a connection is taken from there.
If this is true, it would seem that JBoss does not have any background thread that watches the usage count and allocating when the free connections are getting low, or when it hits a certain threshold, or any similiar mechanism. It allocates new connections exactly when there are zero available connections.
Can anyone confirm that I am understanding JBoss's ManagedConnectionPool behaviour correctly?
Thanks for any help,
David M.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027373#4027373
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027373
19Â years, 1Â month