[JBoss Seam] - In attribute requires value for component
by taprogge
Hi!
I am totally confused...
I am working with an existing Seam application running inside JBoss Portal (JBoss 4.0.4.GA, EJB3 rc8, Portal 2.4.0.CR3) with the MyFacesGenericPortlet.
All existing components work.
Now I tried to add a new component and get said error.
I have stripped it down in trying to find the cause, but had no luck.
Perhaps one of you can tell me what I am doing wrong.
This is my POJO to hold the entered information. Even scoping it "SESSION" did not make any difference.
| @Name("userinput")
| @Scope(SESSION)
| public class UserInput {
|
| private String username;
| private String password;
|
| public String getPassword() {
| return password;
| }
| public void setPassword(String aPassword) {
| this.password = aPassword;
| }
| public String getUsername() {
| return username;
| }
| public void setUsername(String aUsername) {
| this.username = aUsername;
| }
| }
|
This is my SessionBean:
| @Stateful
| @Conversational(ifNotBegunOutcome = Outcome.REDISPLAY)
| @Scope(CONVERSATION)
| @Name("usercreate")
| public class UserActionBean implements UserAction {
|
| private static Logger logger = Logger.getLogger(UserActionBean.class);
|
| @PersistenceContext(type = EXTENDED)
| private EntityManager em;
|
| @In(create = true)
| private UserInput theUser;
|
| @Begin
| public String beginStuff() {
| logger.info("begin called");
| logger.info("Data so far: username="
| + theUser.getUsername());
| return Outcome.REDISPLAY;
| }
|
| @Remove
| @Destroy
| public void destroy() { }
| }
|
And this is the jsp I use as default view for the portlet:
| <f:view>
| <h:form>
| <table border="0">
| <tr>
| <td align='left'>username:</td>
| <td><h:inputText id="username"
| value="#{userinput.username}"
| required="true" />
| <h:message style="color:red" for="username" /></td>
| </tr>
| <tr>
| <td align='left'>password:</td>
| <td><h:inputText id="password"
| value="#{userinput.password}"
| required="true" />
| <h:message style="color:red" for="password" /></td>
| </tr>
| <tr>
| <td height='60' align='left'>
| <h:commandButton type="submit" value="create user"
| action="#{usercreate.beginStuff}" /></td>
| <td align="right"><input type="reset" value="reset"></td>
| </tr>
| </table>
| <h:messages style="color:red" />
| </h:form>
| </f:view>
|
Now, entering no information at all results (correctly) in "required" messages to be displayed for each field.
Entering any data and hitting the button results in a
| org.jboss.seam.RequiredException: In attribute requires value for component: usercreate.theUser
|
being thrown.
Any thoughts?
Regards, Phil
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963142#3963142
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963142
19 years, 9 months
[EJB 3.0] - Querying a join table
by aidan_b5
Hi, I need to query the join table of a many to many relationship and am having trouble.
PersistentValue class:
@ManyToMany(cascade = {CascadeType.ALL}, fetch = FetchType.LAZY)
| @JoinTable(name = "user_filter",
| joinColumns={@JoinColumn(name="persistentvalue_id")},
| inverseJoinColumns={@JoinColumn(name="persistentuser_id")})
| public Collection<PersistentUser> getUsersAllowed() {
| if(usersAllowed == null) usersAllowed = new ArrayList<PersistentUser>();
| return usersAllowed;
| }
PersistentUser class:
@ManyToMany(mappedBy = "usersAllowed")
| public Collection<PersistentValue> getUserFilters() {
| if(userFilters == null) userFilters = new ArrayList<PersistentValue>();
| return userFilters;
| }
If I try to query user_filters directly, I get a 'no such mapping exception'. Do I need to create an entity representing the join table, and if so, how do i do this?
Your help appreciated, thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963139#3963139
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963139
19 years, 9 months
[EJB 3.0] - Re: Why isn't @Predestory honored in @Stateless beans as wel
by wolfc
I still say some thought is needed.
Here I trick the thread pool into instantiating more objects (and subsequently destroying them). So even the thread pool calls pre destroy. Question remains what to do with that 1 instance that stays in the thread pool on undeploy...
deploy...
| 12:34:16,108 INFO [StackedStatelessBean] post construct org.jboss.ejb3.test.wolfc.StackedStatelessBean@6258e1
| 12:34:16,109 INFO [StackedStatelessBean] 2 is invoking next one
| 12:34:16,112 INFO [StackedStatelessBean] post construct org.jboss.ejb3.test.wolfc.StackedStatelessBean@fadb88
| 12:34:16,114 INFO [StackedStatelessBean] 1 is invoking next one
| 12:34:16,114 INFO [StackedStatelessBean] post construct org.jboss.ejb3.test.wolfc.StackedStatelessBean@183aedf
| 12:34:16,114 INFO [StackedStatelessBean] I'm done
| 12:34:16,114 INFO [StackedStatelessBean] pre destroy org.jboss.ejb3.test.wolfc.StackedStatelessBean@fadb88
| 12:34:16,116 INFO [StackedStatelessBean] pre destroy org.jboss.ejb3.test.wolfc.StackedStatelessBean@6258e1
| undeploy...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963138#3963138
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963138
19 years, 9 months
[Beginners Corner] - HELP: javax.naming.NameNotFoundException: comp not bound
by cnbs
Can't get java:comp namespace on JBoss 4.0.4
My application deploys without any exceptions, but its own namespace isn't created.
When i try to execute something like this :
ctx.lookup("java:comp/env/..");
i get this:
javax.naming.NameNotFoundException: comp not bound
What can i try to do with this?
This is my JNDIView list() output:
java: Namespace
|
| +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
| +- DefaultDS (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
| +- SecurityProxyFactory (class: org.jboss.security.SubjectSecurityProxyFactory)
| +- DefaultJMSProvider (class: org.jboss.jms.jndi.JNDIProviderAdapter)
| +- comp (class: javax.naming.Context)
| +- JmsXA (class: org.jboss.resource.adapter.jms.JmsConnectionFactoryImpl)
| +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
| +- jaas (class: javax.naming.Context)
| | +- other (class: org.jboss.security.plugins.SecurityDomainContext)
| | +- JmsXARealm (class: org.jboss.security.plugins.SecurityDomainContext)
| | +- jbossmq (class: org.jboss.security.plugins.SecurityDomainContext)
| | +- HsqlDbRealm (class: org.jboss.security.plugins.SecurityDomainContext)
| +- timedCacheFactory (class: javax.naming.Context)
| Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
| +- TransactionPropagationContextExporter (class: org.jboss.tm.TransactionPropagationContextFactory)
| +- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
| +- Mail (class: javax.mail.Session)
| +- comp.ejb3 (class: javax.naming.Context)
| | NonContext: null
| +- TransactionPropagationContextImporter (class: org.jboss.tm.TransactionPropagationContextImporter)
| +- TransactionManager (class: org.jboss.tm.TxManager)
|
|
| Global JNDI Namespace
|
| +- XAConnectionFactory (class: org.jboss.mq.SpyXAConnectionFactory)
| +- TopicConnectionFactory (class: org.jboss.naming.LinkRefPair)
| +- EventDispatcher (class: org.jboss.ws.eventing.mgmt.DispatcherDelegate)
| +- UserTransactionSessionFactory (proxy: $Proxy35 implements interface org.jboss.tm.usertx.interfaces.UserTransactionSessionFactory)
| +- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
| +- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
| +- QueueConnectionFactory (class: org.jboss.naming.LinkRefPair)
| +- topic (class: org.jnp.interfaces.NamingContext)
| | +- testDurableTopic (class: org.jboss.mq.SpyTopic)
| | +- testTopic (class: org.jboss.mq.SpyTopic)
| | +- securedTopic (class: org.jboss.mq.SpyTopic)
| +- queue (class: org.jnp.interfaces.NamingContext)
| | +- A (class: org.jboss.mq.SpyQueue)
| | +- testQueue (class: org.jboss.mq.SpyQueue)
| | +- ex (class: org.jboss.mq.SpyQueue)
| | +- DLQ (class: org.jboss.mq.SpyQueue)
| | +- D (class: org.jboss.mq.SpyQueue)
| | +- C (class: org.jboss.mq.SpyQueue)
| | +- B (class: org.jboss.mq.SpyQueue)
| +- myApp-ear (class: org.jnp.interfaces.NamingContext)
| | +- MyFirstBean (class: org.jnp.interfaces.NamingContext)
| | | +- remote (proxy: $Proxy78 implements interface MyFirstRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
| | +- MySecondBean (class: org.jnp.interfaces.NamingContext)
| | | +- remote (proxy: $Proxy67 implements interface MySecondRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
| +- ConnectionFactory (class: org.jboss.mq.SpyConnectionFactory)
| +- UserTransaction (class: org.jboss.tm.usertx.client.ClientUserTransaction)
| +- jmx (class: org.jnp.interfaces.NamingContext)
| | +- invoker (class: org.jnp.interfaces.NamingContext)
| | | +- RMIAdaptor (proxy: $Proxy34 implements interface org.jboss.jmx.adaptor.rmi.RMIAdaptor,interface org.jboss.jmx.adaptor.rmi.RMIAdaptorExt)
| | +- rmi (class: org.jnp.interfaces.NamingContext)
| | | +- RMIAdaptor[link -> jmx/invoker/RMIAdaptor] (class: javax.naming.LinkRef)
| +- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
| +- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963136#3963136
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963136
19 years, 9 months
[Persistence, JBoss/CMP, Hibernate, Database] - Re: EntityManager not working correctly
by andydale
Hi,
After spending the whole week trying to fix this problem, i am still no closer to the actual solution but i have discovered some more information. This problem is Postgres specific at the moment as i have tested the EntityManager.find() method call in the same context when using Hypersonic and MySQL and the entity is always found.
After studying the log file created by Postgres (without having the 2 second delay) it seems to not be able to commit the initiial insert statement generated from the EntityManager.persist() call before it tries to query it with the select statement, thus the .find() returns null. The thing that worries me about this problem is that some times it works with Postgres, and that it always works with the 2 other databases i tested with.
I have read up on the EntityManager and discovered that it is not thread safe, could this be causing the problem with Postgres, if so i know i need to use an EntityManagerFactory as this is a thread safe object, but how do i just create on factory that the whole of the application can use (be used in different beans, possible JNDI lookup ??), and even then i do not know if this would solve my problem. Is there anyway of making the EntityManager.persist() method wait until the database has actually commited before it returns ??? I have also tried to introduce flush() calls but they do not solve the problem.
Is this a possible bug in the EntityManager or Postgres JDBC code ???
I also have a very simple test application (.ear file) that just persists some bytes to a database and then tries to find them again in a seperate MDB, and then prints out if it cannot find the persisted object. If anybody wants it to test the problem with this application i will make it available to them.
If anyone can help, or offer advice it is appreciated.
Cheers,
Andy
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963135#3963135
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963135
19 years, 9 months