ejb-3.0

how to implement a cache in ejb 3.0?

为君一笑 提交于 2020-01-22 15:38:51
问题 I have a customer who's stuck in an EJB 3.0 environment. No @Singleton, no bean-managed concurrency :-( Considering thread management and synchronization is forbidden by the ejb specification, how to implement a cache? In essence, I want an non-synchronized object cache for some costly operations. 回答1: The restriction of using static field and synchronization is stated in EJB 3.0 spec chapter 21.1.2. It also explains why. • An enterprise bean must not use read/write static fields. Using read

Glassfish 2.1 EJB 3.0 Exposing local EJB to other applications running in the same domain/jvm

ⅰ亾dé卋堺 提交于 2020-01-20 05:56:21
问题 I have an existing project that I am in need of configuring different. This needs to happen without major code changes. I am actually hoping I could somehow do this only with configuration. I have spent the past 2 to 3 days reading everything I can find on this issue. I understand the glassfish classloaders, and what is available to me. I have a current sample project that has an EJB which defines a @Local interface. The ejb is deployed inside an ejb-module as an ejb-module into the glassfish

Injecting a static EJB, nonsense?

走远了吗. 提交于 2020-01-19 05:51:47
问题 I want to write this piece of code : @Stateless public class MyEjb { @EJB private static MyOtherEjbWhichIWantStatic myOtherEjb; } It makes sense to me, that I want to inject an EJB in my class, as a static element, for various reason. Java is not very happy with that unfortunately com.sun.enterprise.container.common.spi.util.InjectionException: Illegal use of static field private static MyOtherEjbWhichIWantStatic myOtherEjb on class that only supports instance-based injection I don't get it,

How to include external jar in ejb-jar

若如初见. 提交于 2020-01-17 06:08:10
问题 How can I include external jar file in my ejb3 jar file? There is one external jar project with all helper classes and manifest.mf file. Now I have this jar in my classpath in eclipse. But when eclipse build the ejb-jar I want it to include this external jar file so in Application server when my ejb loads and run it can use classes in external jar. Right now I am adding a reference in Manifest.mf for ejb-jar, still when eclipse build the ejb-jar it is not packaging this external jar and

Can an EJB be called from a desktop application?

戏子无情 提交于 2020-01-15 05:00:27
问题 I am new in Java EJB 3.0. It is possible to call a (session) bean—deployed on JBoss—from a desktop application client? Thanks in advance. 回答1: Yes you can. Some specifics are here (references EJB2 but it the same for EJB3 when it comes to remote clients): http://www.theserverside.com/discussions/thread.tss?thread_id=9197 Paraphrased: Hashtable env = new Hashtable(); env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); env.put("java.naming.provider.url", "jnp:/

Java Persistence Issue

偶尔善良 提交于 2020-01-15 03:42:29
问题 I am trying to get a simple example up and running using JPA in an EJB through GlassFish. I have the following persistence.xml <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="default" transaction-type="RESOURCE_LOCAL"> <provider>org.eclipse.persistence.jpa

Publishing EJB's local interface in weblogic

只谈情不闲聊 提交于 2020-01-13 06:11:29
问题 is there a way to lookup an EJB in weblogic if it implements only local interface? If I use this @Remote public interface TestSessionRemote { public void businessMethod(); } @Stateless(mappedName = "A") public class TestSessionBean implements TestSessionRemote { public void businessMethod() { } } the EJB can be looked up using this name: "A#" + TestSessionRemote.class.getName() If I change the annotation for TestSessionRemote from @Remote to @Local the EJB disappears from JNDI. Is there a way

Publishing EJB's local interface in weblogic

旧城冷巷雨未停 提交于 2020-01-13 06:11:29
问题 is there a way to lookup an EJB in weblogic if it implements only local interface? If I use this @Remote public interface TestSessionRemote { public void businessMethod(); } @Stateless(mappedName = "A") public class TestSessionBean implements TestSessionRemote { public void businessMethod() { } } the EJB can be looked up using this name: "A#" + TestSessionRemote.class.getName() If I change the annotation for TestSessionRemote from @Remote to @Local the EJB disappears from JNDI. Is there a way

Glassfish v3 / JNDI entry cannot be found problems!

冷暖自知 提交于 2020-01-12 03:28:10
问题 I've been having problems trying to call an EJB's method from a Java Application Client. Here is the code. EJB Remote Interface package com.test; import javax.ejb.Remote; @Remote public interface HelloBeanRemote { public String sayHello(); } EJB package com.test; import javax.ejb.Stateless; @Stateless (name="HelloBeanExample" , mappedName="ejb/HelloBean") public class HelloBean implements HelloBeanRemote { @Override public String sayHello(){ return "hola"; } } Main class (another project)

Glassfish v3 / JNDI entry cannot be found problems!

為{幸葍}努か 提交于 2020-01-12 03:28:06
问题 I've been having problems trying to call an EJB's method from a Java Application Client. Here is the code. EJB Remote Interface package com.test; import javax.ejb.Remote; @Remote public interface HelloBeanRemote { public String sayHello(); } EJB package com.test; import javax.ejb.Stateless; @Stateless (name="HelloBeanExample" , mappedName="ejb/HelloBean") public class HelloBean implements HelloBeanRemote { @Override public String sayHello(){ return "hola"; } } Main class (another project)