[EJB 3.0] - Re: Displaying EJBs within JavaScript: what about the Entity
by SmokingAPipe
Any ideas on this? I've looked around the net and seen that I'm obviously not the only one who is encountering this issue. You grab your EJBs somehow while in a JSF backing bean, and then when JSP tries to display them, it's an error because they are detached and some members are not initialized.
Solution 1: Use a Filter that keeps an EntityManager hanging around for the duration of the request. Seems like an ugly way to do it, but I guess that would be "PHP-style", where it automatically frees DB connections when the request is finished.
Solution 2: Use Seam. Looks like a lot of people like that idea. I'm thinking about doing it, but I need to get this application in demo soon, and I'm not sure if I want to take on yet another layer of complexity here. On the plus side, Seam looks quite interesting. Is this the way to do it?
Solution 3: Anything else?
This is a problem that would be universal in any type of JSP + EJB application, so I'm surprised at how hard it is to find answers on this. Please let me know if you have ideas.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964816#3964816
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964816
19 years, 10 months
[JBoss Seam] - specific @SelectItem Question -
by mrohad
please help me with this issue , I tried to fix it in the last 4 days with no success
I'm using the SelectItems DataBinder and it doesn't work
I am getting this Exception , please tell me what do I do wrong
the only differences betwen my EAR and the example EAR file of seam-selectitems that do work for me is the version of jboss-seam.jar(I'm using the newset - 1.0.1GA)
it seem to me that it does called the method fetchLanguges()(@factory method)
I tried to change the SB to be SF -> i am getting there a different exception
that says that the List doesn't contains Object instance of SelectItem.
anonymous wrote :
| 11:03:27,697 INFO [STDOUT] Hibernate: select codestable0_.ID as ID1_, codestable0_.TABLE as TABLE1_, codestable0_.DESCRIPTION as DESCRIPT3_1_, codestable0_.CODE as CODE1_, codestable0_.LABEL as LABEL1_ from wannabet.codes_table codestable0_ where codestable0_.TABLE=?
| 11:03:27,867 INFO [STDOUT] Hibernate: select codestable0_.ID as ID1_, codestable0_.TABLE as TABLE1_, codestable0_.DESCRIPTION as DESCRIPT3_1_, codestable0_.CODE as CODE1_, codestable0_.LABEL as LABEL1_ from wannabet.codes_table codestable0_ where codestable0_.TABLE=?
| 11:03:27,887 ERROR [STDERR] 13/08/2006 11:03:27 com.sun.facelets.FaceletViewHandler handleRenderException
| SEVERE: Error Rendering View[/login/register.xhtml]
| java.lang.NullPointerException
| at org.jnp.interfaces.NamingContext.bind(NamingContext.java:556)
| at org.jnp.interfaces.NamingContext.bind(NamingContext.java:531)
| at javax.naming.InitialContext.bind(InitialContext.java:359)
| at org.jboss.seam.contexts.StatelessContext.set(StatelessContext.java:42)
| at org.jboss.seam.Component.handleFactoryMethodResult(Component.java:1415)
| at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1390)
| at org.jboss.seam.Component.getInstance(Component.java:1339)
| at org.jboss.seam.Component.getInstance(Component.java:1323)
| at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:44)
| at org.apache.myfaces.config.LastVariableResolverInChain.resolveVariable(LastVariableResolverInChain.java:42)
| at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:134)
| at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
| at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
| at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
| at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
| at javax.faces.component.UISelectItems.getValue(UISelectItems.java:55)
| at org.apache.myfaces.shared_impl.util.SelectItemsIterator.hasNext(SelectItemsIterator.java:102)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.internalGetSelectItemList(RendererUtils.java:477)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getSelectItemList(RendererUtils.java:453)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:277)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:251)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
| at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.renderChild(RendererUtils.java:442)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.renderChildren(HtmlGridRendererBase.java:216)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlGridRendererBase.encodeEnd(HtmlGridRendererBase.java:98)
| at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:242)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| 11:03:27,937 INFO [STDOUT] Hibernate: select codestable0_.ID as ID1_, codestable0_.TABLE as TABLE1_, codestable0_.DESCRIPTION as DESCRIPT3_1_, codestable0_.CODE as CODE1_, codestable0_.LABEL as LABEL1_ from wannabet.codes_table codestable0_ where codestable0_.TABLE=?
|
|
my stateless-
@Stateless
| @Name("login")
| public class LoginAction
| implements Login
| {
| private static final String USER_VAR = "loggedIn";
|
| @PersistenceContext
| private EntityManager em;
|
| @In
| Context sessionContext;
|
|
| @In(required=false) @Valid
| CodesTable codesTable;
|
| @SelectItems(labelMethod="getLabel",valueMethod="getId")
| public List<CodesTable> lang;
|
| @Factory("lang")
| public void fetchLanguages()
| {
| /*ArrayList<SelectItem> a = new ArrayList<SelectItem>();
| SelectItem selectedItem = new SelectItem(1,"one");
| SelectItem selectedItem1 = new SelectItem(2,"two");
| a.add(selectedItem);
| a.add(selectedItem1);
| selectedItem.*/
| List resultList = em.createQuery("select c from CodesTable c where c.table=:table")
| .setParameter("table","languages").getResultList();
| this.lang = resultList;
|
| }
|
|
|
|
|
| }
here is my xhtml-
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
| <html xmlns="http://www.w3.org/1999/xhtml"
| xmlns:s="http://jboss.com/products/seam/taglib"
| xmlns:ui="http://java.sun.com/jsf/facelets"
| xmlns:f="http://java.sun.com/jsf/core"
| xmlns:h="http://java.sun.com/jsf/html">
| <body>
| <ui:composition template="/WEB-INF/template.xhtml">
| <ui:define name="topnav">
| <ui:include src="/WEB-INF/incl/store_nav.xhtml">
| <ui:param name="page" value="home" />
| </ui:include>
| </ui:define>
|
| <ui:define name="sidebar">
| <ui:include src="/WEB-INF/incl/login.xhtml" />
| </ui:define>
|
| <ui:define name="body">
| <f:view>
| <h:form>
| <h:outputText value="Registration date: #{user.regDate}" rendered="#{loggedIn!=null}" />
|
| <h:panelGrid columns="2">
| <h:outputText value="First name: " />
| <h:inputText value="#{user.firstName}" />
| <h:outputText value="Last name: " />
| <h:inputText value="#{user.lastName}" />
| <h:outputText value="Username: " />
| <h:panelGroup>
| <h:inputText id="usernameField" value="#{user.username}" />
| <h:message for="usernameField" />
| </h:panelGroup>
| <h:outputText value="Password: " />
| <h:inputSecret value="#{user.password}" />
| <h:outputText value="Language: " />
| <h:selectOneMenu >
| <f:selectItems value="#{lang}" />
| </h:selectOneMenu>
| </h:panelGrid>
|
| <h:commandButton value="Register" action="#{login.register}" rendered="#{loggedIn==null}" />
| <h:commandButton value="Update" action="#{login.update}" rendered="#{loggedIn!=null}" />
| </h:form>
| </f:view>
| </ui:define>
| </ui:composition>
| </body>
| </html>
|
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964815#3964815
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964815
19 years, 10 months
[EJB 3.0] - Can't find branch for FD8 release, posted documentation is o
by gcomnz
To start off, before this relatively negative post: THANKS!!! JBOSS is the sh*t. I love the attitude, I love the ethic, and I love the risk taking. This is business as it should be, and it rocks.
That said:
1. The EJB 3.0 releases don't contain source, making it difficult to attach source in IDEs for debugging
2. I've been searching for a long time in the CVS repository and can't seem to find the version tag for releases, meaning that I can't find the accurate sources for what I'm using in order to get around problem 1
3. The online Javadocs are *** seriously *** out of date, meaning I can't attach to those in the IDE either.
4. Responsiveness on this forum is lackluster at the very best. I'm a paying customer, so I get to complain about that vociferously ;-)
In any case: I think JBoss' future is closely tied to it's EJB 3.0 product's success. Just an opinion. But I'd imagine it's a reasonable one. So I suggest some better packaging, QA (on the Install doc, for example, that's a pitiful situation), and document/source policies. Look to Seam/Hibernate for examples. The source is in their distro. Frankly they package too much in their distro, but its the right choice, and it makes life easy.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964813#3964813
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964813
19 years, 10 months