[Beginners Corner] - Re: MDB InstanceNotFoundException +MBean
by shankha
I update my jboss.xml by adding local-jndi-name TestMessageEJB.
<jboss>
| <enterprise-beans>
| <session>
| <ejb-name>MBeanTestEJB</ejb-name>
| <jndi-name>MBeanTestEJB</jndi-name>
| </session>
| <message-driven>
| <ejb-name>MessageEJB</ejb-name>
| <destination-jndi-name>queue/testQueue</destination-jndi-name>
| <local-jndi-name>TestMessageEJB</local-jndi-name>
| </message-driven>
| </enterprise-beans>
| </jboss>
In the Java code I update it following way
try{
|
| Object name = jndiCtx.lookup("TestMessageEJB");
|
| //ObjectName name = new ObjectName("jboss.j2ee:service=EJB,plugin=invoker,binding=message-driven-bean,jndiName=local/MessageEJB");
| ObjectName objName = new ObjectName((String)name);
| MBeanInfo objMBeanInfo = mbeanServer.getMBeanInfo(objName);
| System.out.println("@@ -- MBeanTestBean :invokeMBeanFeatures : "+objMBeanInfo.getClassName());
|
| }catch(Exception ex){
|
| ex.printStackTrace();
| }
I got the javax.naming.NameNotFoundException: TestMessageEJB not bound.
Can any body please help me ?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079554#4079554
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079554
17Â years, 2Â months
[JBoss Seam] - Bug or not?
by LockDog
Class
@Name("userHome")
/**
* User entity home class
* Contains user management functions
*/
public class UserHome extends EntityHome {
...
@Restrict("#{s:hasRole('Librarian')}")
public void addUser() {
getInstance().setRole(Role.USER);
persist();
}
Form:
<h:form id="userAddForm">
<rich:panel style="background-color:#faf9cc;">
<f:facet name="header">UserAdd</f:facet>
<s:decorate id="userEmailDecoration" template="/layout/edit.xhtml">
<ui:define name="label">E-mail</ui:define>
<h:inputText id="email" value="#{userHome.instance.email}"/>
</s:decorate>
<s:decorate id="firstNameDecoration" template="/layout/edit.xhtml">
<ui:define name="label">First Name</ui:define>
<h:inputText id="firstname" value="#{userHome.instance.firstName}"/>
</s:decorate>
<s:decorate id="emailDecoration" template="/layout/edit.xhtml">
<ui:define name="label">Last Name</ui:define>
<h:inputText id="lastName" value="#{userHome.instance.lastName}"/>
</s:decorate>
<s:decorate id="passwordDecoration" template="/layout/edit.xhtml">
<ui:define name="label">Password</ui:define>
<h:inputText id="Password" value="#{userHome.instance.password}"/>
</s:decorate>
<h:commandButton id="addUser"
value="Add User"
action="#{userHome.addUser}"/>
</rich:panel>
</h:form>
Test:
public class UserHomeTest extends SeamTest {
@Test
public void addUserTest() throws Exception {
//login
new FacesRequest() {
@Override
protected void updateModelValues() {
assertFalse("Is user logged in", (Boolean) getValue("#{identity.loggedIn}"));
// Some data(from import-test.sql)
//login
setValue("#{identity.username}", "lock_dog2000(a)mail.ru");
setValue("#{identity.password}", "Eugene");
}
@Override
protected void invokeApplication() {
invokeMethod("#{identity.login}");
}
}.run();
// Testing add user method
new FacesRequest() {
@Override
protected void updateModelValues() {
//fill new user
setValue("#{userHome.instance.firstName}", "Lida");
setValue("#{userHome.instance.lastName}", "Jarikova");
setValue("#{userHome.instance.email}", "iamstupid(a)girl.ua");
setValue("#{userHome.instance.password}", "passme");
}
@Override
protected void invokeApplication() {
invokeMethod("#{userHome.addUser}");
}
@Override
protected void renderResponse() {
UserList userList = (UserList) getInstance("userList");
assertNotNull(userList);
assertEquals(4, (long) userList.getResultCount());
}
}.run();
Error:
javax.el.ELException: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call
at com.sun.el.parser.AstValue.invoke(AstValue.java:178)
at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:286)
at org.jboss.seam.util.UnifiedELMethodBinding.invoke(UnifiedELMethodBinding.java:36)
at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
at org.jboss.seam.actionparam.ActionParamBindingHelper.invokeTheExpression(ActionParamBindingHelper.java:58)
at org.jboss.seam.actionparam.ActionParamMethodBinding.invoke(ActionParamMethodBinding.java:75)
at org.jboss.seam.mock.SeamTest$Request.invokeMethod(SeamTest.java:401)
at org.teamdev.librarian.UserHomeTest$1.invokeApplication(UserHomeTest.java:35)
at org.jboss.seam.mock.SeamTest$Request.run(SeamTest.java:489)
at org.teamdev.librarian.UserHomeTest.addUserTest(UserHomeTest.java:17)
Caused by: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call
at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:429)
at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:402)
at org.jboss.seam.persistence.EntityManagerProxy.joinTransaction(EntityManagerProxy.java:113)
at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:47)
at org.teamdev.librarian.user.UserHome.addUser(UserHome.java:42)
at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:37)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:63)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.interceptors.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:37)
at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
at org.teamdev.librarian.user.UserHome_$$_javassist_1.addUser(UserHome_$$_javassist_1.java)
at com.sun.el.parser.AstValue.invoke(AstValue.java:174)
... 32 more
... Removed 30 stack frames
-----
It is all right, when you adding user by the form.
But test fall.
Help!!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079552#4079552
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079552
17Â years, 2Â months
[Beginners Corner] - MDB InstanceNotFoundException +MBean
by shankha
Hi,
I deploy a simple MDB (MessageEJB) in JBOSS.
In the jboss.j2ee in the JMX console MBean responsible for operating the MessageEJB is JMSContainerInvoker.
MBean Name: Domain Name: jboss.j2ee
service: EJB
plugin: invoker
binding: message-driven-bean
jndiName: local/MessageEJB@14023097
MBean Java Class: org.jboss.ejb.plugins.jms.JMSContainerInvoker
Binding name is
binding=message-driven-bean,jndiName=local/MessageEJB@14023097,plugin=invoker,service=EJB
In the code I have to look up the Object Name in the below mentioned way
| MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");
|
| ObjectName name = new ObjectName("jboss.j2ee:service=EJB,plugin=invoker,binding=message-driven-bean,jndiName=local/MessageEJB@32008150");
|
| Object val = mconn.getAttribute(name, "Name");
| ObjectInstance objInst = mconn.getObjectInstance(name);
|
| System.out.println(name + "\n\tObject Instance Class Name =" + objInst.getClassName());
But for each and every time when I restart /deploy the JBOSS @32008150 is getting changed.
And I am getting
javax.management.InstanceNotFoundException: jboss.j2ee:service=EJB,plugin=invoker,binding=message-driven-bean,jndiName=local/MessageEJB@14023097 is not registered.
How can I solve this problem?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079538#4079538
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079538
17Â years, 2Â months