如何将 ejb2 无状态会话 Bean 逐步迁移到 ejb3?

发布于 2024-07-24 06:01:12 字数 312 浏览 7 评论 0原文

EJB3 规范表明 EJB2 和 EJB3 可以在单个应用程序中共存。

我希望将我的 EJB2 无状态会话 Bean 迁移到 EJB3 无状态会话 Bean。
这个问题根本与JPA无关(这是将来要进行的一项单独的工作)

我正在websphere 6.1上运行,安装了EJB3功能包并打了补丁,并且配置文件得到了增强(一个ejb3示例应用程序)确认它有效)

我需要对我的代码、web.xml、application.xml、ejb-jar.xml 和其他 websphere 特定绑定进行哪些更改才能将 SINGLE ejb 从 2 转换为 3?

The EJB3 spec indicates that EJB2 and EJB3 can co-exist in a single application.

I wish to migrate my EJB2 stateless session beans to EJB3 stateless session beans.
This question does not relate to JPA at all (that is a separate piece of work to be carried out in the future)

I'm running on websphere 6.1 with the EJB3 feature pack installed and patched and the profile is augmented (an ejb3 sample app confirms that it works)

What changes do I need to make to my code, web.xml, application.xml, ejb-jar.xml and other websphere specific bindings to convert a SINGLE ejb from 2 to 3?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

╭ゆ眷念 2024-07-31 06:01:13

我将在继续的过程中尝试回答我自己的问题。
以下是我的解决方法

以下 xml 文件过去具有文档类型,但现在必须具有命名空间:

myApp.ear/META-INF/application.xml< /strong>

<application version="5" 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/application_5.xsd">

myApp.ear/web.war/WEB-INF/web.xml

 <web-app version="2.5" 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_2_5.xsd">

myApp.ear/ejb.jar/META-INF/ejb-jar.xml

<ejb-jar id="ejb-jar_ID" 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/ejb-jar_3_0.xsd">

< strong>对 web.xml 进行了以下更改

  • taglib 元素现在位于 jsp-config 元素下

  • 显示名称元素已从过滤器元素中删除
    和 servlet 元素

删除 myApp.ear/ejb.jar/META-INF/ibm-ejb-jar-bnd.xmi

JNDI 查找
更改所有本地 ejb jndi 查找以使用 ejblocal:[classname]

我还从 ejb-jar.xml 映射中删除了 jdbc 资源引用,并使用全局查找

我遇到的安全问题是因为我删除了 ibm-application-bnd .xmi 将用户和组绑定到角色/

I'm going to have a crack at answering my own question as I go along.
Here's how I got through it

The following xml files used to have doctypes, but must now have namespaces:

myApp.ear/META-INF/application.xml

<application version="5" 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/application_5.xsd">

myApp.ear/web.war/WEB-INF/web.xml

 <web-app version="2.5" 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_2_5.xsd">

myApp.ear/ejb.jar/META-INF/ejb-jar.xml

<ejb-jar id="ejb-jar_ID" 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/ejb-jar_3_0.xsd">

The following changes have been made to web.xml

  • taglib elements are now under a jsp-config element

  • the display-name element has been removed from filter elements
    and servlet elements

Remove myApp.ear/ejb.jar/META-INF/ibm-ejb-jar-bnd.xmi

JNDI lookups
change all your local ejb jndi lookups to use ejblocal:[classname]

I also removed my jdbc resource ref from ejb-jar.xml mappings and am using a global lookup instead

The security problem I was having was because I removed ibm-application-bnd.xmi where it binds users and groups to roles/

不必在意 2024-07-31 06:01:13

您需要将 Java EE xml 命名空间放入您提到的三个 xml 文件中。 然后我认为您删除了 WAS 绑定文件并使用不同的 jndi 查找

You need to put Java EE xml namespaces in the three xml files you mentioned to start with. Then I think you remove your WAS binding files and use a different jndi lookup

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文