[jboss-user] [Beginner's Corner] - JSF and datasource problem

Vladica Maric do-not-reply at jboss.com
Wed Nov 28 04:46:28 EST 2012


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&containerType=14&container=2075]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121128/8f81e84d/attachment-0001.html 


More information about the jboss-user mailing list