[JBoss Seam] - Re: Problem with s:selectItems
by jqueryï¼ interia.pl
I've got Seam from CVS then changed xhtml to:
| <h:selectOneMenu value="#{personHome.countryId}" >
| <s:selectItems value="#{personHome.countries}" var="country" label="#{country.name}" />
| <s:convertEntity/>
| </h:selectOneMenu>
|
|
And then I got NPE
|
| java.lang.NullPointerException
| at org.jboss.seam.ui.EntityConverter.getIdFromEntity(EntityConverter.java:116)
| at org.jboss.seam.ui.EntityConverter.getAsString(EntityConverter.java:171)
| at org.apache.myfaces.shared_impl.renderkit.RendererUtils.getConvertedStringValue(RendererUtils.java:544)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.getSubmittedOrSelectedValuesAsSet(HtmlRendererUtils.java:321)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.internalRenderSelect(HtmlRendererUtils.java:296)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlRendererUtils.renderMenu(HtmlRendererUtils.java:252)
| at org.apache.myfaces.shared_impl.renderkit.html.HtmlMenuRendererBase.encodeEnd(HtmlMenuRendererBase.java:54)
| at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:536)
| at org.jboss.seam.ui.JSF.renderChild(JSF.java:179)
| at org.jboss.seam.ui.JSF.renderChildren(JSF.java:162)
| at org.jboss.seam.ui.UIDecorate.encodeChildren(UIDecorate.java:178)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:244)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
| at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
| at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
| 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.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
| 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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| 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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| 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)
|
And why is there NPE connected with getting entity id although I set it on 1 (in code above)?
Thanks for any suggestions.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026904#4026904
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026904
19Â years, 1Â month
[JBoss Seam] - Re: Remember Me Exception
by gzoller
I pulled out IceFaces and tried it with the vanilla Seam-gen. Worked great. IceFaces is the culprit here.
{rant}
Y'know... I'm getting a bit flustered w/IceFaces. Great widgets but Seam integration is pretty flaky. Even tried the alpha of their next release--still lots of stability issues--not ready for production use. As great a union as these two technologies would make, it would appear there are still some key disconnects in their implementations. I'll watch future releases--I do love their widgets, but for now I've started playing with Ajax4JSF and RichFaces. Still having newbie issues--we'll see how that goes. I can't get things rendering/behaving how I want but so far no gonzo exceptions, so that's a good sign.
{/rant}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026898#4026898
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026898
19Â years, 1Â month
[JBoss Seam] - Re: SeamSecurity
by KoniKoni
thanks, that was...
It doesn't work with both options, i don't understand the difference
between
@PersistenceContext
private EntityManager em;
and
@In EntityManager em;
Code:
try{
| Usr usr = (Usr) em.createQuery(
| "from Usr where bname = :username and passwort = :password")
| .setParameter("username", identity.getUsername())
| .setParameter("password", identity.getPassword())
| .getSingleResult();
|
| if (usr != null) {
|
| log.info("------------------hallo");
| }
|
| return false;
| } catch (NoResultException ex) {
| FacesMessages.instance().add("Benutzername/Passwort falsch!");
| return false;
| }
Exeption with @In
20:22:14,139 ERROR [SeamLoginModule] Error invoking login method
javax.faces.el.EvaluationException: Exception while invoking expression #{authenticator.authenticate}
at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:59)
at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:74)
at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:102)
at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:102)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
at org.jboss.seam.security.Identity.authenticate(Identity.java:206)
at org.jboss.seam.security.Identity.authenticate(Identity.java:199)
at org.jboss.seam.security.Identity.login(Identity.java:184)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.sun.el.parser.AstValue.invoke(AstValue.java:151)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
at javax.faces.component.UICommand.broadcast(UICommand.java:106)
Caused by: org.jboss.seam.RequiredException: In attribute requires value for component: authenticator.em
at org.jboss.seam.Component.getInstanceToInject(Component.java:1920)
at org.jboss.seam.Component.injectFields(Component.java:1386)
at org.jboss.seam.Component.inject(Component.java:1156)
at org.jboss.seam.interceptors.BijectionInterceptor.bijectNonreentrantComponent(BijectionInterceptor.java:76)
at org.jboss.seam.interceptors.BijectionInterceptor.bijectComponent(BijectionInterceptor.java:58)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
why i do wrong?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026897#4026897
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026897
19Â years, 1Â month
[JBoss Seam] - Re: Problem with s:selectItems
by jqueryï¼ interia.pl
Actually the difference between parameters in set and get methods appeared because I was trying different combination of collections.
It was my mistake.
Now as you said the I have following code:
| @Name("personHome")
| public class PersonHome extends EntityHome<Person> {
|
| public List<Country> countries = new ArrayList<Country>();
| public long countryId = 1;
|
|
| public long getCountryId() {
| return countryId;
| }
|
| public void setCountryId(long countryId) {
| this.countryId = countryId;
| }
|
| public void setCountries(List<Country> countries) {
|
| }
|
| public List<Country> getCountries(){
| Country country = new Country();
| country.setId(1);
| country.setName("Poland");
| countries.add(country);
|
| return countries;
| }
| }
|
And xhtml:
|
| <h:selectOneMenu value="#{personHome.countryId}" converter="#{countryConverter.converter}">
| <s:selectItems value="#{personHome.countries}" var="country" label="#{country.name}" />
| </h:selectOneMenu>
|
|
And a converter which is based on ui seam example:
|
| @Name("countryConverter")
| public class CountryConverter {
| Converter getConverter(){
| return new Converter(){
| @Transactional
| public Object getAsObject(FacesContext arg0, UIComponent arg1, String arg2) throws ConverterException
| {
| if (arg2 == null) {
| return null;
| }
| try {
| return ((EntityManager) Component.getInstance("entityManager")).find(Country.class, Integer.valueOf(arg2));
| } catch (NumberFormatException e) {
| throw new ConverterException("Cannot find selected country", e);
| }
| }
|
| @Transactional
| public String getAsString(FacesContext arg0, UIComponent arg1, Object arg2) throws ConverterException
| {
| if (arg2 instanceof Country)
| {
| Country country = (Country) arg2;
| return (new Long(country.getId())).toString();
| }
| else
| {
| return null;
| }
| }
|
| };
| }
|
| }
|
But I still get error:
| Value is no String (class=java.lang.Long, value=1) and component person:_id38with path: {Component-Path : [Class: org.ajax4jsf.framework.ajax.AjaxViewRoot,ViewId: /specialist/spec_registration.xhtml][Class: javax.faces.component.html.HtmlForm,Id: person][Class: org.jboss.seam.ui.UIValidateAll,Id: _id7][Class: org.jboss.seam.ui.UIDecorate,Id: _id37][Class: javax.faces.component.html.HtmlSelectOneMenu,Id: _id38]} does not have a Converter
|
|
I don't know where the error comes from and why the converter is not visible.
I would apprecite any suggestions.
jquery
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4026894#4026894
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4026894
19Â years, 1Â month