[JBoss Seam] - Re: since today (JBSEAM-954?) I get NPE in setEntityManagerF
by codelion
Trying to answer Gavin's question how I get this.
To be clear, the NPE is gone with actualFlushMode not being null any more.
For completeness of record let's mention I'm now running the 2nd patch of JBSEAM-1009 on a build we did from a CVS pull on Friday.
When starting up the server and having a breakpoint both in PersistenceContexts afterRender() and beforeRender(), then when for the first time trying to log in, resulting in a redirect to a login page, I get the first break in afterRender(), not in beforeRender():
Thread [http-0.0.0.0-8080-1] (Suspended (breakpoint at line 87 in PersistenceContexts))
| PersistenceContexts.afterRender() line: 87
| TransactionalSeamPhaseListener(AbstractSeamPhaseListener).afterRender(FacesContext) line: 233
| TransactionalSeamPhaseListener(SeamPhaseListener).afterPhase(PhaseEvent) line: 116
| PhaseListenerManager.informPhaseListenersAfter(PhaseId) line: 89
| LifecycleImpl.render(FacesContext) line: 391
| FacesServlet.service(ServletRequest, ServletResponse) line: 138
| ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 252
| ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 173
| SeamFilter$FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 63
| RedirectFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 45
| SeamFilter$FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 49
| ExceptionFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 57
| SeamFilter$FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 49
| MultipartFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 79
| SeamFilter$FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 49
| SeamFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 84
| ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 202
| ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 173
| TidyXMLFilter(BaseXMLFilter).doXmlFilter(FilterChain, HttpServletRequest, HttpServletResponse) line: 67
| Filter(BaseFilter).doFilter(ServletRequest, ServletResponse, FilterChain) line: 223
| ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 202
| ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 173
| ReplyHeaderFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 96
| ApplicationFilterChain.internalDoFilter(ServletRequest, ServletResponse) line: 202
| ApplicationFilterChain.doFilter(ServletRequest, ServletResponse) line: 173
| StandardWrapperValve.invoke(Request, Response) line: 213
| StandardContextValve.invoke(Request, Response) line: 178
| SecurityAssociationValve.invoke(Request, Response) line: 175
| NonLoginAuthenticator(AuthenticatorBase).invoke(Request, Response) line: 432
| JaccContextValve.invoke(Request, Response) line: 74
| StandardHostValve.invoke(Request, Response) line: 126
| ErrorReportValve.invoke(Request, Response) line: 105
| CachedConnectionValve.invoke(Request, Response) line: 156
| StandardEngineValve.invoke(Request, Response) line: 107
| CoyoteAdapter.service(Request, Response) line: 148
| Http11Processor.process(InputStream, OutputStream) line: 869
| Http11Protocol$JmxHttp11ConnectionHandler(Http11BaseProtocol$Http11ConnectionHandler).processConnection(TcpConnection, Object[]) line: 664
| PoolTcpEndpoint.processSocket(Socket, TcpConnection, Object[]) line: 527
| MasterSlaveWorkerThread.run() line: 112
| ThreadWithAttributes(Thread).run() line: 595
The FacesContext on the stack in its external context shows we're still at the original page, the one that requires the login.
My best guess is that maybe because in Pages method enterPage() if there is a redirectToLoginView() then the page.enter() isn't called.
Whether there is a significant difference in that behavior with or without JBSEAM-1009 I can't grasp for sure, but it seems even without 1009 there will be a call to redirectToLoginView() without calling page.enter().
So the answer would be you can get there with a redirectToLoginView().
Does that answer the question? If still needed, I can offer my Eclipse to debug with simple remote login to a URL in the browser, Windows and Mac.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027343#4027343
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027343
19Â years, 1Â month
[JBoss Seam] - Re: What's wrong with this components.xml / persistence.xml
by fernando_jmt
Ok, I will describe what I have in my configuration files when I deploy to Tomcat.
1.- My components.xml
|
| <core:managed-persistence-context name="entityManager" auto-create="true"
| persistence-unit-jndi-name="java:/myappEntityManagerFactory"/>
|
2.- My persistence.xml
| <persistence-unit name="myappPU">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/myappDatasource</jta-data-source>
| <properties>
| <property name="hibernate.hbm2ddl.auto" value="update"/>
| <property name="hibernate.cache.use_query_cache" value="true"/>
| <property name="hibernate.show_sql" value="true"/>
| <!-- These are the default for JBoss EJB3, but not for HEM: -->
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/myappEntityManagerFactory"/>
| </properties>
| </persistence-unit>
|
3.- META-INF jboss-beans.xml
| <bean name="myappDatasourceBootstrap" class="org.jboss.resource.adapter.jdbc.local.LocalTxDataSource">
| <property name="driverClass">com.mysql.jdbc.Driver</property>
| <property name="connectionURL">jdbc:mysql://192.168.10.1:3306/myapp</property>
| <property name="userName"><value class="java.lang.String">fernando</value></property>
| <property name="password"><value class="java.lang.String">fernando</value></property>
| <property name="jndiName">java:/myappDatasource</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="myappDatasource" class="java.lang.Object">
| <constructor factoryMethod="getDatasource">
| <factory bean="myappDatasourceBootstrap"/>
| </constructor>
| </bean>
|
|
HTH.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4027339#4027339
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4027339
19Â years, 1Â month