java.lang.RuntimeException:无效的应用程序。 EJB ServiceEjb公开远程客户端视图。此功能不是EJB 3.1 Lite API的一部分

时间:2013-11-28 10:34:16

标签: java-ee ejb ejb-3.1

我正在尝试通过Ejb从Etudiant表中获取学生列表,但我收到此错误并且应用程序将无法部署:

java.lang.RuntimeException: EJB Container initialization error
    at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:234)
    at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:291)
    at org.glassfish.ejb.startup.EjbDeployer.load(EjbDeployer.java:99)
    at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:206)
    at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:313)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
    at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
    at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:356)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
    at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
    at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
    at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
    at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
    at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
    at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
    at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
    at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.RuntimeException: Invalid application.  EJB ServiceEjb exposes a Remote client view. This feature is not part of the EJB 3.1 Lite API
    at com.sun.ejb.containers.BaseContainer.assertFullProfile(BaseContainer.java:1105)
    at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:588)
    at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:143)
    at com.sun.ejb.containers.StatelessSessionContainer.<init>(StatelessSessionContainer.java:137)
    at com.sun.ejb.containers.StatelessContainerFactory.createContainer(StatelessContainerFactory.java:61)
    at org.glassfish.ejb.startup.EjbApplication.loadContainers(EjbApplication.java:221)
    ... 38 more

这是我的EJB类代码:

@Stateless(name="ServiceEjb")
@Local
@Remote
public class EtudiantEjb implements EtudiantEjbRemote, EtudiantEjbLocal { 

    public EtudiantEjb() { }

    @PersistenceContext(unitName="PortailEjb")
    private EntityManager em;

    public List<Etudiant> ListEtudiant() {

        TypedQuery<Etudiant> query = em.createNamedQuery("Etudiant.listertous", Etudiant.class);
        List<Etudiant> etudiants = query.getResultList();
        return etudiants ;
    }

这是我的 ejb-jar 代码

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
        xmlns="http://xmlns.jcp.org/xml/ns/javaee" 
        xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee  http://xmlns.jcp.org/xml/ns/javaee/ejb-jar_3_2.xsd" version="3.2">
    <display-name>PortailEjb </display-name>
    <ejb-client-jar>PortailEjbClient.jar</ejb-client-jar>
</ejb-jar>     

我正在使用Oracle连接及其工作。我正在使用Eclipse和Glassfish4。

1 个答案:

答案 0 :(得分:1)

在Available addons节点下,安装&#34; Glassfish Commons Full Profile&#34;。重启glassfish。