English 中文(简体)
EJB 3.1, in war Pack in WEB-INF/classes - javax.ejb.CreateException: 不能造成无国籍的EJB[重复]
原标题:EJB 3.1 in war package in WEB-INF/classes - javax.ejb.CreateException: Could not create stateless EJB [duplicate]

我认为,我误解了在一揽子战争中包装牛奶粉的规则。

<><>Goal: 我想在一揽子战争中使用大豆。

<>Scenario: 我在战争中有一些好客:

@Stateless
public class RegistrationServiceBean {

    @PersistenceContext(unitName = "Utopia")
    EntityManager em;

    public RegistrationServiceBean() {}

    @Schedule(hour = "*", minute = "*", second = "*/15")
    public void baseRegistration() {
        System.out.println("call from ejb!!");
    }

    public void saveTempPartner(OasysPartnerTempEntity part) {
        em.persist(part);
        em.flush();
    }
}

它成功地向玻璃鱼服务器(即3.1.1)部署:

[#|2010-07-02T16:53:59.728+0300|INFO|oracle-glassfish3.0.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=36;_ThreadName=Thread-1;|Portable JNDI names for EJB RegistrationServiceBean : [java:global/oasys/hydra/RegistrationServiceBean!ua.co.oasys.hydra.beans.RegistrationServiceBean, java:global/oasys/hydra/RegistrationServiceBean]|#]

但当日程安排者开始时,我会:

[#|2010-07-02T16:54:20.004+0300|WARNING|oracle-glassfish3.0.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=38;_ThreadName=Thread-1;|A system exception occurred during an invocation on EJB RegistrationServiceBean method public void ua.co.oasys.hydra.beans.RegistrationServiceBean.baseRegistration() javax.ejb.EJBException: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:448) at com.sun.ejb.containers.BaseContainer.getContext(BaseContainer.java:2467) at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:1860) at com.sun.ejb.containers.BaseContainer.callEJBTimeout(BaseContainer.java:3962) at com.sun.ejb.containers.EJBTimerService.deliverTimeout(EJBTimerService.java:1667) at com.sun.ejb.containers.EJBTimerService.access$100(EJBTimerService.java:98) at com.sun.ejb.containers.EJBTimerService$TaskExpiredWork.run(EJBTimerService.java:2485) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: javax.ejb.EJBException: javax.ejb.CreateException: Could not create stateless EJB at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:720) at com.sun.ejb.containers.util.pool.NonBlockingPool.getObject(NonBlockingPool.java:200) at com.sun.ejb.containers.StatelessSessionContainer._getContext(StatelessSessionContainer.java:443) ... 12 more Caused by: javax.ejb.CreateException: Could not create stateless EJB at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:528) at com.sun.ejb.containers.StatelessSessionContainer.access$000(StatelessSessionContainer.java:90) at com.sun.ejb.containers.StatelessSessionContainer$SessionContextFactory.create(StatelessSessionContainer.java:718) ... 14 more Caused by: java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:768) at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:1171) at org.jboss.weld.manager.BeanManagerImpl.getBean(BeanManagerImpl.java:132) at org.glassfish.weld.services.JCDIServiceImpl._createJCDIInjectionContext(JCDIServiceImpl.java:145) at org.glassfish.weld.services.JCDIServiceImpl.createJCDIInjectionContext(JCDIServiceImpl.java:122) at com.sun.ejb.containers.BaseContainer.createEjbInstanceAndContext(BaseContainer.java:1616) at com.sun.ejb.containers.StatelessSessionContainer.createStatelessEJB(StatelessSessionContainer.java:469) ... 16 more |#]

如果我在Ejb-jar部署ejb,但不是我所希望的,那么,所有在战争中预设的申请都是好的。

在我取消对焊接后,我在部署期间例外:

com.sun.enterprise.admin.cli.CommandException: remote failure: Exception while loading the app : org.glassfish.deployment.common.DeploymentException: by java.lang.NoClassDefFoundError: ua/co/oasys/hydra/beans/RegistrationServiceBean

这与glassfish bug相似,但我并不肯定。


updates: web.xml:

<?xml version="1.0" encoding="UTF-8"?> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <display-name>CO UA Partners</display-name>
    <description>CO UA Partners Site</description>

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.xhtml</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>


    <!--Prime Faces-->
    <context-param>
        <param-name>primefaces.skin</param-name>
        <param-value>sam</param-value>
    </context-param>



    <!--Prime Faces end-->

    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>


    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>

    <context-param>
        <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>

    <security-role>
        <role-name>manager</role-name>
    </security-role>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Manager Pages</web-resource-name>
            <url-pattern>/faces/partner/manager/*</url-pattern>
            <url-pattern>/partner/manager/*</url-pattern>
            <url-pattern>/partner/*</url-pattern>
            <url-pattern>/faces/partner/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>manager</role-name>
        </auth-constraint>
    </security-constraint>

    <security-role>
        <role-name>admin</role-name>
    </security-role>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Admin Pages</web-resource-name>
            <url-pattern>/faces/partner/admin/*</url-pattern>
            <url-pattern>/partner/admin/*</url-pattern>
            <url-pattern>/partner/*</url-pattern>
            <url-pattern>/faces/partner/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>admin</role-name>
        </auth-constraint>
    </security-constraint>

    <!--roots-->


    <security-role>
        <role-name>rmanager</role-name>
    </security-role>
    <security-role>
        <role-name>radmin</role-name>
    </security-role>
    <security-role>
        <role-name>bookkeper</role-name>
    </security-role>


    <login-config>
        <auth-method>FORM</auth-method>
        <realm-name>oasysRealm</realm-name>
        <form-login-config>
            <form-login-page>/faces/login.xhtml</form-login-page>
            <form-error-page>/faces/loginError.xhtml</form-error-page>
        </form-login-config>
    </login-config>



</web-app>

NoClassDefFoundError special:

[#|2010-07-04T16:16:26.401+0300|SEVERE|oracle-glassfish3.0.1|javax.enterprise.system.core.com.sun.enterprise.v3.server|_ThreadID=25;_ThreadName=Thread-1;|Exception while loading the app org.glassfish.deployment.common.DeploymentException: by java.lang.NoClassDefFoundError: ua/co/oasys/hydra/RegistrationServiceBea at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:167) at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:125) at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:224) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:338) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170) at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102) at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88) at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76) at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53) at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57) at com.sun.grizzly.ContextTask.run(ContextTask.java:69) at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330) at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.RuntimeException: by java.lang.NoClassDefFoundError: ua/co/oasys/hydra/RegistrationServiceBea at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:344) at javassist.util.proxy.ProxyFactory.createClass2(ProxyFactory.java:314) at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:273) at org.jboss.weld.util.Proxies.createProxyClass(Proxies.java:187) at org.jboss.weld.util.Proxies.createProxyClass(Proxies.java:168) at org.jboss.weld.bean.SessionBean.initProxyClass(SessionBean.java:221) at org.jboss.weld.bean.SessionBean.initialize(SessionBean.java:143) at org.jboss.weld.bootstrap.AbstractBeanDeployer.deploy(AbstractBeanDeployer.java:110) at org.jboss.weld.bootstrap.BeanDeployment.deployBeans(BeanDeployment.java:151) at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:377) at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:165) ... 30 more Caused by: javassist.CannotCompileException: by java.lang.NoClassDefFoundError: ua/co/oasys/hydra/RegistrationServiceBea at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:169) at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:339) ... 40 more Caused by: java.lang.NoClassDefFoundError: ua/co/oasys/hydra/RegistrationServiceBea at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) at java.lang.ClassLoader.defineClass(ClassLoader.java:616) at sun.reflect.GeneratedMethodAccessor196.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at javassist.util.proxy.FactoryHelper.toClass2(FactoryHelper.java:181) at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:163) ... 41 more Caused by: java.lang.ClassNotFoundException: ua.co.oasys.hydra.RegistrationServiceBea at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:713) at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:626) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 49 more |#]


更新:

如果去除/改名豆类,则成功部署的Xml文档。


更新:

oasys.ear

jar xfv ~/Sites/workspace/Intellij_IDEA_9/Oasys/Oasys-ear/target/oasys.ear created: META-INF/ inflated: META-INF/MANIFEST.MF created: lib/ inflated: fenix.jar inflated: hydra.war inflated: javax.inject-1.jar inflated: jboss-interceptor-api-1.1-CR1.jar inflated: jsr250-api-1.0.jar inflated: lib/cdi-api-1.0-CR4.jar inflated: lib/eclipselink-2.1.0-SNAPSHOT.jar inflated: lib/javax.persistence-2.0.0.jar inflated: lib/slf4j-api-1.6.0.jar inflated: lib/slf4j-jdk14-1.6.0.jar inflated: lib/utopia.jar inflated: lib/weld-logger-1.0.0-CR2.jar inflated: META-INF/application.xml
created: META-INF/maven/ created: META-INF/maven/ua.co.oasys/ created: META-INF/maven/ua.co.oasys/oasys-ear/ inflated: META-INF/maven/ua.co.oasys/oasys-ear/pom.xml inflated: META-INF/maven/ua.co.oasys/oasys-ear/pom.properties

hydra.war

jar xfv ~/Sites/workspace/Intellij_IDEA_9/Oasys/Hydra/target/hydra.war created: META-INF/ inflated: META-INF/MANIFEST.MF created: partner/ created: partner/admin/
created: partner/manager/ created: resources/ created: resources/css/
created: resources/css/sam/ created: resources/css/sam/images/ created: resources/layout/ created: resources/security/ created: root/
created: root/admin/ created: root/bookkeeper/ created: root/manager/ created: WEB-INF/
created: WEB-INF/classes/ created: WEB-INF/classes/ua/ created: WEB-INF/classes/ua/co/ created: WEB-INF/classes/ua/co/oasys/
created: WEB-INF/classes/ua/co/oasys/hydra/
created: WEB-INF/classes/ua/co/oasys/hydra/common/ created: WEB-INF/classes/ua/co/oasys/hydra/i18n/ created: WEB-INF/classes/ua/co/oasys/hydra/mb/ created: WEB-INF/classes/ua/co/oasys/hydra/mb/registration/ created: WEB-INF/classes/ua/co/oasys/hydra/mb/security/ created: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/ created: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/co/ created: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/co/oasys/ created: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/co/oasys/hydra/ created: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/co/oasys/hydra/i18n/ created: WEB-INF/lib/ inflated: html5.html inflated: index.xhtml inflated: login.xhtml inflated: loginError.xhtml inflated: partner/admin/admin.xhtml inflated: partner/manager/manager.xhtml inflated: partner/partner.xhtml inflated: register.xhtml inflated: resources/css/cssLayout.css inflated: resources/css/default.css inflated: resources/css/master.css inflated: resources/css/sam/images/sprite.png inflated: resources/css/sam/images/ui-bg_flat_0_aaaaaa_40x100.png inflated: resources/css/sam/images/ui-bg_flat_75_ffffff_40x100.png inflated: resources/css/sam/images/ui-bg_glass_55_fbf9ee_1x400.png inflated: resources/css/sam/images/ui-bg_glass_65_ffffff_1x400.png inflated: resources/css/sam/images/ui-bg_glass_75_dadada_1x400.png inflated: resources/css/sam/images/ui-bg_glass_75_e6e6e6_1x400.png inflated: resources/css/sam/images/ui-bg_glass_95_fef1ec_1x400.png inflated: resources/css/sam/images/ui-bg_highlight-soft_75_cccccc_1x100.png inflated: resources/css/sam/images/ui-icons_222222_256x240.png inflated: resources/css/sam/images/ui-icons_2e83ff_256x240.png inflated: resources/css/sam/images/ui-icons_454545_256x240.png inflated: resources/css/sam/images/ui-icons_888888_256x240.png inflated: resources/css/sam/images/ui-icons_cd0a0a_256x240.png inflated: resources/css/sam/skin.css inflated: resources/layout/doublevontent.xhtml inflated: resources/layout/header.xhtml inflated: resources/layout/masterLayout.xhtml inflated: resources/prime-themes/vader/skin.css inflated: resources/security/loginPanel.xhtml inflated: root/admin/radmin.xhtml inflated: root/bookkeeper/rbookkeeper.xhtml inflated: root/manager/rmanager.xhtml inflated: WEB-INF/beans.xml inflated: WEB-INF/classes/ua/co/oasys/hydra/common/SkinBean.class inflated: WEB-INF/classes/ua/co/oasys/hydra/i18n/messages.properties inflated: WEB-INF/classes/ua/co/oasys/hydra/i18n/messages_en_US.properties inflated: WEB-INF/classes/ua/co/oasys/hydra/i18n/messages_ru_RU.properties inflated: WEB-INF/classes/ua/co/oasys/hydra/i18n/messages_uk_UA.properties inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/CustomCharacterEncodingFilter.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/Messenger.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/registration/TempReg.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/security/LogOutActionListener.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/security/LogoutServlet.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/security/RulesBean.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/security/SecurityBacking.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/security/UserBean.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/security/UserManager.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/co/oasys/hydra/i18n/Messages.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/co/oasys/hydra/i18n/Utf8ResourceBundle$1.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/co/oasys/hydra/i18n/Utf8ResourceBundle$Utf8PropertyResourceBundle.class inflated: WEB-INF/classes/ua/co/oasys/hydra/mb/ua/co/oasys/hydra/i18n/Utf8ResourceBundle.class inflated: WEB-INF/classes/ua/co/oasys/hydra/RegistrationServiceBea.class inflated: WEB-INF/faces-config.xml

inflated: WEB-INF/lib/primefaces-2.1.RC1-SNAPSHOT.jar inflated: WEB-INF/sun-web.xml inflated: WEB-INF/web.xml created: META-INF/maven/ created: META-INF/maven/ua.co.oasys/ created: META-INF/maven/ua.co.oasys/hydra/ inflated: META-INF/maven/ua.co.oasys/hydra/pom.xml inflated: META-INF/maven/ua.co.oasys/hydra/pom.properties


  • Q1: is it passable to use ejb beans packaged in war (specification sad that is true)?
  • Q2: should I describe some configuration by ejb-jar.xml ?
  • Q3: what could be a cause of a problem?
问题回答

这类似于玻璃鱼 b,但我不相信。

很难说,特别是因为你没有为提供分门槛,但情况似乎有所不同。

问题1:使用在战争中包裹的牛奶(真的令人痛心)是不能的?

定义明确。 您可以将EJB课程列入WEB-INF/classes,或作为EJB-JAR加以包装,并将其列入WEB-INF/lib。 我有好几次申请。

问题2:我是否应该用ejb-jar.xml描述一些配置?

没有人迫使你这样做。

问题3:问题的原因是什么?

问题是,我不能再重复问题...... 我先用<代码>(ejb, jpa, web, webservices, weld]发动机(我刚刚修改,在预定方法中插入一个地雷实体)进行网络应用。 最新版《玻璃纤维》3.0.1。 因此,我怀疑你方面的一个错误或组合问题。

比如,你可以提供<代码>jar xfv app.war的产出。 (并显示web.xml)?

在一个WAR中包装的EJBs正在使用E6网站/亮度。 我知道,时间因素和一些其他特征在这种简介中没有得到支持。 So,如果你想要使用时间,你就不得不在传统的ejbjar + War + ear way中包装你的胎。

我找不到网站简介的参考资料,这是最接近的比较:。 http://www.theserverside.com/news/1321142/Part-Three-New-Features-in-EJB-31

<><>Edit>: 我经更正,战争包装实际上在jsr 318、EJB3.1中说明。 自2006年以来 我无法发现对光谱这一部分现有特征的任何限制,而时间者也应在战争中进行包裹。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签