[Beginner's Corner] - JSF and datasource problem
by Vladica Maric
Vladica Maric [https://community.jboss.org/people/vmaric] created the discussion
"JSF and datasource problem"
To view the discussion, visit: https://community.jboss.org/message/778806#778806
--------------------------------------------------------------
I make JSF beginner's aplikacation and goal is that with index.html simply present the content of database table.
I make customerBean.java for connecting and read content of datatable.
I handling connection over datasource:
Database is Derby .
I made datsourc in jboss7.1 standalone and I can ping database.
@Resource(name="java:/MyDerby", type=DataSource.class)
private DataSource ds;
Is it correct that JDNI for @Resource written above?
I made datsourc in jboss7.1 standalone and I can ping database.
But when I start aplication on server I have got error on web server with code http status 500.
***************************************************************************************************************
**************************Here is logs from web browser:
h1. HTTP Status 500 -
----
*type* Exception report
*message*
*description* The server encountered an internal error () that prevented it from fulfilling this request.
*exception*
javax.servlet.ServletException: Unexpected error processing managed bean customerBean javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)
*root cause*
com.sun.faces.mgbean.ManagedBeanPreProcessingException: Unexpected error processing managed bean
customerBean com.sun.faces.mgbean.BeanManager.preProcessBean(BeanManager.java:398)
com.sun.faces.mgbean.BeanManager.create(BeanManager.java:262) com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116)
com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72) org.apache.el.parser.AstValue.getValue(AstValue.java:147) org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) javax.faces.component.UIData.getValue(UIData.java:731) javax.faces.component.UIData.getDataModel(UIData.java:1798) javax.faces.component.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:484) javax.faces.component.UIData.setRowIndex(UIData.java:473) com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:81) javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820) javax.faces.component.UIData.encodeBegin(UIData.java:1118) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777) javax.faces.render.Renderer.encodeChildren(Renderer.java:168) javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
*root cause*
com.sun.faces.mgbean.ManagedBeanPreProcessingException: Unexpected error processing managed property customerList
com.sun.faces.mgbean.ManagedBeanBuilder.bake(ManagedBeanBuilder.java:117) com.sun.faces.mgbean.BeanManager.preProcessBean(BeanManager.java:353)
com.sun.faces.mgbean.BeanManager.create(BeanManager.java:262) com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116) com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72) org.apache.el.parser.AstValue.getValue(AstValue.java:147) org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) javax.faces.component.UIData.getValue(UIData.java:731) javax.faces.component.UIData.getDataModel(UIData.java:1798) javax.faces.component.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:484) javax.faces.component.UIData.setRowIndex(UIData.java:473) com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:81) javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820) javax.faces.component.UIData.encodeBegin(UIData.java:1118) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777) javax.faces.render.Renderer.encodeChildren(Renderer.java:168) javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
*root cause*
java.lang.NullPointerException com.sun.faces.mgbean.ManagedBeanBuilder.bakeBeanProperty(ManagedBeanBuilder.java:350)
com.sun.faces.mgbean.ManagedBeanBuilder.bake(ManagedBeanBuilder.java:107) com.sun.faces.mgbean.BeanManager.preProcessBean(BeanManager.java:353)
com.sun.faces.mgbean.BeanManager.create(BeanManager.java:262) com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:244)
com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:116) com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:72) org.apache.el.parser.AstValue.getValue(AstValue.java:147) org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:189) com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:182) javax.faces.component.UIData.getValue(UIData.java:731) javax.faces.component.UIData.getDataModel(UIData.java:1798) javax.faces.component.UIData.setRowIndexWithoutRowStatePreserved(UIData.java:484) javax.faces.component.UIData.setRowIndex(UIData.java:473) com.sun.faces.renderkit.html_basic.TableRenderer.encodeBegin(TableRenderer.java:81) javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820) javax.faces.component.UIData.encodeBegin(UIData.java:1118) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777) javax.faces.render.Renderer.encodeChildren(Renderer.java:168) javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782) com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:402) com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
*note* The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.
----
h3. JBoss Web/7.0.13.Final
****************************************************************************************
********My logs as they are in the console my logs when I dodeploy project:
12:01:02,036 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "BaseProba1.war"
12:01:02,599 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_cs.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,614 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_de_DE.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,614 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_es.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,614 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_fr.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,614 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_hu.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,630 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_it.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,630 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_ja_JP.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,630 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_ko_KR.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,630 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_pl.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,630 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_pt_BR.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,630 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_ru.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,630 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_zh_CN.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,630 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) Class Path entry derbyLocale_zh_TW.jar in "/C:/jboss-as-7.1.1.Final/standalone/deployments/BaseProba1.war/WEB-INF/lib/derbyclient.jar" does not point to a valid jar for a Class-Path reference.
12:01:02,927 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015893: Encountered invalid class name 'com.sun.faces.vendor.Tomcat6InjectionProvider:org.apache.catalina.util.DefaultAnnotationProcessor' for service type 'com.sun.faces.spi.injectionprovider'
12:01:02,927 WARN [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015893: Encountered invalid class name 'com.sun.faces.vendor.Jetty6InjectionProvider:org.mortbay.jetty.plus.annotation.InjectionCollection' for service type 'com.sun.faces.spi.injectionprovider'
*12:01:03,536 WARN [org.jboss.as.ee] (MSC service thread 1-4) JBAS011001: Could not resolve resource-env-ref java:/MyDerby*
12:01:03,786 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) JBAS010403: Deploying JDBC-compliant driver class org.apache.derby.jdbc.ClientDriver (version 10.9)
12:01:03,911 INFO [org.apache.catalina.core.StandardContext] (MSC service thread 1-1) The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
12:01:03,958 INFO [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-1) Initializing Mojarra 2.1.7-jbossorg-1 (20120227-1401) for context '/BaseProba1'
12:01:05,521 INFO [org.hibernate.validator.util.Version] (MSC service thread 1-1) Hibernate Validator 4.2.0.Final
*12:01:05,630 WARNING [javax.enterprise.resource.webcontainer.jsf.managedbean] (MSC service thread 1-1) JSF1074: Managed bean named 'customerBean' has already been registered. Replacing existing managed bean class type corejsf.CustomerBean with corejsf.CustomerBean.*
12:01:06,021 INFO [org.jboss.web] (MSC service thread 1-1) JBAS018210: Registering web context: /BaseProba1
12:01:06,177 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "BaseProba1.war"
I copied earlier derbyclient.jar file in /WEB-INF/lib/ dir in eclipse is that wrong???
*********And what mean bolded message:
*12:01:03,536 WARN [org.jboss.as.ee] (MSC service thread 1-4) JBAS011001: Could not resolve resource-env-ref java:/MyDerby*
********and another message:
*12:01:05,630 WARNING [javax.enterprise.resource.webcontainer.jsf.managedbean] (MSC service thread 1-1) JSF1074: Managed bean named 'customerBean' has already been registered. Replacing existing managed bean class type corejsf.CustomerBean with corejsf.CustomerBean.*
*Please help me!!!
*
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/778806#778806]
Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 4 months
[jBPM] - Is it possible to create task with multiple groupId constraint?
by Thomas Setiabudi
Thomas Setiabudi [https://community.jboss.org/people/thomas.setiabudi] created the discussion
"Is it possible to create task with multiple groupId constraint?"
To view the discussion, visit: https://community.jboss.org/message/778524#778524
--------------------------------------------------------------
Hi,
Lets say we have two user grouping tables:
1. UserDepartment -> this table maps user with department like Accounting, Human Resource, or Marketing. sample record would be: (thomas, Accounting)
2. UserJobTitle -> this table maps user with job title like staff, supervisor, or manager. sample record would be: (thomas, Supervisor)
Now, we have a human task in our process, the human task can be done by any Supervisor in Accounting department.
How do we do it?
Based on IRC chat with Maciej: By Default Group Assignment is based on OR operator
The only workaround that I can use for now is to manipulate the group name, concatenate it to one single String like this:
"Accounting|Supervisor"
That works, but it adds more complication as we have more and more group combination, lets say instead of those two groups, we have three more tables.
Any idea?
Is it a good candidate to ask a feature request for this requirement?
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/778524#778524]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 4 months
[jBPM] - Re: Could not getting tasks for business administrators through task client
by Maciej Swiderski
Maciej Swiderski [https://community.jboss.org/people/swiderski.maciej] created the discussion
"Re: Could not getting tasks for business administrators through task client"
To view the discussion, visit: https://community.jboss.org/message/778258#778258
--------------------------------------------------------------
No, it fact the problem was that you used getTasksAssignedAsPotentialOwner method instead of one dedicated to get tasks assigned as business user, see in bold:
> tom sebastian wrote:
>
> This was my class.
>
> public class BusinessAdminTest {
>
>
> private static final long DEFAULT_WAIT_TIME = 10000l;
> private TaskClient client;
> private WorkItemManager manager;
> private String ipAddress="192.168.1.111";
> private int port=9123;
>
> private void createClient() {
> if (client == null) {
> client = new TaskClient(new MinaTaskClientConnector("com.task.BusinessAdminTest",
> new MinaTaskClientHandler(SystemEventListenerFactory.getSystemEventListener())));
> boolean connected = client.connect(ipAddress, port);
> if (!connected) {
> throw new IllegalArgumentException("Could not connect task client");
> }
> }
> }
> public void test() throws Throwable{
>
>
>
> // Create the task
> //assumed testGroup contain 'Mary','John' users
> Task task1 = createTask("TaskName", "Comment","Tom","testGroup");
> BlockingTaskOperationResponseHandler operationResponseHandler = new BlockingTaskOperationResponseHandler();
> client.addTask(task1, null, null);
>
>
> Thread.sleep(500);
>
> // Test if the task is successfully created
> BlockingTaskSummaryResponseHandler responseHandler = new BlockingTaskSummaryResponseHandler();
> client.getTasksAssignedAsPotentialOwner("Tom", "en-UK",
> responseHandler);
> responseHandler.waitTillDone(DEFAULT_WAIT_TIME);
> List tasks = responseHandler.getResults();
> if(tasks!=null){
> System.out.println(tasks.size());
> TaskSummary summary=(TaskSummary) tasks.get(0);
> System.out.println(summary.getStatus().toString());//will be 'Ready'
>
> }
> //Try to get task as business administrator
> responseHandler = new BlockingTaskSummaryResponseHandler();
> * client.getTasksAssignedAsPotentialOwner("administrator", "en-UK",*
> * responseHandler);*
> responseHandler.waitTillDone(DEFAULT_WAIT_TIME);
> tasks = responseHandler.getResults();
> if(tasks!=null){// according to WS specification, we expect to get task
> System.out.println(tasks.size());
> TaskSummary summary=(TaskSummary) tasks.get(0);
> System.out.println(summary.getStatus().toString());
>
> }
>
> }
> public TaskClient getClient() {
> return client;
> }
> public void setClient(TaskClient client) {
> this.client = client;
> }
> private Task createTask(String taskName, String comment, String actorId,String groupId) {
> Task task = new Task();
> if (taskName != null) {
> List names = new ArrayList();
> names.add(new I18NText("en-UK", taskName));
> task.setNames(names);
> }
> if (comment != null) {
> List descriptions = new ArrayList();
> descriptions.add(new I18NText("en-UK", comment));
> task.setDescriptions(descriptions);
> List subjects = new ArrayList();
> subjects.add(new I18NText("en-UK", comment));
> task.setSubjects(subjects);
> }
> task.setPriority(10);
>
>
> TaskData taskData = new TaskData();
>
>
>
> PeopleAssignments assignments = new PeopleAssignments();
> List potentialOwners = new ArrayList();
>
>
> if (actorId != null && actorId.trim().length() > 0) {
>
> potentialOwners.add(new User(actorId.trim()));
> }
> if (groupId != null && groupId.trim().length() > 0) {
>
> potentialOwners.add(new Group(groupId.trim()));
>
> }
> // Set the first user as creator ID??? hmmm might be wrong
> if (potentialOwners.size() > 0) {
> taskData.setCreatedBy((User) potentialOwners.get(0));
> }
>
> assignments.setPotentialOwners(potentialOwners);
> List businessAdministrators = new ArrayList();
> businessAdministrators.add(new User("administrator"));
> assignments.setBusinessAdministrators(businessAdministrators);
> task.setPeopleAssignments(assignments);
>
> taskData.setSkipable(true);
>
> task.setTaskData(taskData);
>
> return task;
> }
>
> public void setManager(WorkItemManager manager) {
> this.manager = manager;
> }
> public WorkItemManager getManager() {
> return manager;
> }
>
> public static void main(String[] a){
> BusinessAdminTest baTest = new BusinessAdminTest();
> baTest.createClient();
> try {
> baTest.test();
> } catch (Throwable e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> }
> }
>
>
>
>
>
>
> When i run this ,the output was(the first 2 lines indicate the number of tasks and its status as potential owner, while the remaining as business admin for the same task)
>
> 1
> Ready
> 0
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
--------------------------------------------------------------
Reply to this message by going to Community
[https://community.jboss.org/message/778258#778258]
Start a new discussion in jBPM at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&con...]
13 years, 4 months