ejb-3.0

EJB3 stateful concurrent calls from different clients

流过昼夜 提交于 2019-12-12 19:15:47
问题 I have a rich client swing application calling a remote stateful ejb. I'm using JBoss 6.0. I have deployed the client in two different machines, i.e, different ip address, jvms, etc. The stateful has the following code: @Stateful public class MyStateful implements MyStatefulRemote{ public void test(){ System.out.println(this); System.out.println(Thread.currentThread()); System.out.println(Thread.currentThread().getThreadGroup()); // cpu intensive task String value = ""; for (int j = 0; j <

JSP cant find bean Class using “” modifiers

不问归期 提交于 2019-12-12 15:17:05
问题 Hey I'm using Netbeans for my IDE and I'm getting an error when I try to run my EJB program. I get an error when I declare and give the path of the class in my JSP to a bean. <jsp:useBean id="book" class="BookBean.Book" scope="application" /> <jsp:setProperty name="book" property="*" /> When I run the program I get this error javax.servlet.ServletException: java.lang.InstantiationException: class BookBean.Book : java.lang.IllegalAccessException: Class java.beans.Beans can not access a member

How to handle dynamic role or username changes in JSF?

。_饼干妹妹 提交于 2019-12-12 15:13:00
问题 I have a JSF application running on glassfish 2.1 with a EJB 3 backend. For authentication I use a custom realm. The user authenticates using the e-mail-address and password he specified on registration. Everything is working quite well. Now I have two related problems: 1) The user can edit his profile and -- naturally -- he can also change his e-mail-address. Unfortunately when I perform operations based on the current user's identity using ExternalContext.getUserPrincipal().getName(), I

Does JPA support a @OneToMany mapping between entities without a foreign key constraint in the database?

我是研究僧i 提交于 2019-12-12 13:22:25
问题 This is for a legacy database. The two database tables in this relationship don't have a foreign key constraint even though the child table column holds the PK of the parent table. Does JPA support a @OneToMany mapping (either bidirectional or unidirectional) if the child table does not have a foreign key constraint on the appropriate column? 回答1: Short answer: yes . Long one: does JPA actually care about foreign keys if the database already exists? If we leave the task of creating the

@Cache annotation usage error

白昼怎懂夜的黑 提交于 2019-12-12 09:35:17
问题 I added the following annotation to enable cache to one of my EJB3 entities, to test caching with ehCache, where I use Hibernate as the persistence provider: .... import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; @Entity @Table(name = "F") @Cache(usage=CacheConcurrencyStrategy.READ_WRITE) @NamedQueries({ @NamedQuery(name = "F.findAll", query = "SELECT f FROM F f")}) public class F implements Serializable { ..... } I added the following to

How to get the invoker name in EJB interceptor's lifecycle event method

六眼飞鱼酱① 提交于 2019-12-12 08:39:29
问题 I use Java EE 5. I wrote an interceptor for all EJBs with three methods for logging: public class DefaultInterceptor { public static final String PREFIX = "!!!!!!!!!Interceptor:"; @PostConstruct public void postConstruct(InvocationContext ctx) { try { System.out.println(PREFIX + " postConstruct"); } catch (Exception ex) { throw new RuntimeException(ex); } } @PreDestroy public void preDestroy(InvocationContext ctx) { try { System.out.println(PREFIX + " predestroy"); System.out.println(PREFIX +

EJB Factory Class

对着背影说爱祢 提交于 2019-12-12 08:17:40
问题 I'm trying to create an EJB factory class, which works like this: You have a method which takes as argument a class of an EJB, then it checks whether the EJB has a remote interface (if not throw an exception) and if it does, it returns the concerning EJB. The code below does exactly this. However the object it returns is of the type of the remote interface of the concerning bean and not of the bean itself. How can I change this? Is there a way to tell Java that the generic type T is of the

Migrating from EJB3 to Spring, Hibernate

♀尐吖头ヾ 提交于 2019-12-12 08:08:32
问题 We have a desktop based application based upon EJB3, Oracle 10 and JBoss 4. This was created around three years back. JPA entities were used for ORM and the business logic was implemented in the Stateless Session beans. The client was developed using Swing API. Now there is a requirement to replace the previous technology with Spring, Hibernate and JBoss for the next release of application. Client will still be in Swing. The plan is to replace the entities with POJOs and put the business

JPA entity is not correctly passed from EJB to Presentation Tier

独自空忆成欢 提交于 2019-12-12 06:37:42
问题 I am trying to pass a set of JPA entity from the business tier to the presentation tier. All is deployed on the same app server (Glassfish 4). The client is deployed as a .war file, while the Business Tier as an .ear with the ejb reachable trough a Remote interface. For this I have those very simple methods, with absolutely no logic: Client public List<CompletedDesign> selectCompletedDesigns() { try { List<CompletedDesign> designs = customerFacade.selectCompletedDesigns(); return designs; }

Can't deploy Maven jar (MDB) on Jboss 6

风格不统一 提交于 2019-12-12 06:04:13
问题 I am using jboss6, message driven bean, hibernate and maven2 in my application when i try to compile my mdb using maven2 and deploy on jboss6 i get the following error: Failed to create Resource MessageBean.jar - cause: java.lang.Exception:Failed to start deployment [vfs:///opt/jboss6/server/default/deploy/MessageBean.jar] during deployment of 'MessageBean.jar' - cause: java.lang.RuntimeException:org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments