- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 EJB3.1 和 Glassfish 3.1 在 NetBeans 7 中进行开发。
我正在尝试从 WAR 中的 POJO 中引用 JAR 中 session Bean 的本地接口(interface)。
当我部署到 Glassfish 时,我收到:
SEVERE: Unresolved <ejb-link>: TaskTool-ejb#ContextFacade
SEVERE: Exception while deploying the app [com.oracle.eas_TaskTool-ear_ear_1.0-SNAPSHOT]
SEVERE: Error: Unresolved <ejb-link>: TaskTool-ejb#ContextFacade
<ejb-local-ref>
web.xml 中的部分对我来说。
@Local
public interface ContextFacadeLocal {
void create(Context context);
void edit(Context context);
void remove(Context context);
Context find(Object id);
List<Context> findAll();
List<Context> findRange(int[] range);
int count();
List<Context> findRootContexts();
}
@Stateless
public class ContextFacade extends AbstractFacade<Context> implements ContextFacadeLocal {
@PersistenceContext(unitName = "TaskToolPU")
private EntityManager em;
protected EntityManager getEntityManager() {
return em;
}
public ContextFacade() {
super(Context.class);
}
@Override
public List<Context> findRootContexts() {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<Context> query = builder.createQuery(Context.class);
Root<Context> c = query.from(Context.class);
query.select(c).where(builder.isNull(c.get("parent")));
query.orderBy(builder.asc(c.get("id")));
TypedQuery<Context> q = em.createQuery(query);
return q.getResultList();
}
}
@FacesConverter(value = "contextConverter")
public class contextConverter implements Converter {
ContextFacadeLocal contextFacade = lookupContextFacadeLocal();
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
return contextFacade.find(string);
}
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {ntityManager() {
return em;
}
public ContextFacade() {
super(Context.class);
}
@Override
public List<Context> findRootContexts() {
CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery<Context> query = builder.createQuery(Context.class);
Root<Context> c = query.from(Context.class);
query.select(c).where(builder.isNull(c.get("parent")));
query.orderBy(builder.asc(c.get("id")));
TypedQuery<Context> q = em.createQuery(query);
return q.getResultList();
}
}
@FacesConverter(value = "contextConverter")
public class contextConverter implements Converter {
ContextFacadeLocal contextFacade = lookupContextFacadeLocal();
@Override
public Object getAsObject(FacesContext fc, UIComponent uic, String string) {
return contextFacade.find(string);
}
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
return ((Context) o).getId().toString();
}
private ContextFacadeLocal lookupContextFacadeLocal() {
try {
javax.naming.Context c = new InitialContext();
//return (ContextFacadeLocal) c.lookup("java:global/com.oracle.eas_TaskTool-ear_ear_1.0-SNAPSHOT/com.oracle.eas_TaskTool-ejb_ejb_1.0-SNAPSHOT/ContextFacade!com.oracle.eas.ejbs.ContextFacadeLocal");
return (ContextFacadeLocal) c.lookup("java:comp/env/TaskTool-ejb#ContextFacade");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<web-app 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/web-app_3_0.xsd">
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
<ejb-local-ref>
<ejb-ref-name>ContextFacade</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>com.oracle.eas.ejbs.ContextFacadeLocal</local>
<ejb-link>TaskTool-ejb#ContextFacade</ejb-link>
</ejb-local-ref>
</web-app>
<ejb-link>TaskTool-ejb/ContextFacade</ejb-link>
或
<ejb-link>com.oracle.eas_TaskTool-ejb_ejb_1.0-SNAPSHOT/ContextFacade</ejb-link>
作品。
最佳答案
我在尝试部署我的应用程序时遇到了同样的问题,NetBeans 自己在我的 web.xml 中生成了这段代码。
检查你的 web.xml,看看你是否看到这个:
<ejb-local-ref>
<ejb-ref-name>appName</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<ejb-link>AppName#SomeClass</ejb-link>
</ejb-local-ref>
关于jakarta-ee - 未解决 <ejb-link>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6369628/
我需要审核 ejb bean 的调用。说审计我的意思是将当前登录的用户、方法名称、附加描述等信息写入数据库。我决定使用 CDI 装饰器来做到这一点: @Decorator public class A
当我使用 EJB 3.0 部署 Web 应用程序时,我看到了以下警告: WARNING: jar 'E:\mws\MCDS\portal\portal-web\target\portal-web-1.
我正在学习 EJB,当尝试使用 junit 测试它时,出现以下错误 cd.espoirmur.Ejb.InterfaceEjbLocal_80488159 Jun 03, 2016 10:33:58
是否可以在另一个 EJB 中使用 @EJB?我现在正在尝试这样做,但我的 EJB 最终为空。我将在示例中概述我的问题。 @Stateless @LocalBean @Local(LoginServic
我已通读 article试图理解为什么要在客户端和实体 bean 之间有一个 session bean。是不是因为让客户端直接访问实体bean,就让客户端对数据库一清二楚了? 因此,通过使用中间人(
我们正在尝试在具有两个节点的以域模式运行的 Wildfly 中查找远程 EJB。 设置是这样的: Wildfly 节点 1: 模块 A:EJB 客户端 模块 B:远程 EJB Wildfly 节点 2
我正在使用 Jboss 7,并且有两个单独的部署,它们都包含单例 EJB。 我需要一个 EJB 才能访问另一个 EJB 并能够调用其方法,但是,当应用程序服务器启动并尝试部署它们时,它似乎无法保证哪个
可能最好的方法是手动完成。但是在大型项目中,您需要一些工具来帮助您。正是这个想法促使我搜索了一个工具。 是否有任何 EJB 迁移工具可用于将 EJB 2.0 迁移到 3.x。 最佳答案 它的开发时间很
I am migrating Ejb 2.1 to Ejb 3.1. I changed Java Version from 1.6 to 1.8, and Ejb Version from 2.1
我已经使用 @ActivationConfigProperty 配置了消息目标类型、名称等。在 EJB 3.0 中,但我想配置 MDB使用部署描述符 ( ejb-jar.xml ),就像在 EJB 2
假设我有两个 EJB jar:A.jar 和 B.jar。我可以使用 CDI 将不是 EJB 的实用程序类 Autil 注入(inject) A.jar 中的 POJO 到 B.jar 中的 EJB
我有一个需要配置不同的现有项目。这需要在没有重大代码更改的情况下发生。我实际上希望我只能通过配置以某种方式做到这一点。在过去的 2 到 3 天里,我一直在阅读我能找到的关于这个问题的所有内容。我了解
我有一个非常简单的带有maven的ejb 3.0模块,它只有两个 session bean,一个是无状态的,另一个是单例的...当我尝试在Glassfish 3.0服务器上部署该项目时,我得到了这个异
我们在微服务中看到的是一个孤立的组件,通过协议(protocol)通过网络与该组件的父消费者进行通信。 我们在 EJB 1.0 中看到了非常相似的模式。 我的问题是:微服务架构模式是否类似于 EJB
我在 Java EE6 Singleton Session Bean 中有一个方法,它每 30 秒由 @Schedule(...) 计时器调用。这按预期工作,直到在方法中抛出并捕获异常(异常在 try
我正在 JDeveloper 11.1.1.4 中开发一个 JAX-WS WebService,它应该使用之前部署到 WebLogic 服务器的 JAR 中的 EJB。 WebService项目和EJ
我正在尝试使用 JAX-RS 注释将一些 EJB 公开为 REST Web 服务。当我部署 war WEB-INF/lib 中包含 EJB Jar 的文件到 Wildfly 8,我可以在 Web 管理
我是 EJB 方面的新手,但我已经获得了 EJB 级别的提升。 该层由一个 EJB 组成,它公开可用的操作: @Stateless(name = "myejb") public class Facad
假设我想创建一个我将在未来项目中使用的库,但我还想在该库中包含引用其他 EJB 等的 EJB。该库还将包含简单的 Java 类。最好的方法是什么?在这种情况下如何定义依赖关系?我想我会用注释来定义它们
我想知道是否可以按照这些思路做一些事情: 1)服务器端(EJB类) @Statefull public class SomeEJB implements SomeEJBRemote { @Resour
我是一名优秀的程序员,十分优秀!