在JBoss 5上部署Seam应用程序

JBoss5部署Seam应用
本文档指导如何在JBoss AS5上部署Seam应用程序,解决持久化单元加载问题,包括修改配置文件以绑定持久化单元到JNDI,禁用Seam管理的持久化单元等。

由于本人英语水平和精力都有限,无法完成全部翻译,只是对其中重点文字作了翻译,依照这几处重点指示,应该就能把问题解决了,若欲详细探究请阅读英文原文,原文出处:http://code.google.com/p/seaminaction/wiki/DeployingToJBossAS5

 

DeployingToJBossAS5

在JBoss 5上部署Seam应用程序   


Provides guidance for running the sample application on JBoss AS 5

 

Overview

JBoss AS 5 is a fully compliant Java EE 5 application server. It was first released to the community in December 2008, post dating the release of the book by several months. This page documents migration problems that may be encountered running the sample application on JBoss AS 5 and guidance on how to get the deployment working.


Persistence unit problems

If you take the WAR version of the sample application and attempt to deploy it to JBoss AS 5, you likely get the following exception when you attempt to look at a listing page:

如果您将WAR版本的样例应用程序部署到JBoss AS 5上,在运行时,可能会得到如下的错误提示:

Caused by: java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: Facility is not mapped [select facility from Facility facility]

 

The problem stems from the fact that JBoss AS 5 handles the deployment of persistence units different than JBoss AS 4. Namely, JBoss AS 5 will load any persistence unit defined in META-INF/persistence.xml automatically. That means when Seam loads the persistence unit, there are now two runtime instances of the persistence unit. (In addition, JBoss AS 5 doesn't scan for entity classes in WEB-INF/classes when bootstrapping the persistence unit manually or in Seam). Either way, you only need to load the persistence unit once.

To fix the problem of how the persistence unit is loaded, make the following changes to the project.

要解决持久化单元的加载问题,须对项目的某些配置进行更改,接下来将教您具体如何做:

  • Instruct the Hibernate JPA provider to bind the runtime persistence unit to JNDI by adding this property to the resources/META-INF/persistence-*.xml files
  • 往/META-INF/persistence-*.xml配置文件中添加属性
<property name="jboss.entity.manager.factory.jndi.name" value="java:/open18EntityManagerFactory"/>
 

 

  • Disable the Seam-managed persistence unit in resources/WEB-INF/components.xml (or just remove this component definition altogether)
  • 修改/WEB-INF/components.xml中的配置节(或者干脆把这个配置节删除)
<persistence:entity-manager-factory name="open18EntityManagerFactory" persistence-unit-name="open18" installed="false"/>
 

 

  • Switch the Seam-managed persistence context to use the persistence unit in JNDI by modifying this component definition in resources/WEB-INF/components.xml
  • 修改/WEB-INF/components.xml中的配置节
<persistence:managed-persistence-context name="entityManager" auto-create="true" entity-manager-factory="#{open18EntityManagerFactory}" persistence-unit-jndi-name="java:/open18EntityManagerFactory"/>
 


This solution may seem a bit "hackish" because you are resorting to the proprietary JNDI binding that I spoke about in chapter 9. If you want to do it right, simply follow the instructions I give in chapter 9 for binding a persistence unit to JNDI on a Java EE 5 compliant server. Namely, define a persistence unit reference in web.xml:

<persistence-unit-ref>
    <persistence-unit-ref-name>open18/emf</persistence-unit-ref-name>
    <persistence-unit-name>open18</persistence-unit-name>  
</persistence-unit-ref>
 

Then use the following JNDI name in components.xml to refer to it:

java:comp/env/open18/emf

Retrieving the persistence unit runtime from JNDI is the only way in JBoss AS 5 to ensure the persistence unit loads once and Seam uses it. I am not sure at this point how to prevent JBoss AS 5 from automatically loading the persistence unit.

GlassFish handles this more correctly, in my mind. If the persistence unit reference is not defined in web.xml, then GlassFish doesn't load the persistence unit.


Further explanation

The reason this problem crops up is because Seam was designed under the assumption that the application server would not load persistence units in a WAR project (I talk about this in depth in chapter 9). JBoss AS 5 is compliant with Java EE 5 and therefore does load the persistence unit (well, the spec is loose here and JBoss AS 5 doesn't wait for a persistence unit reference to give the green light).


Resources

  • Running Seam Examples on JBoss AS - This page on the seamframework.org Knowledge Base gives the latest status of running the Seam distribution examples on JBoss AS. You'll notice that most problems surround the persistence issue described above.
第三方支付功能的技术人员;尤其适合从事电商、在线教育、SaaS类项目开发的工程师。; 使用场景及目标:① 实现微信与支付宝的Native、网页/APP等主流支付方式接入;② 掌握支付过程中关键的安全机制如签名验签、证书管理与敏感信息保护;③ 构建完整的支付闭环,包括下单、支付、异步通知、订单状态更新、退款与对账功能;④ 通过定时任务处理内容支付超时与概要状态不一致问题:本文详细讲解了Java,提升系统健壮性。; 阅读应用接入支付宝和建议:建议结合官方文档与沙微信支付的全流程,涵盖支付产品介绍、开发环境搭建箱环境边学边练,重点关注、安全机制、配置管理、签名核心API调用及验签逻辑、异步通知的幂等处理实际代码实现。重点与异常边界情况;包括商户号与AppID获取、API注意生产环境中的密密钥与证书配置钥安全与接口调用频率控制、使用官方SDK进行支付。下单、异步通知处理、订单查询、退款、账单下载等功能,并深入解析签名与验签、加密解密、内网穿透等关键技术环节,帮助开发者构建安全可靠的支付系统。; 适合人群:具备一定Java开发基础,熟悉Spring框架和HTTP协议,有1-3年工作经验的后端研发人员或希望快速掌握第三方支付集成的开发者。; 使用场景及目标:① 实现微信支付Native模式与支付宝PC网页支付的接入;② 掌握支付过程中核心的安全机制如签名验签、证书管理、敏感数据加密;③ 处理支付结果异步通知、订单状态核对、定时任务补偿、退款及对账等生产级功能; 阅读建议:建议结合文档中的代码示例与官方API文档同步实践,重点关注支付流程的状态一致性控制、幂等性处理和异常边界情况,建议在沙箱环境中完成全流程测试后再上线。
matlab2python 这是一个Python脚本,用于将Matlab文件或代码行转换为Python。此项目处于alpha阶段。 该实现严重依赖于Victor Leikehman的SMOP项目。 当前实现围绕SMOP构建,具有以下差异: 力图生成不依赖libsmop的代码,仅使用如numpy这样的标准Python模块。 使用常见缩写如np而非全称numpy。 尝试重排数组和循环索引,从0开始而不是1。 不使用来自libsmop的外部类matlabarray和cellarray。 增加了对Matlab类的基本支持,类体中声明的属性在构造函数中初始化。 因上述改动,产出代码“安全性较低”,但可能更接近用户自然编写的代码。 实现相对直接,主要通过替换SMOP使用的后端脚本,这里称为smop\backend_m2py.py。 一些函数替换直接在那里添加。 额外的类支持、导入模块以及其他微调替换(或说是黑客技巧)在matlabparser\parser.py文件中完成。 安装 代码用Python编写,可按如下方式获取: git clone https://github.com/ebranlard/matlab2python cd matlab2python # 安装依赖项 python -m pip install --user -r requirements.txt # 让包在任何目录下都可用 python -m pip install -e . # 可选:运行测试 pytest # 可选:立即尝试 python matlab2python.py tests/files/fSpectrum.m -o fSpectrum.py 使用方法 主脚本 存储库根目录下的主脚本可执行,并带有一些命令行标志(部分直接取自SMOP)。要将文件file.m转换为file.py,只需输入:
【信号识别】识别半监督粗糙模糊拉普拉斯特征图(Matlab代码实现)内容概要:本文档围绕“信号识别”主题,重点介绍了基于半监督粗糙模糊拉普拉斯特征图的信号识别方法,并提供了完整的Matlab代码实现。该方法结合了半监督学习、粗糙集理论、模糊逻辑与拉普拉斯特征映射技术,用于提升在标签样本稀缺情况下的信号分类性能,尤其适用于复杂背景噪声下的信号特征提取与识别任务。文中详细阐述了算法原理、数学模型构建过程及关键步骤的编程实现,旨在帮助科研人员深入理解并应用该混合智能识别技术。; 适合人群:具备一定信号处理基础和Matlab编程能力的研究生、科研人员及从事通信、雷达、电子系统等领域工程开发的技术人员;熟悉机器学习与模式识别的基本概念者更佳; 使用场景及目标:①应用于低标注成本、高噪声环境下的信号分类任务,如雷达信号识别、通信信号监测等;②用于学术研究中对半监督学习与特征降维融合方法的探索与性能验证;③作为撰写相关领域论文或项目开发的技术参考与代码基础; 阅读建议:建议读者结合文档中的理论推导与Matlab代码逐段分析,动手运行并调试程序以加深理解;可尝试在不同信号数据集上进行实验对比,进一步优化参数设置与模型结构,提升实际应用场景下的识别精度与鲁棒性。
基于Python的织物表面缺陷检测系统源代码 本资源提供了一套完整的织物表面质量检测系统实现方案,采用Python编程语言开发。该系统通过计算机视觉技术,能够自动识别织物生产过程中产生的各类表面瑕疵,适用于纺织行业的质量控制环节。 系统核心功能包括图像预处理、特征提取、缺陷分类与定位。预处理模块对采集的织物图像进行标准化处理,包括灰度化、噪声滤除和对比度增强,以优化后续分析条件。特征提取环节采用多种算法组合,有效捕捉纹理异常、色差、孔洞、污渍等常见缺陷的视觉特征。 缺陷识别部分整合了传统图像处理技术与机器学习方法,实现对瑕疵类型的准确分类与严重程度评估。系统支持实时检测与批量处理两种模式,可集成于生产线进行在线质量监控,亦可用于离线样本分析。 代码结构清晰,包含完整的模型训练脚本与推理接口,并附有详细注释说明各模块功能与参数配置方法。用户可根据实际生产环境中的织物材质与缺陷类型,调整特征参数与分类阈值,以提升检测精度。 该系统为纺织制造业提供了一种高效、自动化的表面质量检测解决方案,有助于减少人工检验成本,提高产品合格率与生产一致性。所有功能模块均基于开源库实现,无需依赖特定硬件设备,具备较高的可移植性与扩展性。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值