[JBoss Seam] - Re: TransactionListener not bound
by csaldanh
This is the global JNDI Namespace output from the JMX console
+- restoreview (class: org.jnp.interfaces.NamingContext)
| +- SignUp (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
| +- UpdateProfile (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
| +- RestaurantManager (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
| +- RestaurantList (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
| +- AddRestaurant (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
| +- ReviewManager (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
| +- Account (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
| +- Authentication (class: org.jnp.interfaces.NamingContext)
| | +- localStatefulProxyFactory (class: org.jboss.ejb3.stateful.StatefulLocalProxyFactory)
| | +- local (class: java.lang.Object)
It seems to me missing TransactionListener. I wonder why
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094179#4094179
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094179
18Â years, 9Â months
[JBoss Seam] - Re: DataModel and DataModelSelection question
by w17chm4n
I`ve changed to stateful EJB but still it doesn`t inject the questionCategory.
| @Stateful
| @Name("QuestionCategoryController")
| public class QuestionCategoryControllerBean implements QuestionCategoryController {
|
| @Logger
| private Log log;
|
| @In(create = true)
| private QuestionCategoryManager questionCategoryManager;
|
| @DataModelSelection
| @In(required = false)
| @Out(required = false)
| private QuestionCategory questionCategory;
|
| @DataModel
| private List<QuestionCategory> categoryList;
|
| @Out(required = false)
| private List<Question> questionList;
|
| public void addCategory() {
| questionCategory.setCreated(new Date());
| questionCategoryManager.addCategory(this.questionCategory);
| }
|
| public void removeCategory(QuestionCategory questionCategory) { //todo
| log.info("Trying to remove #{questionCategory.categoryName}");
| if(questionCategory == null) {
| log.fatal("questionCategory is NULL !");
| } else {
| questionCategoryManager.removeCategory(questionCategory);
| }
| }
|
| @Factory("categoryList")
| public void getAllQuestionsCategories() {
| setCategoryList(questionCategoryManager.getAllQuestionCategories());
| }
|
| public List<QuestionCategory> getCategoryList() {
| return categoryList;
| }
|
| public void setCategoryList(List<QuestionCategory> categoryList) {
| this.categoryList = categoryList;
| }
|
| public List<Question> getQuestionList() {
| return questionList;
| }
|
| public void setQuestionList(List<Question> questionList) {
| this.questionList = questionList;
| }
|
| @Destroy @Remove
| public void destroy() {}
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094178#4094178
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094178
18Â years, 9Â months
[JBoss Seam] - Log and EntityManager are not injected in integration test
by vanyatka
Hi,
I'm at the very beginning of adding integration testing to my Seam application, and I have the following problem. The EntityManager and Log objects used inside the action bean are nulls during invoking the tests, unless I set them manually (which AFAIK I should not).
( To clarify, the test just tries to access rootCategories context variable which is set in the SFSB, also shown below)
anonymous wrote : @Test
| public void test() throws Exception {
|
| String cid = new FacesRequest("/addCategory.seam") {
|
| @Override
| protected void invokeApplication() throws Exception {
| getValue("#{rootCategories}");
| }
| }
|
Here is the SFSB:
anonymous wrote : @Local(CategoryManager.class)
| @Stateful
| @Name("categoryBean")
| public class CategoryBean {
|
| @Logger
| Log log;
|
| @In(create = true)
| private EntityManager em;
|
| @Out(required = false)
| private List rootCategories;
|
| public CategoryBean() {
| }
|
| @Factory("rootCategories")
| public List findRootCategories() {
| log.info("Refreshing the list of root Categories");
| Query query = em.createQuery("select c from Category c where c.parentCategory.id = 1 and c.id <> 1");
| List list = query.getResultList();
| for (Object o : list) {
| System.out.println("o = " + o);
| }
| return list;
| }
|
| @Remove
| @Destroy
| public void remove() {
| }
|
| }
Now I run into NullPointerException inside findRootCategories() method, because neither em no log objects are intialized. Unit testing works fine, btw, when I add the following lines to the test body:
anonymous wrote : EntityManagerFactory emf =
| Persistence.createEntityManagerFactory("MyCardsPersistenceUnit");
| EntityManager em = emf.createEntityManager();
| setField(categoryBean, "em", em);
| setField(categoryBean, "log", Logging.getLog(CategoryBean.class));
|
Can anyone give a hint?
Thanks,
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094177#4094177
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094177
18Â years, 9Â months
[JBoss Seam] - Re: How to write a validator that compares two fields
by chawax
One more problem I can't find how to workaround ...
I try to use my validator within a facelet taglib. I would like it to be used this way (t4:compareFields tag) :
<s:decorate template="/decorateField.xhtml" for="confirmerMotDePasse">
| <h:inputSecret id="confirmerMotDePasse" value="#{employeCrud.confirmerMotDePasse}" required="#{employe.id == null}">
| <t4:compareFields compareTo="nouveauMotDePasse" message="error.motDePasse.differents" />
| </h:inputSecret>
| </s:decorate>
My validator class has two properties : "compareTo" and "message", with getters and setters. But these properties are always null when the validate() method is called.
I added a t4.taglib.xml file in /WEB-INF :
<?xml version="1.0" encoding="UTF-8"?>
| <!DOCTYPE facelet-taglib PUBLIC
| "-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
| "http://java.sun.com/dtd/facelet-taglib_1_0.dtd">
| <facelet-taglib xmlns="http://java.sun.com/JSF/Facelet">
| <namespace>http://myCompany.fr/t4/taglib</namespace>
| <tag>
| <tag-name>compareFields</tag-name>
| <validator>
| <validator-id>validator.compareFields</validator-id>
| </validator>
| </tag>
| </facelet-taglib>
Note I had to remove @Name and @Validator annotations in my validator class, because it could not find the validator-id (is it a bug ?). So I added these lines in faces-config.xml file :
<validator>
| <validator-id>validator.compareFields</validator-id>
| <validator-class>fr.myCompany.t4.gui.validators.CompareFieldsValidator</validator-class>
| </validator>
Is there something special to do in the validator class so that facelets can use my validator's setters ?
Thanks in advance
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4094173#4094173
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4094173
18Â years, 9Â months