-
1. Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
domen91 Dec 28, 2013 11:47 AM (in response to domen91)I have little edit config file nad set use-ccm to false. Restart AS and then i get no error such it is write in first post.
Why?
Second problem:
@EJB in Faces converter doesnt work in CR1 version (in Beta 1) it is working.
Code:
@FacesConverter(value = "unitConverter")
public class UnitConverter extends AbstractBean<UnitConverter> implements Converter {
private static final long serialVersionUID = 1L;
@EJB
UnitLocal unitLocal; // In CR1 is is null, in Beta 1 its working.
...
}
Tnx.
-
2. Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
cfillot Dec 28, 2013 3:41 PM (in response to domen91)1 of 1 people found this helpfulAbout your second problem, it seems that injection in JSF converters will only be possible with JSF 2.3+:
-
3. Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
domen91 Dec 29, 2013 4:02 AM (in response to cfillot)Too bad about injection in JSF converters & validators (I do not know why it worked in Beta 1 ).
Quick solution about injection:
add @ManagedBean and @ApplicationScoped above @FacesConverter (in JSF replace convertName => #{convertName}, in the validation stays JSF unchanged)
-
4. Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
daniell Jan 23, 2014 8:04 AM (in response to domen91)Have you found a solution for your first problem, the IllegalStateException complaining about an unknown connection?
I have the same issue (after porting from JBoss AS 7.1.1.Final without error to Wildfly 8.0.0.CR1) and invested a lot of time up to now to find out something useful. I do not even know the concrete source of the problem. Is it JTA, JPA or JCA?
I've only found the following pretty old forum-thread: https://community.jboss.org/thread/87186
When using this "solution" (flushing the session right before doing the UserTx.commit), the exception does not occur any more. Also when switching to CMT the exception is not raised any more.
But I would be very glad to know the reason why I'm getting this exception now and how to avoid it in the future...
-
5. Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
mandrosen Feb 10, 2014 1:34 PM (in response to domen91)I am having the same connection issue. I can confirm that both solutions mentioned work:
1.changing use-ccm to false
2. flushing the session before the call
I am concerned that solution 1 will leave us open to connection leaks, but since we never open connections manually, this might not be an issue. Solution 2 will require a lot of code changes and testing.
I have read that this isn't really a big deal -- one hint is that the exception is logged as INFO.
Is it really safe to ignore this exception and are there any other solutions?
-
6. Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
smarlow Feb 10, 2014 2:40 PM (in response to mandrosen)Could you enable trace logging for a few categories and reproduce the warning (with use-ccm=true). Some instructions for enabling trace logging are here.
Please enable trace logging for:
- org.jboss.jca.core.api.connectionmanager.ccm
- com.arjuna
- org.jboss.as.jpa
I think that will get us a basic idea of what is going on. It might also be helpful if someone can reproduce in a standalone deployment.
-
7. Re: Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
mandrosen Feb 10, 2014 3:32 PM (in response to smarlow)Thank you for looking into this. I attached the relevant section of our standalone.log with the trace logging enabled for the three categories you mentioned.
In our case, the sequence of events is the following:
In EbjA:
@PersistenceContext
private EntityManager em;
@EJB
private EjbBInt ejbB;
public Thing getThing() {
Thing thing = getThing();
ejbB.doSomethingElse();
return thing;
}
In EjbB:
@PersistenceContext
private EntityManager em;
public boolean doSomethingElse() {
...save something with EntityManager...
}
The Exception is thrown in EjbB.doSomethingElse() when trying to use the EntityManager.
Here is the datasource config:
<datasource jta="true" jndi-name="java:jboss/datasources/atDS" pool-name="MySqlDS" enabled="true" spy="true" use-ccm="true">
<connection-url>jdbc:mysql://devdb:3306/atdb</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql-connector-java-5.1.22-bin.jar</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>0</min-pool-size>
<max-pool-size>10</max-pool-size>
<prefill>true</prefill>
<use-strict-min>true</use-strict-min>
<flush-strategy>IdleConnections</flush-strategy>
</pool>
<security>
<user-name>......</user-name>
<password>.......</password>
</security>
</datasource>
-
standalone.log.zip 34.9 KB
-
-
8. Re: Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
smarlow Feb 10, 2014 5:12 PM (in response to domen91)Domen,
Would be great to have TRACE output from you also as there might be some variation between the problems reported here. When you have TRACE enabled, please recreate the reported problem and attach the output.
Scott
-
9. Re: Re: Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
smarlow Feb 10, 2014 5:56 PM (in response to mandrosen)Marc,
Your case looks a little different (according to the exception call stack) but could be related.
It looks like the connection "org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7@4de27c01" was obtained from EjbA and is being released during the EjbB invocation.
2014-02-10 14:17:02,388 INFO [org.jboss.jca.core.connectionmanager.listener.TxConnectionListener] (default task-5) IJ000311: Throwable from unregister connection: java.lang.IllegalStateException: IJ000152: Trying to return an unknown connection: org.jboss.jca.adapters.jdbc.jdk7.WrappedConnectionJDK7@4de27c01
at org.jboss.jca.core.connectionmanager.ccm.CachedConnectionManagerImpl.unregisterConnection(CachedConnectionManagerImpl.java:385)
at org.jboss.jca.core.connectionmanager.listener.TxConnectionListener.connectionClosed(TxConnectionListener.java:587)
at org.jboss.jca.adapters.jdbc.BaseWrapperManagedConnection.closeHandle(BaseWrapperManagedConnection.java:581)
at org.jboss.jca.adapters.jdbc.WrappedConnection.close(WrappedConnection.java:265)
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.closeConnection(DatasourceConnectionProviderImpl.java:144) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.releaseConnection(AbstractSessionImpl.java:391) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.engine.jdbc.internal.LogicalConnectionImpl.releaseConnection(LogicalConnectionImpl.java:255) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.afterStatementExecution(JdbcCoordinatorImpl.java:279) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.release(JdbcCoordinatorImpl.java:409) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.loader.Loader.doQuery(Loader.java:923) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:354) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2551) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.loader.Loader.doList(Loader.java:2537) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2367) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.loader.Loader.list(Loader.java:2362) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:496) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:387) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:229) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1260) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at org.hibernate.internal.QueryImpl.list(QueryImpl.java:103) [hibernate-core-4.3.0.Final.jar:4.3.0.Final]
at com.at.hib.persistence.dao.UsersDAO.getEmployee(UsersDAO.java:42) [athib.jar:]
at com.at.ejb.employee.EmployeeBean.getEmployee(EmployeeBean.java:183) [atbusiness.jar:]
While it is just an informational logged message, I think we should find the cause and verify correctness. I pasted the call stack here for convenience.
Scott
-
10. Re: Re: Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
mandrosen Feb 10, 2014 6:30 PM (in response to smarlow)That is correct, exactly what is happening.
-
11. Re: Re: Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
smarlow Feb 10, 2014 6:41 PM (in response to mandrosen)Marc,
Could also enable TRACE logging for org.hibernate and run again. I can't tell from the exception call stack, which Hibernate transaction factory was used (could of been CMTTransactionFactory, JtaTransactionFactory or JdbcTransactionFactory).
Scott
-
12. Re: Re: Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
mandrosen Feb 10, 2014 7:33 PM (in response to smarlow)Our persistence.xml has the following:
<property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
Do you need the full log?
-
13. Re: Re: Re: Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
mandrosen Feb 10, 2014 8:34 PM (in response to smarlow)Sorry, misread that. Here is the log. I tried to remove unnecessary entries for SQL, QueryPlans, Parameters, Entity Loading, etc.
-
standalone2.log.zip 59.3 KB
-
-
14. Re: Re: Re: WildFly 8 CR1: Problem with calling methods from EJB inside ManagedBean (via @EJB)
smarlow Feb 10, 2014 8:35 PM (in response to mandrosen)The full log would be fine, thanks. Have you tried commenting out the "hibernate.transaction.manager_lookup_class"?