[Management, JMX/JBoss] - Re: how to get a user defined object invoked by mbeanserver
by momo_1204
how to get a user definition object invoked by mbeanserver in web service
I just can't cast the returned object to my defined object
the mbean implemetation:
public class ModelService extends ServiceMBeanSupport implements ModelServiceMBean {
| public ModelObj getModelObj(String id) {
| ModelObj obj = new ModelObj();
| some action here;
| returen obj;
| }
| }
ModelObj is a simple pojo I defined,there're only some getter and setter
the mbean definition:
<mbean code="jboss.mbean.model.ModelService" name="jboss.momo:service=ModelSvr"/>
the web service method code as follows:
public String getModelName(String id) {
| try {
| MBeanServer server = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
| Class clazz = server.getClassLoaderRepository().loadClass("jboss.mbean.model.ModelObj");
| ObjectName oname = new ObjectName("jboss.momo:service=ModelSvr");
| String[] sig = { String.class.getName() };
| Object[] opArgs = { new String("A01") };
| Object result = server.invoke(oname, "getModelObj", opArgs, sig);
| ModelObj mo = (ModelObj)clazz.cast(result);
| ///////some thing error,I wanna make the return object to cast to my defined object to invoke more operation,but just here comes some error "java.lang.ClassCastException: jboss.mbean.model.ModelObj"
| return mo.getName();
| } catch (Exception e) {
| e.printStackTrace();
| return null;
| }
| }
the web service definition:
<service name="ModelSvc" provider="java:RPC">
| <parameter name="allowedMethods" value="*"/>
| <parameter name="className" value="webservice.services.ModelParser"/>
| <beanMapping languageSpecificType="java:jboss.mbean.model.ModelObj" qname="ns7:ModelSvc" xmlns:ns7="ModelSvc"/>
| </service>
when in other client(command line run mode)
Object result = server.invoke(oname, "getModelObj", opArgs, sig);
can be write like this:
//MBeanServer server = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "10.1.0.2");
Context iniCtx = new InitialContext(env);
RMIAdaptor server = (RMIAdaptor) iniCtx.lookup("jmx/rmi/RMIAdaptor");
ModelObj result = (ModelObj)server.invoke(oname, "getModelObj", opArgs, sig);
this will not throws java.llang.ClassCastException
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964002#3964002
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964002
19 years, 9 months
[Beginners Corner] - Newbie report: Automatic JBoss shutdown issue
by Ez1
Hi all... Am a newbie with JBoss. Will be grateful for any help here...
The problem I have is: JBoss shuts down on its own after a password change process, following several failed attempts. It is uncertain if this is a JBoss problem; I suspect that the shutdown is triggered by something in the app I'm working with.
This is an error that arises erratically, hence I am unable to properly reproduce it. Here is a short snippet of the logs (due to the rest being specific to the app):
2006-04-25 09:40:40,852 INFO [STDOUT] j_username=XXXXXX@XXXXX&j_password=XXXXXXX
2006-04-25 09:40:40,977 ERROR [XXXXX.jsp.screenlet_jsp] Got new cookie: JSESSIONID=260203DE124BCF2488F8CE23B4AC40BB; Path=/;
JSESSIONIDSSO=B01A664E3B29BBC43F7E3D4ADE805368; Path=/
2006-04-25 09:40:40,977 ERROR [XXXXX.jsp.screenlet_jsp] setCookie=JSESSIONID=260203DE124BCF2488F8CE23B4AC40BB; Path=/;
JSESSIONIDSSO=B01A664E3B29BBC43F7E3D4ADE805368; Path=/
2006-04-25 10:42:24,969 INFO [org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.jdbc/XXXXX] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:service=LocalTxCM,name=jdbc/XXXXX to JNDI name 'java:/jdbc/XXXXX'
2006-04-25 10:42:24,969 INFO [org.jboss.management.j2ee.JCAResource] Registration is not done -> stop
2006-04-25 10:42:39,187 INFO [org.jboss.system.server.Server] JBoss SHUTDOWN: Undeploying all packages
2006-04-25 10:42:39,187 INFO [org.jboss.web.tomcat.tc5.TomcatDeployer] undeploy, ctxPath=/XXXXX, warUrl=file:/E:/XXXXX/jboss-3.2.6/server/XX/tmp/deploy/tmp50249EC-XXXXX.ear-contents/XXXXX.war/
2006-04-25 10:42:39,187 DEBUG [tomcat.localhost./com.ec.prod.wr.screens.Context] Stopping
2006-04-25 10:42:39,187 DEBUG [tomcat.localhost./com.ec.prod.wr.screens.Context] Stopping filters
2006-04-25 10:42:39,187 DEBUG [tomcat.localhost./com.ec.prod.wr.screens.Context] Stopping filter 'CommonHeadersFilter'
2006-04-25 10:42:39,187 DEBUG [tomcat.localhost./com.ec.prod.wr.screens.Context] Processing standard container shutdown
2006-04-25 10:42:39,187 DEBUG [tomcat.localhost./com.ec.prod.wr.screens.Context] Sending application stop events
2006-04-25 10:42:39,187 DEBUG [tomcat.localhost./com.ec.prod.wr.screens.Context] resetContext jboss.web:j2eeType=WebModule,name=//localhost/XXXXX,J2EEApplication=none,J2EEServer=none org.jboss.mx.server.MBeanServerImpl@152c4d9
2006-04-25 10:42:39,187 DEBUG [tomcat.localhost./com.ec.prod.wr.screens.Context] Stopping complete
Some system details:
- ECJboss cp : C:\j2sdk1.4.2_05\lib\tools.jar;run.jar
- JavaVM home : C:\j2sdk1.4.2_05
- JavaVM type : server
- JavaVM DLL : C:\j2sdk1.4.2_05\jre\bin\server\jvm.dll
- Jboss home : jboss-3.2.6
Configuration changes: None of significance
So far I have not been able to find anything in existing forum threads that are directly relevant.
I want to be able to debug the problem on the application end. What I need here is any possible means where JBoss can automatically shutdown.
Will appreciate any input. Many thanks!!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963999#3963999
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963999
19 years, 9 months
[Management, JMX/JBoss] - how to get a user defined object invoked by mbeanserver in w
by momo_1204
the mbean implemetation:
public class ModelService extends ServiceMBeanSupport implements ModelServiceMBean {
public ModelObj getModelObj(String id) {
ModelObj obj = new ModelObj();
some action here;
returen obj;
}
}
ModelObj is a simple pojo I defined,there're only some getter and setter
the mbean definition:
the web service method code as follows:
public String getModelName(String id) {
try {
MBeanServer server = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
Class clazz = server.getClassLoaderRepository().loadClass("jboss.mbean.model.ModelObj");
ObjectName oname = new ObjectName("jboss.momo:service=ModelSvr");
String[] sig = { String.class.getName() };
Object[] opArgs = { new String("A01") };
Object result = server.invoke(oname, "getModelObj", opArgs, sig);
ModelObj mo = (ModelObj)clazz.cast(result);//some thing error,I wanna make the return object to cast to my defined object to invoke more operation,but just here comes some error "java.lang.ClassCastException: jboss.mbean.model.ModelObj"
return mo.getName();
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
the web service definition:
<beanMapping languageSpecificType="java:jboss.mbean.model.ModelObj" qname="ns7:ModelSvc" xmlns:ns7="ModelSvc"/>
when in other client(command line run mode)
Object result = server.invoke(oname, "getModelObj", opArgs, sig);
can be write like this:
//MBeanServer server = org.jboss.mx.util.MBeanServerLocator.locateJBoss();
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
env.put(Context.PROVIDER_URL, "10.1.0.2");
Context iniCtx = new InitialContext(env);
RMIAdaptor server = (RMIAdaptor) iniCtx.lookup("jmx/rmi/RMIAdaptor");
ModelObj result = (ModelObj)server.invoke(oname, "getModelObj", opArgs, sig);
this will not throws java.llang.ClassCastException
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963997#3963997
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963997
19 years, 9 months
[JBoss Seam] - Re: Partial load of data for DataTable
by gvl
Thank you for your reply,
My goal here is to avoid loading a large batch of data all at once and do a lazy load as you say.
So I tried to attach an action listener on the scroller and catch when a user hits the forward button. However I got the following NullPointerException:
| java.lang.NullPointerException
| at org.jboss.ejb3.entity.ExtendedEntityManager.getPersistenceContext(ExtendedEntityManager.java:59)
| at org.jboss.ejb3.entity.ExtendedEntityManager.createNamedQuery(ExtendedEntityManager.java:134)
| at gr.aegek.invent.business.BrowseBean.loadEntities(BrowseBean.java:278)
| at gr.aegek.invent.business.BrowseBean.loadAll(BrowseBean.java:243)
| at gr.aegek.invent.business.material.BrowseMaterialsBean.load(BrowseMaterialsBean.java:129)
| at gr.aegek.invent.business.ScrollerActionListener.processAction(ScrollerActionListener.java:43)
| at javax.faces.event.ActionEvent.processListener(ActionEvent.java:48)
| at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:484)
| at org.apache.myfaces.custom.datascroller.HtmlDataScroller.broadcast(HtmlDataScroller.java:104)
| at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
| at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
| at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
| at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
I am using an extended entity manager:
| @PersistenceContext (type=PersistenceContextType.EXTENDED)
| protected EntityManager manager;
|
I am not quite sure what is wrong then here!
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3963996#3963996
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3963996
19 years, 9 months