[JBoss jBPM] - Re: How to use hibernate session in jbpm xhtml files
by dleerob
I'm not sure how it's done using JSF, but I make use of my own tags to access info from jbpm libraries/database. Here's an example of how I do it:
/**
| * This tag will create an html dropdown list of all the current
| * groups within the jbpm database, where the value and label of
| * each option is the group name.
| *
| * @jsp.tag name="groupSelectBox" bodycontent="empty"
| */
| public class GroupListTag extends BaseTag {
|
| private static final long serialVersionUID = 1L;
| protected String name = null;
| protected String type = null;
|
| /**
| *
| */
| protected void execute() throws Exception {
| JbpmContext jbpmContext = null;
| try {
| jbpmContext = StaticVariables.jbpmConfiguration.createJbpmContext();
| //get list of jbpm groups
| Session session = jbpmContext.getSession();
| String hibernateQuery = "from org.jbpm.identity.Group g";
| if (type != null) {
| //we then only want groups with the given group type.
| hibernateQuery += " where g.type = '"+type+"'";
| }
| List jbpmGroupList = session.createQuery(hibernateQuery).list();
| //create html drop down list of desired groups.
| jspOut.println("<SELECT name='"+name+"'>");
| jspOut.println("<OPTION value=''>-- Please Select --</OPTION>");
| for (int x = 0; x < jbpmGroupList.size(); x++) {
| Group group = (Group)jbpmGroupList.get(x);
| jspOut.println("<OPTION value='"+group.getName()+"'>"+group.getName()+"</OPTION>");
| }
| jspOut.println("</SELECT>");
| }
| catch (Exception e) {
| e.printStackTrace();
| }
| finally {
| jbpmContext.close();
| }
| }
|
| /**
| * Setter for name of the dropdown list.
| * @jsp.attribute required="true" rtexprvalue="true"
| */
| public void setName(String name) {
| this.name = name;
| }
|
| /**
| * Setter for the type of group.
| * @jsp.attribute required="false" rtexprvalue="true"
| */
| public void setType(String type) {
| this.type = type;
| }
My .tld is auto generated, using the xdoclet tags you see above. Here's what it may look like:
<taglib>
|
| <tlib-version>1.0</tlib-version>
| <jsp-version>1.2</jsp-version>
| <short-name>workflow</short-name>
|
| <description><![CDATA[Custom tag library for this application]]></description>
|
| <tag>
|
| <name>groupSelectBox</name>
| <tag-class>workflow.webapp.taglib.DepartmentListTag</tag-class>
|
| <attribute>
| <name>name</name>
| <required>true</required>
| <rtexprvalue>true</rtexprvalue>
|
| </attribute>
| <attribute>
| <name>type</name>
| <required>false</required>
| <rtexprvalue>true</rtexprvalue>
|
| </attribute>
|
| </tag>
| </taglib>
Finally, my JSP page that makes use of the tag:
<workflow:groupSelectBox name="CostCentre" type="Cost Centre"/>
Hope it gives you some ideas...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091897#4091897
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091897
18Â years, 6Â months
[JBossWS] - error runtime modeler error: Wrapper class ... is not found
by Fantagir
Hi!
I'm developing a Client of a WebService and when a I run it I've the next error:
com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class service.jaxws.DarCuenta is not found. Have you run APT to generate them?
My environment is:
Eclipse and JbossIDE for Eclipse
Jboss 4.0.5 GA
JDK 1.5
JWSDP 2.0
My WSDL:
<?xml version="1.0" encoding="UTF-8"?>
| <definitions name='Contar' targetNamespace='urn:service' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='urn:service.types' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='urn:service' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <schema targetNamespace='urn:service.types' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='urn:service.types' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
| <complexType name='DatePalabra'>
| <sequence>
| <element name='longitud' nillable='true' type='string'/>
| <element name='palabra' nillable='true' type='string'/>
| </sequence>
| </complexType>
| </schema>
| </types>
| <message name='IContar_darCuenta'>
| <part name='String_1' type='xsd:string'/>
| </message>
| <message name='IContar_darCuentaResponse'>
| <part name='result' type='ns1:DatePalabra'/>
| </message>
| <portType name='IContar'>
| <operation name='darCuenta' parameterOrder='String_1'>
| <input message='tns:IContar_darCuenta'/>
| <output message='tns:IContar_darCuentaResponse'/>
| </operation>
| </portType>
| <binding name='IContarBinding' type='tns:IContar'>
| <soap:binding style='rpc' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='darCuenta'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body namespace='urn:service' use='literal'/>
| </input>
| <output>
| <soap:body namespace='urn:service' use='literal'/>
| </output>
| </operation>
| </binding>
| <service name='Contar'>
| <port binding='tns:IContarBinding' name='IContarPort'>
| <soap:address location='REPLACE_WITH_ACTUAL_URL'/>
| </port>
| </service>
| </definitions>
|
|
My code of client:
Main:
package main;
|
| import java.net.URL;
|
| import javax.xml.namespace.QName;
| import javax.xml.ws.Service;
|
| import service.DatePalabra;
| import service.IContar;
|
| import com.lasalle.util.resources.CollectionProperties;
|
|
| public class MainDevPalabra {
|
| public static void main( String[] args ) throws Exception {
| if( args.length < 1 )
| {
| System.out.println( "Usage: Palabra name" );
| System.exit( 0 );
| }
|
| String argument = args[ 0 ];
|
| DatePalabra dp = new DatePalabra();
|
| //CollectionProperties propietats = new CollectionProperties();
| String urlstr = CollectionProperties.getPropiedad("serviceD.url");
| String nameServiceStr = CollectionProperties.getPropiedad("serviceD.name");
| String namespaceServiceStr = CollectionProperties.getPropiedad("serviceD.namespace");
|
| System.out.println( "Contacting webservice at " + urlstr );
|
| URL url = new URL(urlstr);
|
| //se indican el namespace en el que se encuentra el servicio y su nombre
| //(esto se puede ver en el WSDL)
| QName qname = new QName(namespaceServiceStr,
| nameServiceStr);
|
|
| Service service = Service.create(url, qname);
|
| System.out.println( "After create service" );
|
| IContar age = ( IContar) service.getPort( IContar.class );
|
| System.out.println( "After getPort" );
|
| System.out.println( "age.age(" + argument + ")" );
| dp = (DatePalabra) age.darCuenta(argument);
| System.out.println( "output longitud:" + dp.getLongitud() );
| System.out.println( "output palabra:" + dp.getPalabra() );
| }
|
|
| }
|
Interface of the service:
package service;
|
| import java.rmi.RemoteException;
|
| import javax.jws.WebMethod;
| import javax.jws.WebResult;
| import javax.jws.WebService;
| import javax.jws.WebParam;
|
| @WebService(
| name="IContar", // wsdl:portType
| targetNamespace="urn:service" //wsdl:targetNamespace
| )
|
| public interface IContar extends java.rmi.Remote
| {
|
| //@WebMethod(operationName="darCuenta")
| @WebMethod
| //@WebResult(name="IContar_darCuentaResponse", partName="result")
| //public DatePalabra darCuenta(@WebParam(name = "String_1") String name) throws RemoteException;
| public DatePalabra darCuenta(String name) throws RemoteException;
| }
|
Can you help me??
Thanks
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091893#4091893
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091893
18Â years, 6Â months
[JBoss Seam] - Seam Remoting message leak with JMS Topic Subscribe
by scotto
We have observed a JMS message leak using Seam Remoting to subscribe to a JMS topic, whereby the list of undelivered topic messages grows indefinitely until the server ultimately runs out of memory and crashes.
The cause of this seems to be that Seam Remoting requires the web client to manually unsubscribe from topics in order to properly release system resources. This of course cannot be guaranteed.
Consider the following scenario:
| * Web client subscribes to a JMS topic using the Seam Remoting Javascript:
| Seam.Remoting.subscribe("topicName", subscriptionCallback);
|
| * On the server, a new org.jboss.seam.remoting.messaging.RemoteSubscriber is created, which in turn creates a new JMS topic subscriber. The JMS provider will now store any new topic messages until they have been consumed by the web-client.
|
| * Say the web client navigates to a different page (or simply drops out) and therefore never calls Seam.Remoting.unsubscribe() - in this situation the RemoteSubscriber never closes its JMS session and all pending topic messages are queued indefinitely by the JMS provider, ultimately resulting in the server running out memory (or database space if persistent messages are used).
|
This problem has been observed on JBossAS 4.2.0.GA with JBossMQ and Seam 1.2.1.GA.
It is very easy to reproduce this problem by simply sending persistent messages to the remoting topic and then observing the jms_messages table in your database to see the ever-growing list of messages when the client navigates away from the subcribed page.
I have looked at the Seam remoting source code and it would appear that the problem arises because the only way RemoteSubscriber.unsubscribe() is ever called is if the web client javascript code 'remembers' to call it (and afaik there is no way of enforcing this should the user navigate away etc).
It seems someone else has encountered a similar problem (http://www.jboss.org/index.html?module=bb&op=viewtopic&t=92485) which addresses the multiple-subscription issue, however the proposed workaround does not cater for the situation where the client simply navigates away, never to be seen by the again and leaving an open topic subscriber to fill up with messages.
I can think of two possible solutions to this:
| * Have some mechanism that gets notified whenever web sessions are deleted by the server and release any associated RemoteSubscribers accordingly, however this does not cater for the scenario where the web session stays valid, but the user has simply navigated away from the page with the topic subscription.
|
| * Another approach may simply be to have some kind of cleanup thread that periodically checks all RemoteSubscribers to identify and unsubscribe any which have not had poll() called on them for a predefined period (say 2 or 3 times the remoting poll timeout defined in components.xml?). Client code may potentially need to be modified to handle resubscribing if its subscription has expired (with possible associated loss of messages), however this would not normally happen as long as the ajax client always commenced a new long-poll as soon as the last one ended.
|
Perhaps a combination of these two approaches would be the cleanest?
Comments anyone?
Thanks
Scott
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091888#4091888
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091888
18Â years, 6Â months
[JBoss Portal] - Re: User Identity modules in a Portlet?
by remi_dong
"remi_dong" wrote : I have other question.
| when i finish the verification the password in my Portlet, i want connect this use, so i have a JSP for send to context de auth.
| But it send me to page login.jsp.
| --------------------------------------------------------------------------------------
| <%
| String form_path="/auth/";
| String contextPath = request.getContextPath();
| String userVe =request.getAttribute("user").toString();
| String passVe =request.getAttribute("pass").toString();
| String uPath=request.getAttribute("path").toString();
| %>
| form name="form2" method="POST" action='<%=form_path+uPath%>'
| input type="hidden" name="user" value='<%=userVe%>'/
| input type="hidden" name="pass" value='<%=passVe%>'/
| /form
|
| script type="text/javascript"
| <!--
| document.form2.submit();
| //-->
| /script
| --------------------------------------------------------------------------------------
| Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091884#4091884
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091884
18Â years, 6Â months
[JBoss Seam] - How to abandon a conversation?
by stephen.friedrich
Ok, I now about the propagation attribute and about s:conversationPropagation.
It does not work for me, because I am using Trinidad's Xml menu and tr:commandNavigationItem as a stamp to render it.
Docs for s:conversationPropagation:anonymous wrote : Customize the conversation propagation for a command link or button (or similar
| JSF control).
Is there really any "similar JSF control" for which it works? What does "similar" mean anyway? At least it seems like tr:commandNavigationItem is not similar enough.
So: Is there a way to either declare in pages.xml that a page does not use conversations, e.g. something similar to "end-conversation":
<abandon-conversation before-redirect="true"/>
Or else is there a way to do that programmatically, like
conversation.begin(PropagationType.NONE);
Or finally: What else could I do to integrate Seam conversations with an unsuspecting component set?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4091880#4091880
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4091880
18Â years, 6Â months