[JBoss Portal] - ClassCastException when extending JBossPortlet
by mat.lowery
Environment:
JBoss Portal/AS Version: Downloaded JBoss Portal + JBoss AS 2.4
OS Platform: Windows XP
Java: 1.4.2_12
Problem:
Extending JBossPortlet (using CatalogPortlet as a guide) yields a ClassCastException when render is called.
PortletContainer.invokeRender() is calling JBossPortlet.render(RenderRequest, RenderResponse) with arguments of type RenderRequestImpl and RenderResponseImpl. JBossPortlet then attempts to cast those arguments to JBossRenderRequest and JBossRenderResponse which results in the exception.
I'm sure I'm doing something stupid. Can anyone enlighten me?
Note that my code (a subclass of JBossPortlet) never gets called.
Stack Trace:
| java.lang.ClassCastException
| at org.jboss.portlet.JBossPortlet.render(JBossPortlet.java:384)
| at org.jboss.portal.portlet.container.PortletContainer.invokeRender(PortletContainer.java:519)
| ...
|
portlet.xml:
| <portlet>
| <portlet-name>PentahoMenuPortlet</portlet-name>
| <portlet-class>
| org.pentaho.ui.portlet.PentahoMenuPortlet
| </portlet-class>
| <supports>
| <mime-type>text/html</mime-type>
| <portlet-mode>VIEW</portlet-mode>
| </supports>
| <portlet-info>
| <title>PentahoMenuPortlet</title>
| </portlet-info>
| </portlet>
|
portlet-instances.xml:
| <deployment>
| <instance>
| <instance-id>PentahoMenuInstance</instance-id>
| <portlet-ref>PentahoMenuPortlet</portlet-ref>
| </instance>
| </deployment>
|
default-object.xml:
| <deployments>
| <deployment>
| <parent-ref>default</parent-ref>
| <if-exists>overwrite</if-exists>
| <page>
| <page-name>Pentaho</page-name>
| <window>
| <window-name>NavigationPortletWindow</window-name>
| <instance-ref>NavigationPortletInstance</instance-ref>
| <region>navigation</region>
| <height>0</height>
| <properties>
| <property>
| <name>theme.windowRendererId</name>
| <value>emptyRenderer</value>
| </property>
| <property>
| <name>theme.decorationRendererId</name>
| <value>emptyRenderer</value>
| </property>
| <property>
| <name>theme.portletRendererId</name>
| <value>emptyRenderer</value>
| </property>
| </properties>
| </window>
| <window>
| <window-name>PentahoNewsWindow</window-name>
| <instance-ref>PentahoNewsInstance</instance-ref>
| <region>center</region>
| <height>0</height>
| </window>
| <window>
| <window-name>PentahoMenuWindow</window-name>
| <instance-ref>PentahoMenuInstance</instance-ref>
| <region>left</region>
| <height>0</height>
| </window>
| ...
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994353#3994353
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994353
19 years, 4 months
[JBoss Seam] - Seam debug page with ICEfaces
by MarkCollette
Hi, I work at ICEsoft, on both Facelets and Seam integration. I ran into an issue with the Seam debug screen, as it works with ICEfaces. Basically, none of the stock JSF components were rendering properly, because org.jboss.seam.debug.jsf.SeamDebugPhaseListener diretly uses Facelets, without using the ViewHandler mechanisms, which ICEfaces relies upon.
I think that the easiest approach will be to make a Seam com.sun.facelets.impl.ResourceResolver that knows how to get at the debug.xhtml file, and just use the existing facelets.RESOURCE_RESOLVER parameter to access it. No phase listener would be necessary, and the existing ViewHandler mechanisms would operate as usual to show the debug screen.
Some sort of chaining of ResourceResolvers should be done, so that apps with an existing ResourceResolver will work. My preference would be for Facelets core to alter its use of the facelets.RESOURCE_RESOLVER parameter, to treat it as an ordered list of ResourceResolvers, much like how the facelets.LIBRARIES and facelets.DECORATORS parameters work.
In the immediate term, to simplify my proof of concept code, I will add a second parameter called seam.RESOURCE_RESOLVER which org.jboss.seam.debug.jsf.SeamDebugResourceResolver will delegate to.
So, to recap, here are some configuration examples:
Current way, with a custom ResourceResolver:
web.xml
<context-param>
| <param-name>facelets.RESOURCE_RESOLVER</param-name>
| <param-value>com.mycompany.CustomResourceResolver</param-value>
| </context-param>
|
Short-term solution, with Seam debug ResourceResolver, and no other custom ResourceResolver:
web.xml
<context-param>
| <param-name>facelets.RESOURCE_RESOLVER</param-name>
| <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value>
| </context-param>
|
Short-term solution, with Seam debug ResourceResolver, and a custom
ResourceResolver:
web.xml
<context-param>
| <param-name>facelets.RESOURCE_RESOLVER</param-name>
| <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value>
| </context-param>
| <context-param>
| <param-name>seam.RESOURCE_RESOLVER</param-name>
| <param-value>com.mycompany.CustomResourceResolver</param-value>
| </context-param>
|
Potential long-term solution, with Seam debug ResourceResolver, and a custom ResourceResolver, chained:
web.xml
<context-param>
| <param-name>facelets.RESOURCE_RESOLVER</param-name>
|
| <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver;com.mycompany.CustomResourceResolver</param-value>
| </context-param>
|
To try out the proof-of-concept method (short-term), do the following:
1. Disable the SeamDebugPhaseListener by commenting out the lifecycle
phase-listener block in src\debug\META-INF\faces-config.xml
2. Copy and paste the following Java source code, and save it to src\debug\org\jboss\seam\debug\jsf\SeamDebugResourceResolver.java
3. Tell the web app about SeamDebugResourceResolver. I added the following
block to both examples\dvdstore\resources\WEB-INF\web.xml and examples\hibernate\resources\WEB-INF\web.xml
<context-param>
| <param-name>facelets.RESOURCE_RESOLVER</param-name>
| <param-value>org.jboss.seam.debug.jsf.SeamDebugResourceResolver</param-value>
| </context-param>
|
4. Rebuild Seam so that the change to the phase-listener will take effect.
5. Build and deploy the web apps
##############################
SeamDebugResourceResolver.java
##############################
package org.jboss.seam.debug.jsf;
|
| import java.io.IOException;
| import java.net.URL;
|
| import javax.faces.context.FacesContext;
| import org.jboss.seam.core.Init;
|
| import com.sun.facelets.impl.ResourceResolver;
| import com.sun.facelets.impl.DefaultResourceResolver;
|
| /**
| * Intercepts any request for a path like /debug.xxx and renders
| * the Seam debug page using facelets.
| *
| * @author Mark Collette
| */
| public class SeamDebugResourceResolver implements ResourceResolver
| {
| private final static String PARAM_RESOURCE_RESOLVER = "seam.RESOURCE_RESOLVER";
|
| private ResourceResolver delegate;
|
| public SeamDebugResourceResolver()
| {
| delegate = buildDelegateResourceResolver();
| }
|
| public URL resolveUrl(String path)
| {
| System.out.println("SeamDebugResourceResolver.resolveUrl() path: " + path);
| if ( path!=null && path.startsWith("/debug.") && Init.instance().isDebug() )
| {
| URL url = SeamDebugResourceResolver.class.getClassLoader().getResource("META-INF/debug.xhtml");
| System.out.println("SeamDebugResourceResolver.resolveUrl() url: " + url);
| return url;
| }
| return delegate.resolveUrl(path);
| }
|
| private ResourceResolver buildDelegateResourceResolver()
| {
| FacesContext ctx = FacesContext.getCurrentInstance();
|
| ResourceResolver resourceResolver = null;
| String paramResourceResolver =
| ctx.getExternalContext().getInitParameter(PARAM_RESOURCE_RESOLVER);
| if( paramResourceResolver != null && paramResourceResolver.length() > 0 )
| {
| try
| {
| Class resourceResolverClass = Class.forName(
| paramResourceResolver,
| true,
| Thread.currentThread().getContextClassLoader());
| resourceResolver = (ResourceResolver) resourceResolverClass.newInstance();
| }
| catch(Exception e)
| {
| throw new RuntimeException("Problem initializing Seam delegate ResourceResolver: " + paramResourceResolver, e);
| }
| }
| if( resourceResolver == null )
| resourceResolver = new DefaultResourceResolver();
| return resourceResolver;
| }
| }
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994352#3994352
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994352
19 years, 4 months
[JBoss Seam] - Re: No page context active - ICEFACES
by costeen21
I'm using 1.1.0.GA is now giving me a similiar problem.
16:39:22,717 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) afterPhase
java.lang.NullPointerException
at org.jboss.seam.contexts.ServerConversationContext.flush(ServerConversationContext.java:210)
at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:348)
at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:248)
at org.jboss.seam.jsf.AbstractSeamPhaseListener.afterRender(AbstractSeamPhaseListener.java:232)
at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:89)
at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:391)
at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.execute(PersistentFacesState.java:306)
at com.icesoft.faces.webapp.xmlhttp.FileUploadServlet.execute(FileUploadServlet.java:85)
at com.icesoft.faces.component.inputfile.FileUploadServlet.SaveFile(FileUploadServlet.java:233)
at com.icesoft.faces.component.inputfile.FileUploadServlet.processMultipartContent(FileUploadServlet.java:161)
at com.icesoft.faces.component.inputfile.FileUploadServlet.doPost(FileUploadServlet.java:146)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
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.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
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)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994349#3994349
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994349
19 years, 4 months
[Beginners Corner] - Connection Pooling java.sql.Connection?
by deadend5001
I am trying to connection pool a AS400 JDBC Connection. Have been trying to find a good tutorial but have yet to find one.
Basically right now for each user I am creating a connection (example below). I would like to get a pool of these types of connections that expands when necissary, and contracts say after 30 minutes.
| public static java.sql.Connection getApplicationSecurityConnection() {
| String description = "Connection to the Application Security Database";
| //String driver = "com.inet.tds.TdsDriver";
| //String protocol = "inetdae";
| //String serverDNS = "localhost";
| //String port = "1433";
| //String instance = "";
| //String database = "APP_SECURITY";
| //String user = "security";
| //String password = "ssSetjESN5sgve6jQdNM8BTra";
|
| String driver = "com.ibm.as400.access.AS400JDBCDriver";
| String protocol = "";
| String serverDNS = "";
| String port = "";
| String instance = "";
| String database = "";
| String user = "CPSERVER";
| String password = "CPPROFILE";
|
|
|
| java.sql.Connection conn = null;
| try {
| // make sure DriverManager can load proper class to establish connection
| Class.forName(driver);
| String URL = "jdbc:" + protocol + ":" + serverDNS;
| Properties DBProperties = new Properties();
| if (!port.equals("")){
| DBProperties.setProperty("port",port);
| }
| if (!instance.equals("")){
| DBProperties.setProperty("instance",instance);
| }
| if (!database.equals("")){
| DBProperties.setProperty("database",database);
| }
| if (!user.equals("")){
| DBProperties.setProperty("user",user);
| }
| if (!password.equals("")){
| DBProperties.setProperty("password",password);
| }
| if(!getApplicationName().equals("")){
| DBProperties.setProperty("appname",getApplicationName());
| }
| conn = DriverManager.getConnection(URL,DBProperties);
| if (conn == null){
| throw new Exception("getDATAConnection(String, String): Unspecified error occured.");
| }
| } catch (Exception e) {
| System.out.println("\n\n*******************************************************");
| System.out.println("CONNECTION ERROR!!!!");
| System.out.println("DESCRIPTION: " + description);
| System.out.println("ERROR: " + e.getMessage());
| System.out.println("\n\n*******************************************************");
| e.printStackTrace();
| }
| return conn;
| }
any help us MUCH appreciated
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994347#3994347
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994347
19 years, 4 months
[JNDI/Naming/Network] - Listing EJB and services
by danieldestro
Hi all,
We are starting in this new SOA world in the company. Our services are implemented as Statless Session Beans (EJB) and are deployed in separate JARs for each different business module/service. We are using Java 5 and JBoss 4.0.3-SP1 and EJB 2.1.
I need to list all this services in a web page (jsp), just to monitor all the services that are deploy in that particular JBoss instance. For admin purpose.
First of all, not every EJB is a service. Only some of them are intended to be as such. So, we decided to use the @SOAService annotation created by us, just to identify it as a service in our environment as a service.
Then I will list every ejb deployed in our environment and verify if the class is annotated with @SOAService. If so, I´ll show it in the jsp monitor page.
I am having difficulty to find documentation concerning on how to list all the EJBs and do this verification.
This page http://jboss.org/wiki/Wiki.jsp?page=DisplayTheJDNITreeWithTheJMXConsole shows the jmx-console fpr what I want. I tried to do exactly the same as they do there to retrieve the information I want. But no luck at all.
Where can I find more info about what I want to do?
Or, if there is a simpler better solution than mine, please, let me know. I´d be very glad.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994346#3994346
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994346
19 years, 4 months
[Management, JMX/JBoss] - Listing EJB and services
by danieldestro
Hi all,
We are starting in this new SOA world in the company. Our services are implemented as Statless Session Beans (EJB) and are deployed in separate JARs for each different business module/service. We are using Java 5 and JBoss 4.0.3-SP1 and EJB 2.1.
I need to list all this services in a web page (jsp), just to monitor all the services that are deploy in that particular JBoss instance. For admin purpose.
First of all, not every EJB is a service. Only some of them are intended to be as such. So, we decided to use the @SOAService annotation created by us, just to identify it as a service in our environment as a service.
Then I will list every ejb deployed in our environment and verify if the class is annotated with @SOAService. If so, I´ll show it in the jsp monitor page.
I am having difficulty to find documentation concerning on how to list all the EJBs and do this verification.
This page http://jboss.org/wiki/Wiki.jsp?page=DisplayTheJDNITreeWithTheJMXConsole shows the jmx-console fpr what I want. I tried to do exactly the same as they do there to retrieve the information I want. But no luck at all.
Where can I find more info about what I want to do?
Or, if there is a simpler better solution than mine, please, let me know. I´d be very glad.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994345#3994345
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994345
19 years, 4 months