ejb

到底EJB是什么

纵饮孤独 提交于 2020-01-01 23:17:32
  到底EJB是什么?被口口相传的神神秘秘的,百度一番,总觉得没有讲清楚的,仍觉得一头雾水。百度了很久,也从网络的文章的只言片语中,渐渐有了头绪。   用通俗话说,EJB就是:"把你编写的软件中那些需要执行制定的任务的类,不放到客户端软件上了,而是给他打成包放到一个服务器上了"。是的,没错!EJB 就是将那些"类"放到一个服务器上,用C/S 形式的软件客户端对服务器上的"类"进行调用。快崩溃了吧!这么几句就非常清楚的解释了EJB是什么(也是本人在高人的博文里看来的),而很多文章总是执着于解释EJB原理,EJB出现的意义。      再次将这篇费了很大力气找的文章地址贴出来,博文对EJB的原理和实质的解释非常清晰: http://blog.csdn.net/jojo52013145/article/details/5783677   另外,EJB的出现引起很大的争议,这里一片引用一篇,04年的,有点老了,但其对自己的看法做了详细的阐述: http://cache.baidu.com/c?m

EJB到底是什么?

拈花ヽ惹草 提交于 2020-01-01 23:17:12
1. 我们不禁要问,什么是"服务集群"?什么是"企业级开发"? 既然说了EJB 是为了"服务集群"和"企业级开发",那么,总得说说什么是所谓的"服务集群"和"企业级开发"吧!这个问题其实挺关键的,因为J2EE 中并没有说明白,也没有具体的指标或者事例告诉广大程序员什么时候用EJB 什么时候不用。于是大家都产生一些联想,认为EJB"分布式运算"指得是"负载均衡"提高系统的运行效率。然而,估计很多人都搞错了,这个"服务群集"和"分布式运算"并没有根本解决运行负载的问题,尤其是针对 数据库 的应用系统。 为什么? 我们先把EJB 打回原形给大家来慢慢分析。 2. 把EJB 掰开了揉碎了 我们把EJB 的概念好好的分析一下,看看能发现些什么蛛丝马迹。 3.1 EJB 概念的剖析 我们先看一下,EJB 的官方解释: 商务软件的核心部分是它的业务逻辑。业务逻辑抽象了整个商务过程的流程,并使用计算机语言将他们实现。 …… J2EE 对于这个问题的处理方法是将业务逻辑从客户端软件中抽取出来,封装在一个组件中。这个组件运行在一个独立的服务器上,客户端软件通过网络调用组件提供的服务以实现业务逻辑,而客户端软件的功能单纯到只负责发送调用请求和显示处理结果。在J2EE 中,这个运行在一个独立的服务器上,并封装了业务逻辑的组件就是EJB(Enterprise Java Bean)组件

How do I specify a server to get an EJB from?

↘锁芯ラ 提交于 2020-01-01 17:26:13
问题 In java EE, the way you get an EJB from a remote server is by looking it up in JNDI. The specification defines the JNDI name for a given bean type. However, this seems to be only if you want to get a bean off your local computer. I want to get the bean off a remote server, like most users would. How do I specify the server URL? Do I pass a map to the InitialContext constructor? Note: There is another question that is pretty much the same, but that has become out of date since the definition

Transaction fails with IJ000457, IJ000461 and IJ000356 on first time, but works thereafter

Deadly 提交于 2020-01-01 17:11:13
问题 I am trying to run JSF application with JPA on Wildly server, I have the following code, there is an exception when trying to add employee at first time, but when trying another time, it works fine, I did not find the reason, please help. session bean: import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContextType;

Inject EJB in Jersey filter

扶醉桌前 提交于 2020-01-01 09:27:14
问题 I am currently developing an application with Jersey JAX-RS as backend and AngularJS as frontend ; I need a sort of authentication, and so with every request I send a token that should be verify by the backend. For this, I decided to create a Jersey filter that will look for that token, and then call my AuthenticateService to check if the user can be authenticated. Authorization is then managed by @RolesAllowed annotation. Here is my problem : I can't inject an EJB inside a Jersey filter,

Why throwing an EJBException is a “recommended” practice?

こ雲淡風輕ζ 提交于 2020-01-01 08:43:52
问题 I keep getting this "suggestion" from many fellow developers over and over again. In my experience I've found that EJBExceptions are well-suited for "end of the world" from the bean instance perspective (like when something is so wrong that the bean instance cannot recover by itself). If an instance can recover, I think it's better to throw an application exception. Here is the pattern that I meet over and over again: private SomeResource resource; ejbCreate: resource = allocateResource(...);

Gradle: Could not find method provided()

血红的双手。 提交于 2020-01-01 05:15:30
问题 Which is preferred, provided or provided group and where is this documented? thufir@doge:~/NetBeansProjects/gradleEAR$ thufir@doge:~/NetBeansProjects/gradleEAR$ gradle clean FAILURE: Build failed with an exception. * Where: Build file '/home/thufir/NetBeansProjects/gradleEAR/build.gradle' line: 40 * What went wrong: A problem occurred evaluating root project 'gradleEAR'. > Could not find method provided() for arguments [javax:javaee-api:7.0] on object of type org.gradle.api.internal.artifacts

How singleton is javax.ejb.Singleton in a clustered environment?

↘锁芯ラ 提交于 2020-01-01 03:03:18
问题 I need to maintain a simple counter that is unique within the application, for all users and all nodes in a clustered environment. I thought about using the singleton session bean annotation javax.ejb.Singleton like so: package foo; import javax.ejb.Singleton; @Singleton public class Bean { private int counter; [...] } This looks simple, but I could not find an answer if this works as desired in a clustered environment. Would every node of the cluster have it's own instance or not? Of course

websphere(was)

本小妞迷上赌 提交于 2020-01-01 01:25:40
使用中的区别 1、对技术的支持: Tomcat不支持EJB,JBoss是实现了EJB容器,再集成了Tomcat。 WebSphere都是对业内多种标准的全面支持,包括EJB、JSB、JMS、JDBC、XML和WML,使Web应用系统的实施更为简单,并且保护了投资,同时也使基于标准的解决方案的开发更加简便。 2、应用范围的区别: Tomcat 是一个小型的轻量级应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试JSP 程序的首选。 WebSphere是商业软件,功能齐全强大,主要应用于大型企业的大型项目。 3、商业服务和技术支持的区别: Tomcat都是开源免费的,所有它俩也就没有任何商业服务和技术支持,而WebSphere的技术文档和相关服务还是很到位,如果你的服务器哪一天出问题了,只要你能出的起钱,他们的技术工程师立刻就能出现在你面前。 4、安全性问题: Tomcat都是开源的,所以它们的安全性相对来说比较低,万一应用服务器本身有什么漏洞,你是没办法向Apache索赔的。 WebSphere其容错、系统管理和安全性能已经在全球数以千记的关键任务环境中得以验证。 来源: CSDN 作者: 小刀_cs 链接: https://blog.csdn.net/figo8875/article/details/103762781

Exception not cuaght with Entity Manager

て烟熏妆下的殇ゞ 提交于 2019-12-31 06:38:31
问题 I have an Entity Manager in my EJB @PersistenceContext(unitName = "cnsbEntities") private EntityManager em; I populate an object and then I commit it in my DB, but if I have an exception, for duplicate ID, I can't catch it and I don't know why. try{ em.merge(boelLog); } catch (Exception e){ System.out.println("Generic Exception"); } 回答1: JPA uses transactions to send entity modifications to the database. You can specify those transactions manually through Bean Managed Transactions (BMT) or