[jboss-user] [JBoss Seam] - entityManagerFactory resolves to null
jjfraney
do-not-reply at jboss.com
Wed Sep 5 09:26:02 EDT 2007
I'm using seam 1.2.1GA inside resin 3.0.24. I'm not using EJB. I am using JPA.
Here is segment of log output with the top of the stack trace to the error I am facing:
| [08:09:18.736] FINE org.jboss.seam.core.Events Processing event:org.jboss.seam.postCreate.em
| [08:20:06.868] FINE org.jboss.seam.jsf.SeamVariableResolver resolving name: broadcastEntityManagerFactory
| [08:20:06.915] FINE org.jboss.seam.contexts.Contexts found in application context: broadcastEntityManagerFactory
| [08:20:06.915] FINE org.jboss.seam.jsf.SeamVariableResolver Seam component resolved, but unwrap method returned null
| [08:20:06.925] FINE org.apache.myfaces.el.PropertyResolverImpl Exception while retrieving property; base : com.gc.web.pages.MapSubAccountsHelper1_$$_javassist_0, property : hello
| [08:20:06.925]java.lang.NullPointerException
| [08:20:06.925] at org.jboss.seam.core.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:77)
| [08:20:06.925] at org.jboss.seam.core.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:105)
| [08:20:06.925] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| [08:20:06.925] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| [08:20:06.925] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| [08:20:06.925] at java.lang.reflect.Method.invoke(Method.java:597)
| [08:20:06.925] at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
| [08:20:06.925] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
| [08:20:06.925] at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
|
|
I am using eclipse to single step through the seam code. I use 'evaluate java expression' feature.
org.jboss.seam.coreExpressions.getValue is the lowest my
| public Object getValue()
| {
| if ( isFacesContext() )
| {
| return getFacesValueBinding().getValue( FacesContext.getCurrentInstance() );
| }
| else
| {
| return getValueExpression().getValue(EL_CONTEXT);
| }
| }
|
Here are eclipse' evaluations of some of the expressions:
| getFacesValueBinding().getValue( FacesContext.getCurrentInstance() )
| null
|
| getFacesValueBinding()
| (org.apache.myfaces.el.ValueBindingImpl) #{broadcastEntityManagerFactory}
|
OK, so I go abit further in my debug session. I get down to:
| SeamVariableResolver.resolveVariable(FacesContext, String) line: 57
| LastVariableResolverInChain.resolveVariable(FacesContext, String) line: 42
| ValueBindingImpl$ELVariableResolver.resolveVariable(String) line: 574
| NamedValue.evaluate(VariableResolver, FunctionMapper, Logger) line: 124
| ValueBindingImpl.getValue(FacesContext) line: 383
| Expressions$1.getValue() line: 69
| ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding() line: 169
|
The call to Component.forName() returns non-null:
| component Component (id=9135)
| beanClass Class<T> (org.jboss.seam.core.EntityManagerFactory) (id=2554)
| ...
|
The logic for this case is for the resolver to return null?
| 57 if( component == null)
| 58 {
| ...
| 70 }
| 71 else
| 72 {
| 72 log.debug("Seam component resolved, but unwrap method returned null");
| 73 return null;
| 74 }
|
|
Here is my components.xml (seam 1.2.1)
| <core:entity-manager-factory name="broadcastEntityManagerFactory"
| persistence-unit-name="broadcast" />
|
| <core:managed-persistence-context name="em" auto-create="true"
| entity-manager-factory="#{broadcastEntityManagerFactory}"/>
|
Here is log output showing the seam groks the components.xml file:
| [08:08:09.036] INFO org.jboss.seam.init.Initialization Installing components...
| [08:08:09.069] INFO org.jboss.seam.Component Component: broadcastEntityManagerFactory, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.EntityManagerFactory
| Sep 5, 2007 8:08:09 AM org.jboss.seam.Component <init>
| INFO: Component: broadcastEntityManagerFactory, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.EntityManagerFactory
| [08:08:09.070] INFO org.jboss.seam.Component Component: broadcastEntityManagerFactory, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.core.EntityManagerFactory
| [08:08:09.077] FINE org.jboss.seam.Component broadcastEntityManagerFactory.persistenceUnitName=broadcast
| [08:08:09.079] FINE org.jboss.seam.Component seam component not found: org.jboss.seam.core.events
| [08:08:09.080] FINE org.jboss.seam.Component seam component not found: org.jboss.seam.core.events
| [08:08:09.082] INFO org.jboss.seam.Component Component: em, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.ManagedPersistenceContext
| Sep 5, 2007 8:08:09 AM org.jboss.seam.Component <init>
| INFO: Component: em, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.ManagedPersistenceContext
| [08:08:09.082] INFO org.jboss.seam.Component Component: em, scope: CONVERSATION, type: JAVA_BEAN, class: org.jboss.seam.core.ManagedPersistenceContext
| [08:08:09.291] FINE org.jboss.seam.Component em.entityManagerFactory=#{broadcastEntityManagerFactory}
| [08:08:09.294] FINE org.jboss.seam.Component seam component not found: org.jboss.seam.core.events
| [08:08:09.294] FINE org.jboss.seam.Component seam component not found: org.jboss.seam.core.events
|
|
And, of course I have a persistence unit named 'broadcast', which I would post but I don't think it is relevant.
Any comment or recommendations?
Thanks,
John
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4081312#4081312
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4081312
More information about the jboss-user
mailing list