Невозможно использовать CDI в WAB на Glassfish 3.1.2 - PullRequest
0 голосов
/ 22 марта 2012

Я хочу реализовать OSGI связку со страницами JSF - WAB-файл, который может использовать CDI.Это код управляемого компонента.Я удалил содержимое файлаface-config.xml (чтобы использовать JSF 2.0 и CDI)

package com.DX_57.SM_57;
/* include default packages for Beans */
import java.io.Serializable;
import javax.enterprise.context.SessionScoped;
// or import javax.faces.bean.SessionScoped;
import javax.inject.Named;
/* include SQL Packages */
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import javax.annotation.ManagedBean;
import javax.annotation.PostConstruct;
import javax.sql.DataSource;
import javax.annotation.Resource;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
// or import javax.faces.bean.ManagedBean;   

import org.glassfish.osgicdi.OSGiService;

@ManagedBean("ApplicationController")
@ViewScoped
public class Application implements Serializable {

    /* This Hash Map will be used to store setting and value */
    private HashMap<String, String> settingsMap = null;    

    public Application(){     
    }   

    /* Call the Oracle JDBC Connection driver */
    @Resource(name = "jdbc/Oracle")
    private DataSource ds;


    /* Hash Map
     * Send this hash map with the settings and values to the JSF page
     */
    public HashMap<String, String> getsettings(){
        return settingsMap;        
    }

    /* Get a Hash Map with settings and values. The table is genarated right 
     * after the constructor is initialized. 
     */
    @PostConstruct
    public void initSettings() throws SQLException
    {        
        settingsMap = new HashMap<String, String>();

        if(ds == null) {
                throw new SQLException("Can't get data source");
        }
        /* Initialize a connection to Oracle */
        Connection conn = ds.getConnection(); 

        if(conn == null) {
                throw new SQLException("Can't get database connection");
        }
        /* With SQL statement get all settings and values */
        PreparedStatement ps = conn.prepareStatement("SELECT * from GLOBALSETTINGS");

        try
        {
            //get data from database        
            ResultSet result = ps.executeQuery();
            while (result.next())
            {
               /* Put the the data from Oracle into Hash Map */
               settingsMap.put(result.getString("SettingName"), result.getString("SettingValue"));
            }            
        }
        finally
        {
            ps.close();
            conn.close();         
        }        
    }

    /* JSF returns automatically the updated values into the HashMap */

    /* Update Settings Values */
    public void updateDBSettings() throws SQLException {

            String SQL_Statement = null;

            if (ds == null) throw new SQLException();      
        Connection conn = ds.getConnection();
            if (conn == null) throw new SQLException();      

    try {
        conn.setAutoCommit(false);
        boolean committed = false;
            try {  
                   /* Insert the new settings values with one SQL statement */
                   SQL_Statement = "UPDATE GLOBALSETTINGS " +
                                        "SET \"SettingValue\" = " +
                                          "CASE " +
                                            "WHEN \"SettingName\" = 'SessionTTL' THEN ? " +
                                            "WHEN \"SettingName\" = 'MaxUsersActive' THEN ? " +
                                          "END " +
                                   "WHERE \"SettingName\"  IN ('SessionTTL', 'MaxUsersActive')";

                   /* Execute the SQL statement */
                   PreparedStatement updateQuery = conn.prepareStatement(SQL_Statement);
                   updateQuery.setString(1, settingsMap.get("SessionTTL"));
                   updateQuery.setString(2, settingsMap.get("MaxUsersActive"));

                   updateQuery.executeQuery();                                                         
                   conn.commit();
                   committed = true;
               } finally {
                   if (!committed) conn.rollback();
                   }
            }
            finally {
            /* Release the resource after all SQL queries are executed */
            conn.close();                
            }  
       /* Refresh Hash Map
        * Get again settings from Oracle
        */
        initSettings();
     }    


}

Когда я развертываю Bundle на Glassfish 3.1.2, я получаю этот стек ошибок:

[#|2012-03-22T16:26:08.873+0200|INFO|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=211;_ThreadName=Thread-2;|Deleted /tmp/osgiapp5412956867041511002|#]

[#|2012-03-22T16:26:08.874+0200|INFO|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=211;_ThreadName=Thread-2;|Undeployed bundle com.DX_57.SM_57 [701]|#]

[#|2012-03-22T16:26:08.875+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=211;_ThreadName=Thread-2;|Stopped com.DX_57.SM_57 [701]|#]

[#|2012-03-22T16:26:08.886+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=211;_ThreadName=Thread-2;|Uninstalled com.DX_57.SM_57 [701]|#]

[#|2012-03-22T16:26:09.223+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=211;_ThreadName=Thread-2;|Installed com.DX_57.SM_57 [702] from reference:file:/opt/glassfish3/glassfish/domains/domain1/applications/SM_57-1.0-SNAPSHOT/|#]

[#|2012-03-22T16:26:09.234+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=211;_ThreadName=Thread-2;|Started com.DX_57.SM_57 [702]|#]

[#|2012-03-22T16:26:09.297+0200|INFO|glassfish3.1.2|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=211;_ThreadName=Thread-2;|SM_57-1.0-SNAPSHOT was successfully deployed in 485 milliseconds.|#]

[#|2012-03-22T16:26:09.507+0200|INFO|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=63;_ThreadName=Thread-2;|Expanded at file:/tmp/osgiapp966382129527287676/|#]

[#|2012-03-22T16:26:09.848+0200|WARNING|glassfish3.1.2|javax.enterprise.system.core.org.glassfish.kernel.event|_ThreadID=63;_ThreadName=Thread-2;|Exception while dispatching an event
java.lang.RuntimeException: Error binding ManagedBean com.DX_57.SM_57.Database with name = DatabaseController
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.loadManagedBeans(ManagedBeanManagerImpl.java:277)
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.loadManagedBeans(ManagedBeanManagerImpl.java:204)
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.event(ManagedBeanManagerImpl.java:134)
    at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:277)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:460)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
    at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
    at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
    at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
    at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Could not invoke defineClass!
    at com.sun.ejb.containers.EjbOptionalIntfGenerator.makeClass(EjbOptionalIntfGenerator.java:446)
    at com.sun.ejb.containers.EjbOptionalIntfGenerator.access$200(EjbOptionalIntfGenerator.java:62)
    at com.sun.ejb.containers.EjbOptionalIntfGenerator$1.run(EjbOptionalIntfGenerator.java:97)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.ejb.containers.EjbOptionalIntfGenerator.loadClass(EjbOptionalIntfGenerator.java:94)
    at com.sun.ejb.containers.interceptors.JavaEEInterceptorBuilderFactoryImpl.createBuilder(JavaEEInterceptorBuilderFactoryImpl.java:97)
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.loadManagedBeans(ManagedBeanManagerImpl.java:256)
    ... 19 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at com.sun.ejb.containers.EjbOptionalIntfGenerator.makeClass(EjbOptionalIntfGenerator.java:443)
    ... 25 more
Caused by: java.lang.NoClassDefFoundError: com/sun/ejb/containers/OptionalLocalInterfaceProvider
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
    ... 29 more
Caused by: java.lang.ClassNotFoundException: com.sun.ejb.containers.OptionalLocalInterfaceProvider not found by com.DX_57.SM_57 [702]
    at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1460)
    at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:72)
    at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1843)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 31 more
|#]

[#|2012-03-22T16:26:10.438+0200|INFO|glassfish3.1.2|org.glassfish.osgiweb|_ThreadID=63;_ThreadName=Thread-2;|total number of classes with faces annotation = 0|#]

[#|2012-03-22T16:26:10.451+0200|SEVERE|glassfish3.1.2|org.apache.catalina.core.ContainerBase|_ThreadID=63;_ThreadName=Thread-2;|ContainerBase.addChild: start: 
org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5332)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:498)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
    at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
    at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
    at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
    at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2743)
    at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:1966)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:235)
    at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:94)
    at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:274)
    at com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContextConfig.java:172)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:149)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5329)
    ... 25 more
Caused by: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
    at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2853)
    at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:4806)
    at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1599)
    at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2740)
    ... 32 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:315)
    at com.sun.enterprise.web.WebContainer.createListenerInstance(WebContainer.java:761)
    at com.sun.enterprise.web.WebModule.createListenerInstance(WebModule.java:1987)
    at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2851)
    ... 35 more
Caused by: java.lang.NullPointerException
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:477)
    at com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBean(ManagedBeanManagerImpl.java:420)
    at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:299)
    ... 38 more
|#]

[#|2012-03-22T16:26:10.453+0200|WARNING|glassfish3.1.2|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=63;_ThreadName=Thread-2;|java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:921)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:733)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:2018)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1669)
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:109)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
    at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
    at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
    at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
    at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
|#]

[#|2012-03-22T16:26:10.455+0200|SEVERE|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=63;_ThreadName=Thread-2;|Exception while invoking class com.sun.enterprise.web.WebApplication start method
java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:138)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
    at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
    at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
    at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
    at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
|#]

[#|2012-03-22T16:26:10.455+0200|SEVERE|glassfish3.1.2|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=63;_ThreadName=Thread-2;|Exception while loading the app|#]

[#|2012-03-22T16:26:10.493+0200|INFO|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=63;_ThreadName=Thread-2;|Deleted /tmp/osgiapp966382129527287676|#]

[#|2012-03-22T16:26:10.494+0200|SEVERE|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=63;_ThreadName=Thread-2;|Failed while deploying bundle com.DX_57.SM_57 [702]|#]

[#|2012-03-22T16:26:10.495+0200|INFO|glassfish3.1.2|org.glassfish.osgiweb|_ThreadID=63;_ThreadName=Thread-2;|Removed bundle 702 against context path /SM_57-1.0-SNAPSHOT |#]

[#|2012-03-22T16:26:10.500+0200|WARNING|glassfish3.1.2|org.glassfish.osgijavaeebase|_ThreadID=63;_ThreadName=Thread-2;|Failed to deploy bundle com.DX_57.SM_57 [702]
org.glassfish.osgijavaeebase.DeploymentException: Deployment of com.DX_57.SM_57 [702] failed because of following reason: Failed while deploying bundle com.DX_57.SM_57 [702] : java.lang.RuntimeException: Failed to deploy bundle [ com.DX_57.SM_57 [702] ], root cause: Exception while loading the app
    at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:125)
    at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
    at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
    at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
    at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.RuntimeException: Failed to deploy bundle [ com.DX_57.SM_57 [702] ], root cause: Exception while loading the app
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:196)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
    at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
    ... 10 more
Caused by: java.lang.Exception: java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class: class org.jboss.weld.servlet.WeldListener
    at com.sun.enterprise.web.WebApplication.start(WebApplication.java:138)
    at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
    at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
    at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:301)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
    at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
    ... 12 more
|#]

[#|2012-03-22T16:26:28.576+0200|INFO|glassfish3.1.2|null|_ThreadID=45;_ThreadName=Thread-2;|Domain Pinged: stable.glassfish.org|#]

Я также нашел эту ошибку на Glassfish: http://java.net/jira/browse/GLASSFISH-15225

Могу ли я решить эту проблему?Какие есть варианты?Если вы хотите, я могу предоставить полный исходный код.

С наилучшими пожеланиями

РЕДАКТИРОВАТЬ Это содержимое файла breans.xml.1017 *

Ответы [ 3 ]

2 голосов
/ 24 марта 2012

Если это комплект OSGi, а не war, ear, jar или rar, он, вероятно, не будет считаться действительным архивом бинов.В спецификации нет ничего, что требовало бы комплектации OSGi.Если это так, то это будет добавление вендора с их интеграцией CDI.

Если вы хотите увидеть эту интеграцию, войдите в список cdi-dev@jboss.org и попросите EG об этом и дождитесь их ответа.

2 голосов
/ 23 марта 2012

У вас есть файл beans.xml в каталоге META-INF под вашим classpath?

1 голос
/ 31 мая 2012

Я только начал использовать JSF и развертывать в качестве WAB в Glassfish 3.1.2.

Я смог использовать CDI с помощью аннотаций @Inject @OSGiService для приобретения сервисов OSGi.Я новичок во всем, что касается CDI, но, похоже, он отлично работает для служб типа OSGi.

...