将 struts 1.1 Web 应用程序从 weblogic 8.1 转换为 weblogic 10.3

发布于 2024-08-01 19:14:23 字数 3193 浏览 4 评论 0原文

我有一个编写为在 Weblogic 8.1 下运行的 Web 应用程序。 它是一个struts 1.1应用程序,使用Java 1.4。

为了可维护性,我们决定尝试将此应用程序转换为在 Java 6 和 Weblogic 10gR3 下运行,与我们所有其他应用程序保持一致。 我们一直推迟这样做,因为我们发布了一个主要版本,其功能是用户所渴望的,但现在该应用程序正在进行用户验收测试,我们认为是时候拔出手指并让这个东西运行起来了在更新的 JVM 和容器下。

为此,我加载了源代码并在 Java 6 下进行编译,并使用其构建脚本生成包含应用程序的 .war 文件。

然后,我尝试在 weblogic 10gR3 服务器下部署此应用程序。 然而,虽然部署步骤似乎没有任何问题,但当它们完成后,我在 weblogic 控制台的“域结构”面板中单击“部署”,应用程序列出的状态为“失败”。

我检查了 weblogic 日志,但我看到的唯一错误与无法找到 log4j 配置有关 - 这不应阻止应用程序本身运行。 我猜测 jdbc 连接的设置方式可能有问题 - 这在 weblogic 10.3 中与 8.1 中明显不同。 但是我不确定这就是问题的原因 - 无论如何,我已经在 weblogic 10.3 下设置了数据源,以便它具有相同的 jndi 名称,因此它应该选择它(尽管我在这些问题上远不是专家,所以我可能是错的)。

我注意到与我们拥有的其他 weblogic 10gR3 应用程序不同的一件事是该程序访问数据库的方式。 我尝试转换的程序在其 web.xml 中具有以下条目:

<context-param>
    <param-name>dataSource</param-name>
    <param-value>@database.dataSource@</param-value>
</context-param>
<context-param>
    <param-name>db.drivertype</param-name>
    <param-value>@database.drivertype@</param-value>
</context-param>
<context-param>
    <param-name>db.host</param-name>
    <param-value>@database.host@</param-value>
</context-param>
<context-param>
    <param-name>db.dbname</param-name>
    <param-value>@database.name@</param-value>
</context-param>
<context-param>
    <param-name>db.username</param-name>
    <param-value>@database.username@</param-value>
</context-param>
<context-param>
    <param-name>db.password</param-name>
    <param-value>@database.password@</param-value>
</context-param>
<context-param>
    <param-name>db.port</param-name>
    <param-value>@database.port@</param-value>
</context-param>
<context-param>
    <param-name>db.protocol</param-name>
    <param-value>@database.protocol@</param-value>
</context-param>

各种 @somestring@ 字段被构建脚本替换为实际值,该脚本从部署.properties 文件中获取它们,以便我们可以指定实时值生产数据库或开发数据库取决于我们是为开发还是生产而编译。

另一方面,我用作参考的另一个应用程序使用使用 persistence.xml 文件配置的 EJB 实体 bean - 我可以找到的对实际数据库的唯一参考是:

    <jta-data-source>ourProductionDataSource</jta-data-source>

它引用了设置的数据源在 weblogic 10gR3 的 weblogic 控制台“域结构”窗格的“服务”部分的 JDBC 下的“数据源”部分中。

即使这与原始的 weblogic 8 应用程序完全不同,因为使用 weblogic 8 应用程序,我们需要设置一个包含所有数据库详细信息的 JDBC 连接池,然后设置一个单独的 JDBC 数据源,该数据源引用 JDBC 连接池,但提供了可用于在 java 应用程序中查找数据源的 JNDI 名称。

我真的不知道如何将其融入 weblogic 10gR3 将识别的内容中,以便旧版 weblogic 8 应用程序知道如何查找其数据。 我当然假设这是应用程序无法成功部署的主要问题(我可能是错的)。 在尝试解决此问题时,我还(在 weblogic 10gR3 下)创建了一个数据源工厂,希望它能够模拟 weblogic 8 应用程序的需求。 然后,我引用了在 .propery 文件的 database.dataSource 条目中创建的数据源工厂名称,以便将其交换到应用程序的 web.xml 中的以下条目:

<context-param>
    <param-name>dataSource</param-name>
    <param-value>@database.dataSource@</param-value>
</context-param>

但这似乎没有修复问题。

谁能给我一些线索,告诉我需要关注哪些事情才能让这个应用程序(为 weblogic 8.1 编写)在 weblogic 10gR3 下运行?

谢谢大卫

·巴德里奇。

I have a web application that was written to run under Weblogic 8.1. It is a struts 1.1 application, using Java 1.4.

For the sake of maintainability we have decided to attempt to conver this application run under Java 6 and Weblogic 10gR3 in line with all our other applications. We've been putting off doign this because we had a major release due with functionality that the users were screaming for, but now that the application is in User Acceptance Testing, we figured it was time to pull the finger out and get this thing running under a more up-to-date JVM and container.

To this end, I have loaded up the source-code and got it compiling under Java 6, and used its build script to generate the .war file that comprises the application.

I then attempted to deploy this application under a weblogic 10gR3 server. However, while the deploy steps appeared to proceed without any problems, when they are complete, and I click on "Deployments" in the Domain Structure panel in the weblogic console, the application lists with a state of "Failed".

I checked the weblogic logs but the only errors I could see were related to being unable to find the log4j configuration - which shouldn't stop the application itself from running. I was guessing that maybe there was somethign wrong in the way the jdbc connections were set up - this being significantly different in weblogic 10.3 from 8.1. However I am not certain that this is the cause of the problem - and in any case I had set up the data source under weblogic 10.3 so that it has the same jndi name so it should pick it up (although I am nothing close to an expert on these matters so I could be wrong).

One thing I have noticed that differs from other weblogic 10gR3 applications that we have, is the way that this program accesses the database. The program I am trying to convert has the following entries in its web.xml:

<context-param>
    <param-name>dataSource</param-name>
    <param-value>@database.dataSource@</param-value>
</context-param>
<context-param>
    <param-name>db.drivertype</param-name>
    <param-value>@database.drivertype@</param-value>
</context-param>
<context-param>
    <param-name>db.host</param-name>
    <param-value>@database.host@</param-value>
</context-param>
<context-param>
    <param-name>db.dbname</param-name>
    <param-value>@database.name@</param-value>
</context-param>
<context-param>
    <param-name>db.username</param-name>
    <param-value>@database.username@</param-value>
</context-param>
<context-param>
    <param-name>db.password</param-name>
    <param-value>@database.password@</param-value>
</context-param>
<context-param>
    <param-name>db.port</param-name>
    <param-value>@database.port@</param-value>
</context-param>
<context-param>
    <param-name>db.protocol</param-name>
    <param-value>@database.protocol@</param-value>
</context-param>

with the various @somestring@ fields being replaced with actual values by the build script which gets them from a deploy.properties file so that we can specify either the live production database or the development database depending on whether we are compiling for development or production.

The other application that I am using as a reference on the other hand uses EJB entity beans which are configured using a persistence.xml file - and the only reference in there I can find to the actual database is:

    <jta-data-source>ourProductionDataSource</jta-data-source>

which referrs to a datasource set up in the Data Sources section under JDBC in the "Services" section of the Domain Structure pane in the weblogic console for weblogic 10gR3.

Even that is entirely different to the original weblogic 8 application since with the weblogic 8 app, we needed to set up a JDBC Connection pool which had all the database details and then set up a separate JDBC Data Source which referred to the JDBC Connection Pool but provided a JNDI name that could be used to find the datasource within the java application.

I really have no idea how to munge this into something that weblogic 10gR3 is going to recognise so that the legacy weblogic 8 application will know how to find its data. I am assuming of course that this is the major problem of why the application wont deploy successfully (I might be wrong). In attempting to resolve this probelm, I also created (under weblogic 10gR3) a Data Source Factory in the hope that perhaps this might be able to emulate what the weblogic 8 app needs. I then referred to the Data Source Factory name that I had created in the database.dataSource entry in the .propery file so that it is swapped into the following entry in the web.xml for the application:

<context-param>
    <param-name>dataSource</param-name>
    <param-value>@database.dataSource@</param-value>
</context-param>

however that does not seem to have fixed the problem.

Can anyone give me some clues as to the kinds of things I need to be focusing on in order to get this application (written for weblogic 8.1) to run under weblogic 10gR3 ?

thanks heaps guys

David Buddrige.

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

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

发布评论

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

评论(1

一萌ing 2024-08-08 19:14:23

另请验证 weblogic.xml 是否已正确配置。 有时,context-root 会导致应用在 Weblogic 10.3 上部署失败,即使它在 Weblogic 8 上运行良好。

weblogic.xml 中需要存在以下内容:

<context-root>/</context-root>

Also verify that weblogic.xml is properly configured. Sometimes context-root causes the app to fail deployment on Weblogic 10.3, even when it works fine on Weblogic 8.

Following needs to be present in weblogic.xml:

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