1
    package org.primefaces.examples;

    import Conexion.conexion;
    import javax.annotation.PostConstruct;
    import java.io.Serializable;
    import static java.lang.System.out;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.faces.bean.ManagedBean;
    import org.primefaces.model.chart.Axis;

    import org.primefaces.model.chart.AxisType;
    import org.primefaces.model.chart.BubbleChartModel;
    import org.primefaces.model.chart.BubbleChartSeries;

   @ManagedBean
   public class ChartView implements Serializable {

   private BubbleChartModel bubbleModel1;
   private BubbleChartModel bubbleModel2;

  @PostConstruct
   public void init() {
   createBubbleModels();
}

public BubbleChartModel getBubbleModel1() {
    return bubbleModel1;
}

public BubbleChartModel getBubbleModel2() {
    return bubbleModel2;
}

private void createBubbleModels(){
    bubbleModel1 = initBubbleModel();
    bubbleModel1.setTitle("Bubble Chart");
    bubbleModel1.getAxis(AxisType.X).setLabel("Price");
    Axis yAxis = bubbleModel1.getAxis(AxisType.Y);
    yAxis.setMin(0);
    yAxis.setMax(250);
    yAxis.setLabel("Labels");

    bubbleModel2 = initBubbleModel();
    bubbleModel2.setTitle("Custom Options");
    bubbleModel2.setShadow(false);
    bubbleModel2.setBubbleGradients(true);
    bubbleModel2.setBubbleAlpha(0.8);
    bubbleModel2.getAxis(AxisType.X).setTickAngle(-50);
    yAxis = bubbleModel2.getAxis(AxisType.Y);
    yAxis.setMin(0);
    yAxis.setMax(250);
    yAxis.setTickAngle(50);
}

private BubbleChartModel initBubbleModel(){
    BubbleChartModel model = new BubbleChartModel();

    conexion c=new conexion();
    ResultSet re=c.consulta("select count(*), nombre from usuario where Nombre like 'a%' or nombre like 'b%' group by nombre;");
    try {
        while (re.next()) {


        }
    } catch (SQLException ex) {
        Logger.getLogger(ChartView.class.getName()).log(Level.SEVERE, null, ex);
    }



    return model;
}

com.sun.faces.mgbean.ManagedBeanCreationException: Se ha producido un error al realizar la inyección de recurso en el bean administrado chartView at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:227) at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:103) at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:409) at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:269) at com.sun.faces.el.ManagedBeanELResolver.resolveBean(ManagedBeanELResolver.java:257) at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:117) at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:176) at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:203) at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116) at com.sun.el.parser.AstValue.getBase(AstValue.java:151) at com.sun.el.parser.AstValue.getValue(AstValue.java:200) at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226) at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:109) at javax.faces.component.ComponentStateHelper.eval(ComponentStateHelper.java:194) at org.primefaces.component.chart.Chart.getModel(Chart.java:105) at org.primefaces.component.chart.renderer.BubbleRenderer.encodeData(BubbleRenderer.java:33) at org.primefaces.component.chart.renderer.BasePlotRenderer.render(BasePlotRenderer.java:29) at org.primefaces.component.chart.ChartRenderer.encodeScript(ChartRenderer.java:98) at org.primefaces.component.chart.ChartRenderer.encodeEnd(ChartRenderer.java:67) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:920) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1863) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1859) at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:458) at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:134) at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:219) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:659) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1682) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:318) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:160) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:734) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:673) at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:174) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:416) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:283) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:206) at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:180) at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:283) at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:200) at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:132) at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:111) at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:536) at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:112) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:117) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:56) at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:137) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:591) at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:571) at java.lang.Thread.run(Thread.java:748) Caused by: com.sun.faces.spi.InjectionProviderException: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting invoke lifecycle method public void org.primefaces.examples.ChartView.init() at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:231) at com.sun.faces.mgbean.BeanBuilder.invokePostConstruct(BeanBuilder.java:221) ... 56 more Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting invoke lifecycle method public void org.primefaces.examples.ChartView.init() at org.glassfish.faces.integration.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:393) at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:306) at org.glassfish.faces.integration.GlassFishInjectionProvider.invokePostConstruct(GlassFishInjectionProvider.java:229) ... 57 more Caused by: java.security.PrivilegedActionException: java.lang.reflect.InvocationTargetException at java.security.AccessController.doPrivileged(Native Method) at org.glassfish.faces.integration.GlassFishInjectionProvider.invokeLifecycleMethod(GlassFishInjectionProvider.java:376) ... 59 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.glassfish.faces.integration.GlassFishInjectionProvider$2.run(GlassFishInjectionProvider.java:382) ... 61 more Caused by: java.lang.NoClassDefFoundError: Conexion/conexion at org.primefaces.examples.ChartView.initBubbleModel(ChartView.java:61) at org.primefaces.examples.ChartView.createBubbleModels(ChartView.java:38) at org.primefaces.examples.ChartView.init(ChartView.java:26) ... 66 more Caused by: java.lang.ClassNotFoundException: Conexion.conexion at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1783) at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1633) ... 69 more

1
  • 1
    Incluye los metodos Set, para ambas variables de instancia BubbleChartModel. Commented el 29 nov. 2018 a las 19:49

1 respuesta 1

0

Comprueba que tu aplicación incluye la clase Conexion en el classpath

java.lang.ClassNotFoundException: Conexion.conexion
4
  • si ya la tengo, y esta importada a la clase de java import Conexion.conexion; Commented el 30 nov. 2017 a las 14:26
  • Una cosa es que te compile y otra que tu war/ear la incluya en ejecución. Entiendo que es una clase de un jar externo. Revisa la carpeta lib del war/ear generado a ver si está. Commented el 30 nov. 2017 a las 14:28
  • sl war/ se encuenta en la lib, que es MySQL JDBC Driver Commented el 30 nov. 2017 a las 14:42
  • Si la clase Conexion no es parte de tu proyecto, tiene que estar en un jar en WEB-INF/lib del war generado, ¿es así? Commented el 30 nov. 2017 a las 14:46

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.