[Beginners Corner] - java.lang.ClassCastException -
by shankha
Hi,
I want to get the reference of the MBeanServer of my running JBOSS from my standalone program.
And on the MBeanServer instance I want to invoke getVersionName() of the MBean Server.
But after getting the Server Object Instance Class I can not type case to the org.jboss.system.server.ServerImpl.
Code is given below : Can My Approach is OK ??
anonymous wrote : Hashtable env = new Hashtable();
| String factory = "org.jnp.interfaces.NamingContextFactory";
| env.put(Context.INITIAL_CONTEXT_FACTORY, factory);
| String url1 = "jnp://localhost:1099";
| env.put(Context.PROVIDER_URL, url1);
| Context ctx = new InitialContext(env);
|
|
| MBeanServerConnection mconn = (MBeanServerConnection)ctx.lookup("jmx/invoker/RMIAdaptor");
| if(null!=mconn){
|
| ObjectName serverObj = new ObjectName("jboss.system:type=Server");
| System.out.println("Version = " + (String)mconn.getAttribute(serverObj, new String("Version")));
| ObjectInstance serverObjInst = mconn.getObjectInstance(serverObj);
| System.out.println(serverObj + "\n\t Server Object Instance Class Name =" + serverObjInst.getClassName());
|
|
| if(mconn.isInstanceOf(serverObj,"org.jboss.system.server.ServerImpl")){
|
| System.out.println("-----------------------------");
|
| org.jboss.system.server.ServerImpl serverImpl = (org.jboss.system.server.ServerImpl)mconn;
|
| System.out.println("@@ --- MBean Server Version name = "+serverImpl.getVersionName());
| }
--------------------------------------------------------------------------------
I got the following exception
java.lang.ClassCastException: $Proxy0
at com.test.client.MDBLocater.test(MDBLocater.java:56)
at com.test.client.MDBLocater.main(MDBLocater.java:130)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:86)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079486#4079486
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079486
18Â years, 7Â months
[JBossCache] - Cache loading in a clustered environment
by spennec
Hello,
I'm in front of a very strange situation here:
There are two members in my cluster. Each instanciates a treecache object, with the same properties. (Mode INVALIDATION_ASYNC, Optimistic locking, TreeCache V1.4.1SP4).
When they start, each of them loads the initial state of the cache from a database. Since the cached data is several huge lists (130K+ objects), the replication is turned off, because it created OutOfMem exceptions.
The problem is that when instance A of the cluster retrieves the data and caches it, the corresponding node in instance B is evicted. Then, when B evaluates the data and caches it, the node in instance A is evicted.
I've been able to prevent that behaviour in doing some trick that I suppose is not "best practice": I start the cache, get its configured cache mode, stop it, set cache mode to LOCAL, get the data and fill the cache, stop it again, set its mode to the previous value and start it again.
As surprising as it may seen, the data is still here, even after the stop/start and change of cache mode.
I guess that this situation has been seen over and over again, but I couldn't find anything that could help me.
Any advice would be highly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079485#4079485
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079485
18Â years, 7Â months
[JBossWS] - Problem with publishing a web service
by AnisBM
Hi all,
I have this message when I try to publish a class as a web service :
Running JBossWS wstools for [jbossws-test1]
directory: C:\FitNetManager\workspaces\workspaceFitNet\jbossws-test1
command: cmd.exe /C C:\FitNetManager\Jboss-4.0.5.GA\bin\wstools.bat -cp bin -config C:\DOCUME~1\Anis\LOCALS~1\Temp\wstools-config55960.xml -dest C:\FitNetManager\workspaces\workspaceFitNet\jbossws-test1\src\java
========================================================================="
.
WSTools Environment
.
JBOSS_HOME: C:\FitNetManager\Jboss-4.0.5.GA\bin\\..
.
JAVA: C:\Program Files\Java\jdk1.5.0_05\bin\java
.
JAVA_OPTS:
.
========================================================================="
.
Exception in thread "main" java.lang.NoClassDefFoundError: javax/jws/soap/SOAPBinding$ParameterStyle
at org.jboss.ws.tools.helpers.ToolsHelper.handleJavaToWSDLGeneration(ToolsHelper.java:106)
at org.jboss.ws.tools.WSTools.process(WSTools.java:133)
at org.jboss.ws.tools.WSTools.generate(WSTools.java:69)
at org.jboss.ws.tools.WSTools.generate(WSTools.java:119)
at org.jboss.ws.tools.WSTools.main(WSTools.java:58)
I don't understand what is the matter. I'm working on Eclipse 3.2 with JBoss 4.0.5GA, JBossWS 1.2.0SP1, jdk 1.5.
Could someone help me ???
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079482#4079482
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079482
18Â years, 7Â months
[JBoss Seam] - Re: Running the booking example on JBoss with the JSF 1.2 RI
by chuaky
hi,
Appreciate very much advice from the community on this issue that i encountered.
I was try to get an example portal working in this environment:
- JBoss portal 2.6.1 (with AS 4.2.1)
- Seam 1.2.1GA
- use JSF RI 1.2
I combine the sample code from ajax trunk (ajaxPortlet), and got the following error dump. I couldn't understand the error, please advise.
Error:
====
| 2007-08-30 16:26:17,036 DEBUG [org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter] Filter start request processing at 8/30/07 4:26 PM for uri: /seam-arich/start.seam
| 2007-08-30 16:26:17,036 DEBUG [org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter] Incoming request has Content-Type header with character encoding UTF-8
| 2007-08-30 16:26:17,036 DEBUG [org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter] Filter request output to XML
| 2007-08-30 16:26:17,036 DEBUG [org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter] XML filter service start processing request
| 2007-08-30 16:26:17,036 DEBUG [org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter] Filter start request processing at 8/30/07 4:26 PM for uri: /seam-arich/start.seam
| 2007-08-30 16:26:17,036 DEBUG [org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter] Not is faces request, Filter perform not-xml parsing chain
| 2007-08-30 16:26:17,036 ERROR [org.jboss.seam.web.ExceptionFilter] uncaught exception
| java.lang.UnsupportedOperationException
| at javax.faces.context.ExternalContext.setRequestCharacterEncoding(ExternalContext.java:397)
| at javax.faces.application.ViewHandler.initView(ViewHandler.java:259)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:208)
| at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:293)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:79)
| at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
| at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:127)
| at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:277)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| at java.lang.Thread.run(Thread.java:595)
|
web.xml
======
| <?xml version="1.0"?>
| <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| ~ JBoss, a division of Red Hat ~
| ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
| ~ contributors as indicated by the @authors tag. See the ~
| ~ copyright.txt in the distribution for a full listing of ~
| ~ individual contributors. ~
| ~ ~
| ~ This is free software; you can redistribute it and/or modify it ~
| ~ under the terms of the GNU Lesser General Public License as ~
| ~ published by the Free Software Foundation; either version 2.1 of ~
| ~ the License, or (at your option) any later version. ~
| ~ ~
| ~ This software is distributed in the hope that it will be useful, ~
| ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
| ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
| ~ Lesser General Public License for more details. ~
| ~ ~
| ~ You should have received a copy of the GNU Lesser General Public ~
| ~ License along with this software; if not, write to the Free ~
| ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
| ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org. ~
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
| <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
| <context-param>
| <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
| <param-value>false</param-value>
| </context-param>
| <context-param>
| <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
| <param-value>false</param-value>
| </context-param>
| <context-param>
| <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
| <param-value>false</param-value>
| </context-param>
| <context-param>
| <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <param-name>facelets.DEVELOPMENT</param-name>
| <param-value>false</param-value>
| </context-param>
| <context-param>
| <param-name>facelets.SKIP_COMMENTS</param-name>
| <param-value>true</param-value>
| </context-param>
| <context-param>
| <param-name>facelets.VIEW_MAPPINGS</param-name>
| <param-value>*.xhtml</param-value>
| </context-param>
| <context-param>
| <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
| <param-value>org.ajax4jsf.portlet.application.FaceletPortletViewHandler</param-value>
| </context-param>
| <!--
| <context-param>
| <param-name>facelets.LIBRARIES</param-name>
| <param-value>/WEB-INF/portal.taglib.xml</param-value>
| </context-param>
| -->
| <context-param>
| <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
| <param-value>.xhtml</param-value>
| </context-param>
| <context-param>
| <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
| <param-value>server</param-value>
| </context-param>
| <filter>
| <display-name>Ajax4jsf Filter</display-name>
| <filter-name>ajax4jsf</filter-name>
| <filter-class>org.ajax4jsf.Filter</filter-class>
| </filter>
| <filter-mapping>
| <filter-name>ajax4jsf</filter-name>
| <servlet-name>FacesServlet</servlet-name>
| <dispatcher>FORWARD</dispatcher>
| <dispatcher>REQUEST</dispatcher>
| <dispatcher>INCLUDE</dispatcher>
| </filter-mapping>
|
| <filter-mapping>
| <filter-name>ajax4jsf</filter-name>
| <url-pattern>*.seam</url-pattern>
| </filter-mapping>
|
| <!--
| <listener>
| <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
| </listener>
| -->
|
| <!-- JSF RI -->
| <listener>
| <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
| </listener>
|
|
| <servlet>
| <servlet-name>FacesServlet</servlet-name>
| <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
| <load-on-startup>1</load-on-startup>
| </servlet>
| <servlet-mapping>
| <servlet-name>FacesServlet</servlet-name>
| <url-pattern>/faces/*</url-pattern>
| </servlet-mapping>
|
| <!--
| <mime-mapping>
| <extension>svg</extension>
| <mime-type>image/svg+xml</mime-type>
| </mime-mapping>
| <login-config>
| <auth-method>BASIC</auth-method>
| </login-config>
| -->
|
| <!-- Seam -->
|
| <listener>
| <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
| </listener>
|
| <!-- Propagate conversations across redirects -->
| <!--
| <filter>
| <filter-name>Seam Redirect Filter</filter-name>
| <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
| </filter>
|
| <filter-mapping>
| <filter-name>Seam Redirect Filter</filter-name>
| <url-pattern>*.seam</url-pattern>
| </filter-mapping>
| -->
| <servlet>
| <servlet-name>Seam Resource Servlet</servlet-name>
| <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
| </servlet>
|
| <servlet-mapping>
| <servlet-name>Seam Resource Servlet</servlet-name>
| <url-pattern>/seam/resource/*</url-pattern>
| </servlet-mapping>
|
| <filter>
| <filter-name>Seam Filter</filter-name>
| <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
| </filter>
|
| <filter-mapping>
| <filter-name>Seam Filter</filter-name>
| <url-pattern>/*</url-pattern>
| </filter-mapping>
|
|
|
| <!-- Faces Servlet Mapping -->
| <servlet-mapping>
| <servlet-name>FacesServlet</servlet-name>
| <url-pattern>*.seam</url-pattern>
| </servlet-mapping>
|
| <servlet-mapping>
| <servlet-name>FacesServlet</servlet-name>
| <url-pattern>*.jsf</url-pattern>
| </servlet-mapping>
|
|
| </web-app>
|
faces-config.xml
===========
| <?xml version="1.0"?>
| <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
| "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
| <faces-config>
| <managed-bean>
| <managed-bean-name>bean</managed-bean-name>
| <managed-bean-class>portal.Bean</managed-bean-class>
| <managed-bean-scope>session</managed-bean-scope>
| </managed-bean>
| <navigation-rule>
| <from-view-id>/start.xhtml</from-view-id>
| <navigation-case>
| <from-outcome>repeater</from-outcome>
| <to-view-id>/repeater.xhtml</to-view-id>
| </navigation-case>
| </navigation-rule>
| <navigation-rule>
| <from-view-id>/repeater.xhtml</from-view-id>
| <navigation-case>
| <from-outcome>start</from-outcome>
| <to-view-id>/start.xhtml</to-view-id>
| </navigation-case>
| </navigation-rule>
| <render-kit>
| <renderer>
| <description>override the viewroot</description>
| <component-family>javax.faces.ViewRoot</component-family>
| <renderer-type>javax.faces.ViewRoot</renderer-type>
| <renderer-class>org.ajax4jsf.portlet.renderkit.portlet.PortletAjaxViewRootRenderer</renderer-class>
| </renderer>
| </render-kit>
| <application>
| <view-handler>org.ajax4jsf.portlet.application.PortletViewHandler</view-handler>
| <state-manager>org.ajax4jsf.portlet.application.PortalStateManager</state-manager>
| <!--
| <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler>
| -->
| </application>
|
| <application>
| <el-resolver>org.jboss.seam.jsf.SeamELResolver</el-resolver>
| </application>
| <!--
| <lifecycle>
| <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
| </lifecycle>
| -->
| <lifecycle>
| <phase-listener>org.jboss.seam.jsf.TransactionalSeamPortletPhaseListener</phase-listener>
| </lifecycle>
|
|
| </faces-config>
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4079477#4079477
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4079477
18Â years, 7Â months