[JBoss Seam] - Is it to late to get this CRITICAL feature in before the off
by dhinojosa
I really really need this feature in. I would like to specify actions with parameters in the page element of pages.xml. Please take a look at my code snippet below, where I have commented "Man o' man, I would love to do this". Currently you can specify actions per page to run before the page becomes available, but you cannot specify any parameters, and I would really like to set those.
BTW, this would have nothing to do with a RESTful page, this just to have certain state in my beans before rendering the page.
| <page view-id="/quote/fencequote.xhtml">
| <action execute="#{searchAllAvailableFencesBean.search}" >
| <param name="type" value="fence"/> <!--Man o' man, I would love to do this!-->
| <param name="subtype" value="standard"/> <!--Man o' man, I would love to do this!-->
| </action>
| <action execute="#{searchAllColorsBean.search}"/>
| <begin-conversation join="true"/>
| <navigation from-action="#{fenceQuoteManagerBean.save}">
| <redirect view-id="/quote/fencequotethanks.xhtml"/>
| <end-conversation/>
| </navigation>
| </page>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088562#4088562
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088562
18 years, 7 months
[JBoss Seam] - Could not instantiate Seam component :/
by Yacho
OK so heres another problem i stumbled upon :
i Have statefull Session bean that defines my component
i get the following error when executing #{userManager(newUser)} :
anonymous wrote : 21:46:24,625 WARN [lifecycle] Could not instantiate Seam component: userManager
| org.jboss.seam.InstantiationException: Could not instantiate Seam component: userManager
| at org.jboss.seam.Component.newInstance(Component.java:1853)
even trough it deploys ok and its loaded :
anonymous wrote : 21:44:43,625 INFO [Component] Component: userManager, scope: EVENT, type: STATEFUL_SESSION_BEAN, class: sessionbeans.UserManagerBean, JNDI: \UserManagerBean/local
My Session Bean looks like this :
@Stateful
| @Name("userManager")
| @Scope(EVENT)
|
| public class UserManagerBean implements UserManager, Serializable {
|
| @PersistenceContext
| EntityManager em;
|
| @In
| public String register(User newUser) {
| User existing = (User) em.createQuery("from User where username={#newUser.username} and passwd={#newUser.passwd}").getSingleResult();
|
| if (existing != null) {
| em.persist(newUser);
|
| return "registered";
| } else {
| return null;
| }
|
| }
| @Remove
| public void destroy() {}
It Seems to be ok - so wheres the fuss ?
is the JNDI path correct ? because im a bit confused about the slashes :/
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088559#4088559
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088559
18 years, 7 months
[EJB 3.0] - EntityManager must be access within a transaction -- Please
by Sukar1205
I am testing a session bean by a client.
and I keep getting this error, I know my code should work because
I wrote the same code last week.
this is the error
| xception in thread "main" javax.ejb.EJBTransactionRolledbackException: EntityManager must be access within a transaction
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
| at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
| at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.dynamicInvoke(StatelessContainer.java:278)
| at org.jboss.aop.Dispatcher.invoke(Dispatcher.java:106)
| at org.jboss.aspects.remoting.AOPRemotingInvocationHandler.invoke(AOPRemotingInvocationHandler.java:82)
| at org.jboss.remoting.ServerInvoker.invoke(ServerInvoker.java:734)
| at org.jboss.remoting.transport.socket.ServerThread.processInvocation(ServerThread.java:560)
| at org.jboss.remoting.transport.socket.ServerThread.dorun(ServerThread.java:369)
| at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:165)
| Caused by: javax.persistence.TransactionRequiredException: EntityManager must be access within a transaction
| at org.jboss.ejb3.entity.ManagedEntityManagerFactory.verifyInTx(ManagedEntityManagerFactory.java:150)
|
This is my main ... all i want to do is add an object in an table
|
| public class KBClient {
|
| public static void main(String[] args) {
|
| KBClient c = new KBClient();
| ClassificationRemote r = c.lookupNewClassificationBean();
| KnowledgeBase first = new KnowledgeBase();
| first.setKnowledgeID(200);
| first.setKnowledgeName("AmerDemo");
| first.setKnowledgeCategory("Classification");
| first.setProjectID(new Project(88));
| first.setDeleted(0);
| r.addKnowledgeBase(first); //Exception occurs
| }
|
| private ClassificationRemote lookupNewClassificationBean() {
| try {
| Hashtable props = new Hashtable();
| props.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
| props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
| props.put("java.naming.provider.url", "localhost");
| Context c = new InitialContext(props);
| return (ClassificationRemote) c.lookup("ClassificationBeanFinal/remote");
| }
| catch(NamingException ne) {
| Logger.getLogger(getClass().getName()).log(Level.SEVERE,"exception caught" ,ne);
| throw new RuntimeException(ne);
| }
| }
| }
|
|
and This is the function in the session bean
|
| @PersistenceContext private EntityManager em;
|
| public void addKnowledgeBase(KnowledgeBase kb){
| System.out.println("YAAAHOOOOOOO");
| em.persist(kb);
| }
|
I checked the JNDI tree as well ... everything is fine
the exception occurs when adding to the table in main.
Please help me !!!
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088558#4088558
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088558
18 years, 7 months