- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试让 EJB 在文档(行)插入 MongoDB 集合时通知我的 XHTML JSF 页面。
由于对我之前问题的回答,JSF 2.3 可以正常工作:
然而,在将服务器端代码添加到我的 EJB 并尝试将我的 EAR 部署到 WildFly 12.0.0.Final 之后,我得到了 PushContext 的 java.lang.ClassNotFoundException:
Caused by: java.lang.RuntimeException: WFLYSRV0177: Error getting reflective information for class com.notifywell.ejb.FoodsCosmeticsMedicinesEJB with ClassLoader ModuleClassLoader for Module "deployment.NOTiFYwell.ear.NOTiFYwellJAR.jar" from Service Module Loader
at java.lang.Class.getDeclaredFields0(Native Method)
at java.lang.Class.privateGetDeclaredFields(Class.java:2583)
at java.lang.Class.getDeclaredFields(Class.java:1916)
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:72)
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:70)
... 13 more
Caused by: java.lang.ClassNotFoundException: javax.faces.push.PushContext from [Module "deployment.NOTiFYwell.ear.NOTiFYwellJAR.jar" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:199)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
... 18 more
在 EJB 中使用:
@Inject
@Push
private PushContext push;
包含在:
jboss-jsf-api_2.3_spec-2.3.3.SP1.jar
当我将 @Inject
添加到 @Push
时会发生这种情况。
WildFly 12 和/或 JSF 2.3 中的 CDI 有任何问题吗?
最佳答案
used in EJB:
@Inject
@Push
永远不要在 EJB 中使用面向前端的库。通过这种方式,您的 EJB 将与 JSF 前端紧密耦合,并且完全无法再用于其他前端,例如 JAX-RS、JSP/Servlet 等。
@Push
文档甚至 explicitly提到只在 WAR 端注入(inject)它。
add the 'jboss-jsf-api_2.3_spec-2.3.3.SP1.jar' to my deployed EAR/JAR:
您永远不应该将重复的类添加到运行时类路径中。它只会混淆类加载器。目标运行时 (WildFly) 本身已经提供了特定的库。您不需要从部署开始就提供它。
Any issues with CDI in WildFly 12 and/or JSF 2.3?
不适合我。 The OmniFaces showcase目前使用 JSF 2.3 运行 WildFly 12,并且 @Push
的 OmniFaces 副本工作得很好。
你只需要记住explicitly当您打算在其上使用 JSF 2.3 时,指示 WildFly 12 使用 standalone-ee8.xml
。在 IDE 中使用时也是如此。在 Eclipse 中,创建服务器时,您可以在新建服务器向导的配置文件条目中指定,默认为standalone.xml
。
如果您仍然面临类加载问题,那么这只能意味着您以其他方式弄乱了运行时类路径。这可能有更多的原因,这些原因在目前提供的信息中是看不到的。对于像你这样在类路径问题的问题中没有立即提及类路径配置的初学者(因此表明对此一无所知),最好不要乱搞运行时类路径(或“构建路径”和“库”就像在普通 IDE 中调用的那样),直到你理解它。默认情况下,Java EE 已经提供了一切开箱即用的功能,绝对不需要调整项目中的库。
保留所有默认值,在 WAR 而不是 EJB 中注入(inject) @Push
并告诉 WildFly 在 EE8 模式下运行,一切都会顺利进行。
关于WildFly 12.0.0.Final JSF 2.3 & f :websocket - Class loader issue,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49859918/
关闭。这个问题需要更多 focused .它目前不接受答案。 想要改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 2 年前。 Improve this q
1.final final修饰类,说明这个类不能被继承,是以个顶级类。 final修饰变量,说明这个变量是常量。 final修饰方法,表示这个方法不能被重写,不过可以冲在final方法。 比如有个
我喜欢使用 -Wsuggest-final-types 编译我的代码和 -Wsuggest-final-methods以便在可能使用 final 关键字以允许编译器更积极地优化的机会时收到警告。 不过
我在 Java 8 中有一个异步操作,它返回一个 onError 回调或一个 onSuccess 回调。如果操作成功与否,我需要在我的方法内部返回。所以我返回一个 boolean 值来说明这个信息。我
我正在阅读一些内容,需要对最终类和方法进行一些说明。我的理解是,将一个类声明为 final 会阻止该类被扩展。因此,是否有必要将最终类中的方法声明为最终的?在我看来,如果类不能扩展,则没有必要将方法声
有什么区别 try { // action A } catch(Exception e) { // action B } finally { // action C }
这个程序是我类(class)的最终作业,我无法弄清楚为什么我收到错误“从内部类引用的局部变量必须是最终的或有效的最终”。该程序正在运行并发线程来对# 数组进行排序,然后找到该数组的高值和低值。当我在没
C++11 added final. 终于! 我了解 final 做了两件事: 使类不可继承。 使类中的(虚拟)函数不可覆盖(在派生类中)。 这两者似乎是相互独立的。但以以下为例: class Foo
我想使用具有多个提交按钮的react-final-form构建表单,其中每个提交按钮在表单中设置不同的值。本质上,我想创建一个在呈现的HTML中看起来像这样的表单: Are you over 1
我想知道什么时候应该对变量和(或)方法使用静态、最终、静态最终参数。据我了解: final:类似于c++中的const参数。它基本上意味着值(或在方法中 - 返回值)不会改变。 静态:这意味着值(或方
我正在做一个编程类(class)项目,用于 400 行矩阵本身的矩阵乘法。我让它以顺序模式工作,该项目的目标是编写并行实现。 我有以下代码,当然,当我尝试引用内部类中的计数器 j 时,我收到一个关于
也许这是简单的问题,但我找不到答案。 声明为final的经典变量是否包含与非final变量不同的内存段? 最佳答案 我想说,谈到局部变量,基于 this answer 是不行的。 : The trut
考虑以下代码: #include class B { virtual void f() { std::cout << "Base" << '\n'; } }; class D
这个问题已经有答案了: java: Is it possible to set a lambda expression for an array of Buttons is a for loop? I
考虑这个代码片段 public class ConstantFolding { static final int number1 = 5; static final int numbe
我确定在内部类中访问的变量应该声明为final 或有效final。但在下面的情况下我很困惑。不知道是不是我理解错了。 public class MyClass { private boolea
我必须将一个 java.sql.Connection 对象传递给一个匿名内部类,这意味着我必须对它进行 final 引用。但是,我担心任何资源泄漏。 public static String foo(
我收到 SonarQube 错误:“强烈建议在此方法实现结束时调用 super.finalize(),以防父实现也必须释放一些系统资源。” 但我发现 Object 类没有实现 finalize方法。
我一般认为资源清理是在 finally block 中完成的, 最近我在一个类中发现了这个特定的代码片段,它覆盖了 Object 类'finalize()方法。 protected void fina
让我们在父类中使用这个方法: public void calculateSum(int a, final int b) { } 子类有: public void calculateSum(int a,
我是一名优秀的程序员,十分优秀!