ejb

use JTA transaction or not?

非 Y 不嫁゛ 提交于 2019-12-21 04:27:38
问题 I am developing a J2EE application which is deployed on JBoss application server. The application is composed of an EJB 2.x component and a web component and is running on local computer or remote server. The database is either Oracle or SQL Server and is not in a distributed envrionment. I am using Hibernate 3.6 (JPA 2.0 implementation) for the transactions. Should I use JTA which is container managed transaction or is it overkilled to use it? Currently I am using JTA and it turns out it is

NamedQuery: IllegalArgumentException (Query not found) after externalizing entities

岁酱吖の 提交于 2019-12-21 03:42:17
问题 I have successfully used javax.persistence.NamedQuery in combination with JPA2. The named queries are defined at the top of the entity class files, and are used from Stateless EJBs (entity facade). Now I had to extract the entity class files into a separate Jar file (so we can use them from a Google Web Toolkit project). Obviously I still incude the jar, but now the facade bean does not find the query anymore: java.lang.IllegalArgumentException: NamedQuery of name: Store.findByExternalId not

Java EE, EJBs File handling

假如想象 提交于 2019-12-21 02:50:16
问题 I'm developing a web application in which users are allowed to upload pictures, the system will then generate thumbs for them. My problem relies on the fact that EJBs can be distributed on several servers and thus are not allowed to handle files directly. I could store the images in the databases but I was hoping to store them as files in one of the servers. How can I do this? Is there any way to centralize the storage of files? Or any approach to deal with files in Java EE with EJBs?

Clustered EJBs not being balanced in JBoss AS 7

牧云@^-^@ 提交于 2019-12-21 02:39:07
问题 I've successfully setup a cluster of 2 JBoss AS 7 instances, and deployed the following SLSB: @Stateless @Remote(TestEJBRemote.class) @Clustered public class TestEJB implements TestEJBRemote { private static final long serialVersionUID = 1L; private static final Logger logger = Logger.getLogger(...); @Override public void test() { String nodeName = System.getProperty("jboss.node.name"); logger.info(nodeName); } } From the log files I can see that the bean is correctly deployed on the cluster.

EJB通过注解方式注入并使用其它EJB或者服务、配置JBoss数据源

随声附和 提交于 2019-12-20 21:16:11
版权声明:本文为博主原创文章,转载请注明出处。 https://blog.csdn.net/Jerome_s/article/details/37103171 通过注解方式注入并使用其他EJB 或者服务 真实项目EJB对象非常多,EJB之间也能够互相调用, 在项目HelloWorld下新建接口 Other 在cn.hqu.ejb3下: public interface Other { public abstract String sayMe(); } 新建实现类 OtherBean 在cn.hqu.ejb3下: public class OtherBean implements Other { @Override public String sayMe() { return "Other" ; } } 将Javabean变成无状态会话bean,接口默认是本地接口: @ Stateless public class OtherBean implements Other { @Override public String sayMe() { return "Other" ; } } 在HelloWorldBean调用 OtherBean 里面的方法。 获取OtherBean里面的方法: 得到一个EJB对象採用两种方法:採用JNDI查找。採用依赖注入。 通过JDNI查找:

How to run a Scheduled Method in a Cluster for one Node and for All?

我们两清 提交于 2019-12-20 20:38:45
问题 I have a Glassfish 3.1.2 that runs in a cluster and a EJB 3.1 application. And I need two kind of Scheduled Methods in my application: one kind that runs only once (on a single node) once a day and other kind that runs on all nodes (every 1-2 Minutes) -- They do NOT need to run a syncron way! The requirement is just that this kind run on every node. I have no clue how to start with this cluster - problem, is this possible with @Schedule (and how) or do I need something else? 回答1: I faced the

EJB: Avoid Transaction rollback

寵の児 提交于 2019-12-20 17:32:16
问题 When a (transactional) method of an EJB calls another (transactional) method of another EJB, and an exception is thrown in the second, but catched in the first one, it seems that the transaction is automatically rolled back when the second one returns, even if the first one catches it, is this true? how can I avoid it? The scenario is the following one: @Stateless class ClassA { @EJB ClassB objectB; methodA() { try { objectB.methodB(); } catch(Exception e) { //Here the transaction started in

EJB's and Threading

限于喜欢 提交于 2019-12-20 14:08:40
问题 From what I understand it is illegal to spawn threads from within an EJB as it may potentially interfere with the EJB's lifecycle. However, is it illegal to use predefined Java classes from the JDK which internally spawn and handle threads such as Executor within an EJB, specifically an MDB? 回答1: The biggest issue with threads and EJBs is that threads are a limited resource heavily used by the container, and thread mistakes lead to thread pool leaks that can effectively kill the whole JVM

EJB's and Threading

青春壹個敷衍的年華 提交于 2019-12-20 14:07:12
问题 From what I understand it is illegal to spawn threads from within an EJB as it may potentially interfere with the EJB's lifecycle. However, is it illegal to use predefined Java classes from the JDK which internally spawn and handle threads such as Executor within an EJB, specifically an MDB? 回答1: The biggest issue with threads and EJBs is that threads are a limited resource heavily used by the container, and thread mistakes lead to thread pool leaks that can effectively kill the whole JVM

Effect of enable-call-by-reference

荒凉一梦 提交于 2019-12-20 09:38:57
问题 I get the messages <Warning> <EJB> <BEA-010202> <Call-by-reference is not enabled for the EJB 'myEjb'. The server will have better performance if it is enabled. To enable call-by-reference, set the enable-call-by-reference element to True in the weblogic-ejb-jar.xml deployment descriptor or corresponding annotation for this EJB.> and <Warning> <EJB> <BEA-012035> <The Remote interface method: 'public abstract java.util.Collection my.sessionfassade.ejb.myFassade.myMethod(java.lang.String,java