简体   繁体   English

在TomEE 7 Plume中升级JSF库的正确方法是什么?

[英]What is the correct way to upgrade JSF library in TomEE 7 Plume?

I have seen that Mojarra 2.3 was released in June. 我已经看到Mojarra 2.3在6月发布。 What is the right way to make the upgrade? 进行升级的正确方法是什么?

  • In my pom.xml? 在我的pom.xml中? Where basically I only have 基本上我只有

     <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> 
  • Or in my server? 还是在我的服务器上? I am using TomEE 7 plume, so should I manually download the JAR, delete lib/tomee-mojarra-7.0.0.jar (which is JSF 2.2 compliant ) and place the new JAR there? 我正在使用TomEE 7羽状流,因此我应该手动下载JAR,删除lib/tomee-mojarra-7.0.0.jar符合JSF 2.2 )并将新的JAR放在那里吗? I am actually not sure this is appropriate, so I fear an answer that tells to wait until TomEE updates its library. 我实际上不确定这是否合适,因此我担心会有一个答案告诉您等待TomEE更新其库。

JSF 2.3 isn't released yet. JSF 2.3尚未发布。 The final release is scheduled for H1 2017, along with Java EE 8. Perhaps you're referring to a milestone (beta) version which should be recognizable by mXX suffix in the file name such as javax.faces-2.3.0-m06.jar for the current one. 最终版本计划与Java EE 8一起在2017年上半年发布。也许您所指的是里程碑(测试版)版本,该版本应可以通过文件名如javax.faces-2.3.0-m06.jarmXX后缀识别javax.faces-2.3.0-m06.jar 当前的 javax.faces-2.3.0-m06.jar JSF 2.3 is currently still a work in progress. JSF 2.3目前仍在开发中。 Eg CDI producers for JSF artifacts such as @Inject FacesContext were only added in m04 , new JSF 2.3 <f:websocket> was only added in m05 , new JSF 2.3 <h:commandScript> was only added in m06 and the upcoming m07 will feature among others the new <f:importConstants> . 例如CDI生产者JSF工件,比如@Inject FacesContext只在加入m04 ,新的JSF 2.3 <f:websocket>仅在加入m05 ,新的JSF 2.3 <h:commandScript>在仅加入m06和即将到来的m07将采用除其他外,新的<f:importConstants> And so on. 等等。

Basically, you need to wait for Java EE 8 to be released and that your server vendor offers a Java EE 8 compatible server. 基本上,您需要等待Java EE 8发布,并且您的服务器供应商将提供与Java EE 8兼容的服务器。 In case of TomEE, that would be the fictive future TomEE 8 version. 如果是TomEE,那将是未来的TomEE 8虚拟版本。 In this case, you can simply upgrade the server and update the Java EE version in pom.xml to 8.0 . 在这种情况下,您可以简单地升级服务器并将pom.xml的Java EE版本更新为8.0

Manually upgrading Mojarra in the server is however also possible. 但是,也可以在服务器中手动升级Mojarra。 How to do that depends on the server used. 具体操作取决于所使用的服务器。 In case of TomEE 7.0.1 Plume, it should theoretically be a matter of replacing the existing /lib/javax.faces-2.2.12.jar file with the newer one. 对于TomEE 7.0.1 Plume,从理论上讲,应该用较新的文件替换现有的/lib/javax.faces-2.2.12.jar文件。 Theoretically, because when I tried it, it appears that OpenWebBeans didn't like it. 从理论上讲,因为当我尝试时,OpenWebBeans似乎不喜欢它。 I got the below exception when deploying a JSF enabled project (just an empty WAR with an empty faces-config.xml file). 部署启用JSF的项目(只是带有空faces-config.xml文件的空WAR)时,出现以下异常。

java.lang.NullPointerException
    at java.util.concurrent.ConcurrentHashMap.putVal(ConcurrentHashMap.java:1011)
    at java.util.concurrent.ConcurrentHashMap.put(ConcurrentHashMap.java:1006)
    at org.apache.webbeans.portable.AnnotatedElementFactory.setAnnotatedType(AnnotatedElementFactory.java:154)
    at org.apache.webbeans.container.BeanManagerImpl.addAdditionalAnnotatedType(BeanManagerImpl.java:1292)
    at org.apache.webbeans.portable.events.discovery.BeforeBeanDiscoveryImpl.addAnnotatedType(BeforeBeanDiscoveryImpl.java:134)
    at com.sun.faces.cdi.CdiExtension.beforeBean(CdiExtension.java:95)
    ... 29 more

It appears that more work is necessary in order to figure out if this is an issue in OWB or in Mojarra. 为了弄清楚这是OWB还是Mojarra中的问题,似乎还需要做更多的工作。 So far, Mojarra's CDI functionality has only been tested with Weld (in GlassFish/Payara and WildFly). 到目前为止,Mojarra的CDI功能仅通过Weld(在GlassFish / Payara和WildFly中)进行了测试。 For now, you unfortunately can't use JSF 2.3 on TomEE 7 yet. 不幸的是,到目前为止,您还不能在TomEE 7上使用JSF 2.3。

Note that in such case editing the pom.xml is not necessary. 请注意,在这种情况下,无需编辑pom.xml Only in order to have proper sources auto-attached during debugging in the IDE, you'd need to explicitly add the desired coordinate with target scope set to provided . 仅为了在IDE调试期间自动附加适当的源,您需要显式添加所需的坐标,并将目标范围设置为provided

<dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.faces</artifactId>
    <version>2.3.0-m06</version>
    <scope>provided</scope>
</dependency>

This applies to any Mojarra version nonetheless. 但这仍然适用于任何Mojarra版本。

See also: 也可以看看:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM