[JBoss Portal] - Re: IPC Portlet calling itself?
by trupoet
So the code that does this is below. What I'm wondering is if I even need the Listener since the portlet is just sending an action to itself? Is the Listener / service stuff only needed for other portlets to call each other? This is of course just POC/Experimenting code here.
| public class ContentDisplay extends JBossPortlet
| {
| private String RootReferencePath = "/app:company_home";
|
|
| public void processAction(JBossActionRequest request, JBossActionResponse response) throws PortletException, PortletSecurityException, IOException
| {
| String filename = request.getParameter("filename");
| if(filename != null)
| response.setRenderParameter("filename",filename);
| }
|
|
| protected void doView(JBossRenderRequest rRequest, JBossRenderResponse rResponse) throws PortletException, PortletSecurityException, IOException
| {
| String filename = rRequest.getParameter("filename");
|
| if(filename == null)
| filename = "index.html";
|
|
| AuthenticationUtils.startSession("admin", "admin");
| EngineConfiguration config = AuthenticationUtils.getEngineConfiguration();
|
|
| try
| {
| rResponse.setContentType("text/html");
| PrintWriter writer = rResponse.getWriter();
|
| Store STORE = new Store(StoreEnum.workspace, "SpacesStore"); //Root store for Alfresco
|
| filename = filename.replaceAll("/","/cm:");
|
|
| String refPath = RootReferencePath + "/cm:"+filename;
|
| Reference reference = new Reference(STORE, null,refPath);
|
| ContentServiceLocator contServLocator = new ContentServiceLocator(config);
| ContentServiceSoapPort contService = (ContentServiceSoapPort)contServLocator.getContentService();
| Content[] readResult = contService.read(new Predicate(new Reference[]{reference}, STORE, null), Constants.PROP_CONTENT);
|
| Content content = readResult[0];
|
| String contentUrl = content.getUrl() + "?ticket="+AuthenticationUtils.getCurrentTicket();
|
| StringBuilder content2Print = new StringBuilder();
|
| URL url = new URL(contentUrl);
| URLConnection conn = url.openConnection();
| BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
| content2Print.append(br.readLine());
| while (br.ready())
| {
| content2Print.append(br.readLine());
| }
|
| String finalContent = content2Print.toString();
| Pattern oldLinks = Pattern.compile("<a href=\"\$");
| finalContent = oldLinks.matcher(finalContent).replaceAll("<a href=\""+rResponse.createActionURL()+"&filename=");
|
| writer.write(finalContent);
| writer.close();
| }
| catch(Throwable e)
| {
| Log.error(this,"Something bad happened: ",e);
| }
| finally
| {
| AuthenticationUtils.endSession();
| }
| }
|
| public static class Listener implements PortalNodeEventListener
| {
| public PortalNodeEvent onEvent(PortalNodeEventBubbler bubbler, PortalNodeEvent event)
| {
| PortalNode node = event.getNode();
| String nodeName = node.getName();
|
| WindowActionEvent newEvent = null;
| if(nodeName.equals("ContentDisplayPortlet") && event instanceof WindowActionEvent)
| {
| WindowActionEvent wae = (WindowActionEvent) event;
| if(node != null)
| {
| newEvent = new WindowActionEvent(node);
| newEvent.setMode(wae.getMode());
| newEvent.setParameters(wae.getParameters());
| }
| }
| if(newEvent != null)
| return newEvent;
| else
| return bubbler.dispatch(event);
| }
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975039#3975039
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975039
19 years, 6 months
[JBoss Getting Started Documentation] - can't run bank client app
by npalazzolo
Hi,
I have managed to get through most of the bank tutorial but I cannot seem to execute the client application and access the web service. The JBossDukesBank.ear deploys and works fine. The bankws-ejb.jar seems to deploy OK. I am able to enter the URL http://localhost:8080/bankws-ejb/TellerBean?wsdl and I do get the WSDL.
The problem occurs when I try to execute the ClientWS application. It seems to be failing on the line:
Service service = factory.createService(url, qname, mapping.toURL());
The error that I'm getting is:
run-ws:
[java] log4j:WARN No appenders could be found for logger (org.jboss.ws.metadata.JSR109ClientMetaDataBuilder).
[java] log4j:WARN Please initialize the log4j system properly.
[java] Exception in thread "main" java.lang.NullPointerException
[java] at java.lang.System.arraycopy(Native Method)
[java] at org.apache.xerces.impl.xs.XSModelImpl.getAnnotations(Unknown Source)
[java] at org.jboss.ws.metadata.wsdl.xmlschema.WSSchemaUtils.copyXSModel(WSSchemaUtils.java:737)
[java] at org.jboss.ws.tools.JavaToXSD.parseSchema(JavaToXSD.java:201)
[java] at org.jboss.ws.metadata.wsdl.WSDL11Reader.processTypes(WSDL11Reader.java:227)
[java] at org.jboss.ws.metadata.wsdl.WSDL11Reader.processDefinition(WSDL11Reader.java:118)
[java] at org.jboss.ws.metadata.wsdl.WSDLDefinitionsFactory.parse(WSDLDefinitionsFactory.java:145)
[java] at org.jboss.ws.metadata.ServiceMetaData.getWsdlDefinitions(ServiceMetaData.java:273)
[java] at org.jboss.ws.metadata.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:106)
[java] at org.jboss.ws.metadata.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:78)
[java] at org.jboss.ws.jaxrpc.ServiceImpl.(ServiceImpl.java:96)
[java] at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
[java] at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:142)
[java] at com.jboss.ebank.WSClient.main(WSClient.java:36)
[java] Java Result: 1
Any help would be appreciated.
Thanks in advance,
Nat
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975035#3975035
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975035
19 years, 6 months
[Clustering/JBoss] - Re: Network failure protection with JGroups/JBossCache
by bela@jboss.com
// Is it possible to configure a redundant network route
// for JGroups to fallback on?
No, not yet. We might be able to implement this with LogicalAddresses, in one of the next releases, e.g. 2.6.
However, you might be able to achieve this with help from the OS, e.g. IP Multipathing on Solaris or IP Bonding on Linux, where you have a logical NIC, which is backed up by 2 physical IP NICs, so traffic automatically uses the second NIC if the first fails. Every NIC can point to a separate network.
// Or is it possible to configure redundant multicast
// JGroups for one JBossCache and somehow bind these
// multicast address with different routes/nic?
You can bind to multiple NICs for incoming traffic:
- receive_on_all_interfaces="true" or
- receive_interfaces="eth0,192.168.0.2,hme2"
You can also send your traffic out over multiple NICs:
- send_on_all_interfaces
- send_interfaces="eth0,eth2"
This option doesn't load balance, but copies the *entire* traffic on every interface !
// Or is it possible to configure JGroups with two
// physical network interfaces, so it can decide to use
// either one of them.
See above: use IP bonding, for example
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975033#3975033
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975033
19 years, 6 months
[JBoss Seam] - weblets and seam
by enzo.aquino
Howdy all,
I'm creating a custom JSF component that relies on some javascripts and I'm using the weblets library to retrieve them. When weblets generates the URL for resource it ends up being something along the lines of: /myapp/weblets/resources/container.js.seam. Since it has a .seam extension, it's attempting to load the page context and generating a null pointer exception because there is no view root for javascript file.
My question, is there a configuration in the face-config.xml or web.xml to prevent it from attempting to load the context? Below is my configuration and the exception that I'm receiving. Thanks.
- Enzo
---------------------------------------------------------------------------------------
libraries:
- JBoss AS 4.0.4.GA
- Seam 1.0.1
- MyFaces 1.1.3 (in the jsf-libs directory)
- Tomahawk 1.1.3 (in the jsf-libs directory)
- Weblets 0.4 (installed the server/default/lib directory)
- Facelets
---------------------------------------------------------------------------------------
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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">
<!-- Seam -->
<listener-class>
org.jboss.seam.servlet.SeamListener
</listener-class>
<listener-class>
org.apache.myfaces.webapp.StartupServletContextListener
</listener-class>
<!-- Facelet configuration -->
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<param-name>facelets.DEVELOPMENT</param-name>
<param-value>true</param-value>
</context-param>
<!-- MyFaces -->
<listener-class>
org.apache.myfaces.webapp.StartupServletContextListener
</listener-class>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<!-- Faces Servlet Mapping -->
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.seam</url-pattern>
</servlet-mapping>
<!-- Exception filter -->
<filter-name>Seam Exception Filter</filter-name>
<filter-class>
org.jboss.seam.servlet.SeamExceptionFilter
</filter-class>
<filter-mapping>
<filter-name>Seam Exception Filter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>
<!-- More seam configuration -->
<filter-name>Seam Redirect Filter</filter-name>
<filter-class>
org.jboss.seam.servlet.SeamRedirectFilter
</filter-class>
<filter-mapping>
<filter-name>Seam Redirect Filter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>
<!-- Tomahawk extension filter -->
<filter-name>MyFacesExtensionsFilter</filter-name>
<filter-class>
org.apache.myfaces.webapp.filter.ExtensionsFilter
</filter-class>
<init-param>
<param-name>maxFileSize</param-name>
<param-value>20m</param-value>
</init-param>
<!-- extension mapping for adding , , and other resource tags to JSF-pages -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<!-- servlet-name must match the name of your javax.faces.webapp.FacesServlet entry -->
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>
<!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
</filter-mapping>
<!-- extension mapping for adding , , and other resource tags to JSF-pages -->
<filter-mapping>
<filter-name>MyFacesExtensionsFilter</filter-name>
<url-pattern>*.seam</url-pattern>
</filter-mapping>
<!-- Seam remoting servlet -->
<servlet-name>Seam Remoting</servlet-name>
<servlet-class>
org.jboss.seam.remoting.SeamRemotingServlet
</servlet-class>
<servlet-mapping>
<servlet-name>Seam Remoting</servlet-name>
<url-pattern>/seam/remoting/*</url-pattern>
</servlet-mapping>
</web-app>
---------------------------------------------------------------------------------------
faces-config.xml:
<faces-config>
<!-- Phase listener needed for all Seam applications -->
<phase-listener>
org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener
</phase-listener>
<!-- Facelets -->
<view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
<!-- bunch of navigation -->
</faces-config>
---------------------------------------------------------------------------------------
weblets-config.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<weblets-config xmlns="http://weblets.dev.java.net/config">
<weblet-name>com.evolved.ui</weblet-name>
<weblet-class>
net.java.dev.weblets.packaged.PackagedWeblet
</weblet-class>
<init-param>
<param-name>package</param-name>
<param-value>resources</param-value>
</init-param>
<weblet-mapping>
<weblet-name>com.evolved.ui</weblet-name>
<url-pattern>/resources/*</url-pattern>
</weblet-mapping>
</weblets-config>
---------------------------------------------------------------------------------------
exception:
java.lang.NullPointerException
at org.apache.myfaces.renderkit.html.util.AutoScrollPhaseListener.afterPhase(AutoScrollPhaseListener.java:52)
at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:181)
at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
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:97)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
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)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3975032#3975032
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3975032
19 years, 6 months