Seam 2.3.1 Upgrade - Injection/Outjection not functioning correctly
live4eva Nov 15, 2013 5:17 AMHi,
I am fairly new to Seam. I am busy upgrading a Seam 2.2 application on JBOSS 5 to Seam 2.3.1 on JBOSS 7.1.
The application is deployed as an ear file and makes use of Richfaces 4, EJB and JPA.
I have run into a problem injecting the entity manager though. I cannot get a reference to it using the @In annotation, the only way it works is if I use @PersistenceContext.
I have also noticed that outjection does not seem to be occurring - ( I can successfully inject my 'manager' components, but cannot seem to get/set values into contexts myself even if I manually set values into the context with something like Contexts.getSessionContext().put("myObject", myObject);
I am going to paste some of my configuration below... could someone please point me in the right direction ?
persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
version="2.0">
<persistence-unit name="vls" >
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/vlsDatasource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.format_sql" value="true" />
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
<!-- <property name="jboss.entity.manager.jndi.name" value="java:/vlsEntityManager" /> -->
<property name="jboss.entity.manager.factory.jndi.name" value="java:/vlsEntityManagerFactory" />
<property name="hibernate.default_schema" value="vls" />
</properties>
</persistence-unit>
</persistence>
components.xml:
<?xml version="1.0"?>
<components xmlns="http://jboss.com/products/seam/components"
xmlns:core="http://jboss.com/products/seam/core" xmlns:persistence="http://jboss.com/products/seam/persistence"
xmlns:security="http://jboss.com/products/seam/security" xmlns:theme="http://jboss.com/products/seam/theme"
xmlns:transaction="http://jboss.com/products/seam/transaction"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/components http://jboss.com/products/seam/components-2.3.xsd http://jboss.com/products/seam/bpm http://jboss.com/products/seam/bpm-2.3.xsd http://jboss.com/products/seam/core http://jboss.com/products/seam/core-2.3.xsd http://jboss.com/products/seam/drools http://jboss.com/products/seam/drools-2.3.xsd http://jboss.com/products/seam/jms http://jboss.com/products/seam/jms-2.3.xsd http://jboss.com/products/seam/mail http://jboss.com/products/seam/mail-2.3.xsd http://jboss.com/products/seam/persistence http://jboss.com/products/seam/persistence-2.3.xsd http://jboss.com/products/seam/security http://jboss.com/products/seam/security-2.3.xsd http://jboss.com/products/seam/theme http://jboss.com/products/seam/theme-2.3.xsd http://jboss.com/products/seam/web http://jboss.com/products/seam/web-2.3.xsd http://jboss.org/schema/seam/transaction http://jboss.org/schema/seam/transaction-2.3.xsd http://jboss.com/products/seam/transaction http://jboss.com/products/seam/transaction-2.3.xsd">
<core:init debug="${debug}" jndi-pattern="${jndiPattern}" />
<core:manager concurrent-request-timeout="500"
conversation-id-parameter="cid" conversation-timeout="120000" />
<core:resource-loader>
<core:bundle-names>
<value>admin</value>
<value>colourspec</value>
<value>dealer</value>
<value>enginespec</value>
<value>finance</value>
<value>messages</value>
<value>model</value>
<value>maintenance</value>
<value>market</value>
<value>report</value>
<value>shipment</value>
<value>vehicle</value>
<value>workitem</value>
</core:bundle-names>
</core:resource-loader>
<transaction:ejb-transaction />
<component class="org.jboss.seam.transaction.EjbSynchronizations"
jndi-name="java:app/jboss-seam/EjbSynchronizations" />
<component class="org.jboss.seam.async.TimerServiceDispatcher"
jndi-name="java:app/jboss-seam/TimerServiceDispatcher" />
<persistence:managed-persistence-context
auto-create="true" name="entityManager" persistence-unit-jndi-name="java:/vlsEntityManagerFactory" />
<security:identity authenticate-method="#{authenticator.authenticate}"
remember-me="true" />
</components>
standalone-full.xml (Datasource definition) :
<datasource jta="true" jndi-name="java:jboss/datasources/vlsDatasource" pool-name="vlsDatasource" enabled="true" use-java-context="true" use-ccm="false">
<connection-url>jdbc:postgresql://127.0.0.1:5432/vls</connection-url>
<driver>postgresql</driver>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>20</max-pool-size>
</pool>
<security>
<user-name>postgres</user-name>
<password>admin</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
<background-validation-millis>1</background-validation-millis>
</validation>
<statement>
<prepared-statement-cache-size>0</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>