[JBoss Seam] - Re: Seam 2 + JBoss Portal 2.6 portlets
by dmiklancic
I have downloaded and deployed the Seam 2.0 Portlet Example according to the instructions on the blog. The portlet deploys fine, but the application does not work properly. Specifically, following a hotel search, clicking on View Hotels does not go the the hotel page, but redisplays the same hotel list. Other anomolies: help (?) works initially, but following a click on View Hotels, it no longer works; unable to logout; clicking on various help-related links redisplays the same portlet in a new window, but fails to navigate to the appropriate page.
I see no error messages in the log files or on the console.
In a personal portlet, I am unable to get @DataModel, @DataModelSelection, or s:link to work in a portlet -- works fine outside of the portal.
I am using JBoss AS 4.2.2.GA, JBoss Portal 2.6.3.GA, Seam 2.0.1.CR1
Are these know problems? If not, any suggestions?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116058#4116058
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116058
16 years, 5 months
[EJB 3.0] - Confused EJB3 Beginner - Ignored EJB3 Annotations
by skidvd
I'm sure this is a simple beginner error, but I've been pouring over both the JBoss and Hibernate docs and wikis and and am not finding the key missing points.
I'm using JBoss 4.2.2.GA with it's included hibernate3. I'm attempting to build EJB3 standard Entities. I have several classes that are annotated with the javax.persistence.Entity anotation (@Entity) as well as the associated @Column, @Id, etc. All of the annotations I use are from the javax.persistence package (i.e. I'm not using any hibernate or JBoss specific ones). My classes are built into a jar with an associated persistence.xml file which maps to my Datasource (a PostgreSQL one) and sets the hibernate.hbm2ddl.auto property to create. This jar fle is then bundled together with another MDB bean in an ear and deployed.
It all deploys fine and associated table are created. However, it appears that my Annotations are ignored! It seems that hibernate is reflecting upon the classes in question and building it's own view of them for persistance purposes. Specifically, the @Column name and length attributes are NOT as coded in my @Column annotations - they are based upon the actual class attribute name and what must be default lengths. Additionally, the @Enumerated (EnumType.STRING) annotation is similiarly ignored as the created DB tables have integer types.
I've been looking at many different version of documentation as EJB3 support within both hibernae and JBoss have evolved. Yet, I'm fundamentaly missing something. Hence I'm starting to question my understanding.
Is there some configuration that must be done to cause hibernate to honor the Annotations in preference to it's reflect and/or to disable it's reflection? Is it sufficient to have just EJB3 annotated classes with a persistence.xml file or are other configurations and/or files still required in and EJB3 environment - the book I've been working from, 'EJB3 In Action', seems to indicate that this is all it takes.
Are the hbm.xml and/or hibernate config files still required? If so, can they be built from the Anotations? How? It seems that a HAR based deployment once was preferable, but perhaps no longer is? I've additonally added a hibernate-service.xml service module in the ear's jboss-app that refernces the org.jboss.hibernate.jmx.Hibernate mbean. This made no difference in the ignored annotations behavior? Is this approach still needed/relavant?
Any and all guidence to a bewildered EJB3 beginner will be greatly apreciated!
TIA!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116057#4116057
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116057
16 years, 5 months
[JBoss Seam] - Re: Design question with Rich GWT Ajax Client
by sdegardin
"pete.muir(a)jboss.org" wrote : Wrap your calls to Seam components in an ContextHttpServletRequest. Make sure the conversationId is in the request parameter map you pass in.
Can I put the conversation id into the JSON Message and, in that case, do the same logic as in "SOAPRequestHandler" then without wrapping my code in ContextHttpServletRequest which need the request param ?
What SOAPRequestHandler does for each request is :
|
| ServletLifecycle.beginRequest(request);
|
| ServletContexts.instance().setRequest(request);
|
| String conversationId = //I extract my cid here
| ConversationPropagation.instance().setConversationId( conversationId );
| Manager.instance().restoreConversation();
|
| ServletLifecycle.resumeConversation(request);
and after the request completion :
| String conversationId = Manager.instance().getCurrentConversationId();
| if (conversationId != null)
| {
| //put the cid in my JSON response
| }
| Manager.instance().endRequest( new ServletRequestSessionMap(request) );
Is that enough to use the Seam-managed persistence context and Seam managed transaction ?
Tks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116056#4116056
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116056
16 years, 5 months
[Beginners Corner] - invoking login method
by robert_trudel
hi
i use HSQLD, jboss 4.2 and seam 2
my user class
| @Entity
| @Name("user")
| @Scope(SESSION)
| public class User implements Serializable{
|
| @Id @GeneratedValue
| private long id;
|
| private String userName;
| private String password;
|
| private String firstName;
| private String lastName;
|
| private int sexe;
| private int sexualOrientation;
|
| private String email;
|
| private Date birthday;
| ...
| }
|
the login action
| @Stateless
| @Name("authenticator")
| public class AuthenticatorAction implements Authenticator{
|
| @In
| Identity identity;
|
| @Out
| private User user;
|
| @PersistenceContext
| private EntityManager em;
|
| @In
| private transient Context sessionContext;
| @In
| private transient FacesContext facesContext;
|
| public boolean authenticate() {
| facesContext.addMessage(null, new FacesMessage("authenticate"));
| List<User> results = em.createQuery("select u from User u where userName=:username and password=:password")
| .setParameter("username", identity.getUsername())
| .setParameter("password", identity.getPassword())
| .getResultList();
|
|
| if ( results.size()==0 )
| {
| facesContext.addMessage(null, new FacesMessage("Invalid login"));
| return false;
| }
| else
| {
| user = results.get(0);
| identity.addRole("visitor");
| return true;
| }
| }
|
| }
|
my persistence.xml
| <persistence xmlns="http://java.sun.com/xml/ns/persistence"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
| version="1.0">
|
| <persistence-unit name="colocfacile">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/colocfacileDatasource</jta-data-source>
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
| <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.format_sql" value="true"/>
| <property name="jboss.entity.manager.factory.jndi.name" value="java:/colocfacileEntityManagerFactory"/>
| </properties>
| </persistence-unit>
|
| </persistence>
|
in the database i done
| insert into User (userName, password, firstName, lastName, sexe, sexualOrientation, email, birthday) values ('demo', 'demo', 'paul', 'smith', 1, 1, 'paul(a)smith.com', '1979-01-01')
|
if i enter the wrong information, i can't login
and i get this message
| INFO [STDOUT] Hibernate:
| select
| user0_.id as id0_,
| user0_.userName as userName0_,
| user0_.password as password0_,
| user0_.firstName as firstName0_,
| user0_.lastName as lastName0_,
| user0_.sexe as sexe0_,
| user0_.sexualOrientation as sexualOr7_0_,
| user0_.email as email0_,
| user0_.birthday as birthday0_
| from
| User user0_
| where
| user0_.userName=?
| and user0_.password=?
| 00:31:53,390 ERROR [SeamLoginModule] Error invoking login method
| javax.el.ELException: javax.ejb.EJBTransactionRolledbackException: @Out attribute requires non-null value: authenticator.user
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:332)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
| at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
| at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
| at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
| at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174)
| at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:108)
| 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:597)
| 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 java.security.AccessController.doPrivileged(Native Method)
| 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:335)
| at org.jboss.seam.security.Identity.authenticate(Identity.java:324)
| at org.jboss.seam.security.Identity.quietLogin(Identity.java:265)
| at org.jboss.seam.security.Identity.isLoggedIn(Identity.java:182)
| at org.jboss.seam.security.Identity.isLoggedIn(Identity.java:172)
| at org.jboss.seam.security.Identity.authenticate(Identity.java:322)
| at org.jboss.seam.security.Identity.login(Identity.java:237)
| 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:597)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
| at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
| at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
| at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
| at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
| at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
| at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
| at javax.faces.component.UICommand.broadcast(UICommand.java:383)
| at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
| at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
| at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
| at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
| at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
| at java.lang.Thread.run(Thread.java:619)
| Caused by: javax.ejb.EJBTransactionRolledbackException: @Out attribute requires non-null value: authenticator.user
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
|
|
if i enter the correct information i get
| INFO [STDOUT] Hibernate:
| select
| user0_.id as id0_,
| user0_.userName as userName0_,
| user0_.password as password0_,
| user0_.firstName as firstName0_,
| user0_.lastName as lastName0_,
| user0_.sexe as sexe0_,
| user0_.sexualOrientation as sexualOr7_0_,
| user0_.email as email0_,
| user0_.birthday as birthday0_
| from
| User user0_
| where
| user0_.userName=?
| and user0_.password=?
|
so i would like to know how to avoid theses error when the information entered by the user is bad
any idea?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116053#4116053
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116053
16 years, 5 months
[Installation, Configuration & DEPLOYMENT] - pls help - calling EJB over IIOP
by sagimann
Hi,
I'm new to Jboss. I've been working with SJSAS up until now, and I'm pulling my hair out on this one:
I'm trying to simply configure my jboss-web.xml so that my servlet could call an EJB 3.0 stateless session bean. Both web app and ejb are running on JBoss 4.2.2GA ('all' configuration) with JDK 1.5, but not on the same host. For testing, however, I run them both on the same host (localhost).
My EJB 3.0 is a simple session bean called ejbtest.HelloBean with a remote interface ejbtest.HelloRemote. I've verified that, by default, it is registered in JNDI under:
(SJSAS): ejbtest.HelloRemote
(Jboss): ejbtest/HelloBean/remote
In SJSAS, in order to call the EJB from my web app, I would configure my web app's sun-web.xml like this:
| <ejb-ref>
| <ejb-ref-name>hello</ejb-ref-name>
| <jndi-name>corbaname:iiop:localhost:3700#ejbtest.HelloBean</jndi-name>
| </ejb-ref>
|
I combed the internet for the JBoss equivalent, and I'm still unable to create a valid jboss-web.xml file!!!
I already tried the following:
1. Override the default invoker proxy in my EJB's jboss.xml file, i.e.:
| <invoker-bindings>
| <invoker>
| <invoker-proxy-binding-name>iiop</invoker-proxy-binding-name>
| <jndi-name>ejbtest/HelloBean/remote</jndi-name>
| </invoker>
| </invoker-bindings>
|
2. use various jndi-name tags in jboss-web.xml, and get various errors:
corbaname:iiop:localhost:3528#ejbtest/HelloBean/remote
iiop://localhost:3528/ejbtest/HelloBean/remote
client error is: NPE
server error is:
javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException [Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]]
corbaloc::localhost:3528/JBoss/Naming/root/ejbtest/HelloBean/remote
corbaloc:iiop:localhost:3528/JBoss/Naming/root/ejbtest/HelloBean/remote
client error is: NPE
server error is:
javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: corbaloc:iiop:localhost:3528 not bound]
corbaname:iiop:localhost:3528/JBossCorbaNaming#ejbtest/HelloBean/remote
corbaname:iiop:localhost:3528/JBossCorbaNaming/root#ejbtest/HelloBean/remote
jnp://localhost:1099/ejbtest/HelloBean/remote
client error is: NPE
server error is:
javax.naming.NamingException: Could not dereference object [Root exception is org.omg.CORBA.OBJECT_NOT_EXIST: Server-side Exception: null vmcid: 0x0 minor code: 0 completed: No]
jnp://localhost:1099/iiop/ejbtest/HelloBean/remote
client error is: NPE
server error is:
javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: iiop not bound]
jnp://localhost:1099/ejbtest/HelloBean
client error is: NPE
server error is:
java.lang.ClassCastException: org.jnp.interfaces.NamingContext
No dice.
I am NOT looking for a solution that involves writing JBoss-specific code in my web app, cuz it won't be portable.
Any ideas??? It should not be that complex AFAIK.
thanks in advance...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4116047#4116047
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4116047
16 years, 5 months