ejb-3.1

Add scala capabilities into an existing EJB eclipse project

你。 提交于 2019-12-07 19:29:36
问题 I have an existing EJB project set up in Eclipse Helios, and would like to slowly introduce Scala into the project. The Scala IDE has been installed successfully, and I'm able to create standalone scala project. The issue however comes when trying to use my existing project with scala additions. I've went as far as manually editing the .project, .classpath, and related files under .settings of the project's home directory for eclipse. However I still have the issue where the Java compiler

How to invoke an EJB 3.1 non-zero-arguments constructor from a servlet?

这一生的挚爱 提交于 2019-12-07 18:41:02
问题 I have a login.java servlet and, as its name says, it provides login facilities to my web application. I'm a newbie and I'm using EJB 3.1 and EE 6. In my LoginBean.java EBJ I have a no-arguments constructor and another one that has some parameters (email, password, etc). At certain point in the servlet code I have the calling to instantiate my EJB: @EJB LoginBean loginBean; I'd like to know if it's possible (and how) to call the other constructor instead of the zero-arguments one. Thanks a

Expose current progress of an @Asynchronous function to use in View

孤街浪徒 提交于 2019-12-07 17:55:29
In my JEE6-App (running on Glassfish 3.0.1) I have an EmailEJB which has to send lots of mails. The mails are sent asynchronously, so its annotated with the new EJB3.1 @Asynchronous, letting it be run in a separate Thread. Now i want the user to be informed about the current status of the method: How many mails have already been sent? Sending the mails asynchronously works fine, but i can't figure out how to let the progress be accessible from outside. Seems like my approach to do that is quite wrong, but somehow it has to be possible (maybe another approach). This is how my EmailEJB currently

Maven 2 & Packaging ejb vs jar

蓝咒 提交于 2019-12-07 17:48:55
问题 If i'm working with ejb 3.1, what's the différence between <packaging>jar</packaging> and <packaging>ejb</packaging> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-ejb-plugin</artifactId> <version>2.3</version> <configuration> <ejbVersion>3.1</ejbVersion> </configuration> </plugin> 回答1: As mentioned at http://maven.apache.org/plugins/maven-ejb-plugin/usage.html , "The plugin doesn't do any EJB specific processing during the generation of the jar except for

Arquillian vs EJB embeddable container

笑着哭i 提交于 2019-12-07 16:29:22
问题 I am trying to understand the differences between the EJBContainer class provided by Java EE 6 for embeddable unit testing of EJB modules and Arquillian. Is there a good resource or can someone help me in understanding this? Is it worth to write Arquillian tests when I could test EJBs using an embeddable container? 回答1: Full disclosure: I'm contributor of Arquillian Arquillian is a component model for integration testing . By using the EJBContainer , you bring the runtime(the container in

@Startup @Singleton instantiated twice in WebLogic (EJB 3.1)

烂漫一生 提交于 2019-12-07 14:35:55
问题 I have a class marked @Startup and @Singleton and the constructor is being called twice. Why is it being called twice? WebLogic 12.1.1 Running Locally (not cluster) @PostConstruct is also called twice when it is there Nothing relevant in XML configuration (weblogic-ejb-jar.xml et al) Here is the class: import java.util.concurrent.atomic.AtomicInteger; import javax.ejb.Singleton; import javax.ejb.Startup; @Startup @Singleton public class CacheStartupListener { static AtomicInteger count= new

How does CDI remove stateful session bean?

五迷三道 提交于 2019-12-07 03:11:57
问题 The spec says that CDI container removes a SFSB when the scope's context is about to be destroyed. How does it exactly remove the EJB? It does not seem to be calling the method annotated with @Remove. @Stateful public class CustomerDAOImpl implements CustomerDAO { @PreDestroy public void onDestroy() { //This is getting called as expected } @Remove public void deleteMyBean() { //This is not getting called! } } So, CDI is technically doing what the spec says. The question is how is it managing

Cannot run arquillian tests

耗尽温柔 提交于 2019-12-06 20:58:19
问题 I'm trying to use Arquillian for some unit tests, however I can't find why they fail when deployed using Maven. This is the class test: package com.ndeveloper.spec.test; import javax.inject.Inject; import junit.framework.Assert; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.shrinkwrap.api.ArchivePaths; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.asset.ByteArrayAsset; import org.jboss

How to invoke an EJB 3.1 non-zero-arguments constructor from a servlet?

旧街凉风 提交于 2019-12-06 14:28:18
I have a login.java servlet and, as its name says, it provides login facilities to my web application. I'm a newbie and I'm using EJB 3.1 and EE 6. In my LoginBean.java EBJ I have a no-arguments constructor and another one that has some parameters (email, password, etc). At certain point in the servlet code I have the calling to instantiate my EJB: @EJB LoginBean loginBean; I'd like to know if it's possible (and how) to call the other constructor instead of the zero-arguments one. Thanks a lot. Cheers. You don't want to do that. The one and same servlet is shared among all users, so the EJB is

How do I override the value supplied to a field annotated with @EJB?

别来无恙 提交于 2019-12-06 14:17:40
问题 Suppose I have a class like this: @Stateless @Local({ X.class }) public class XBean implements X { @EJB // name() attribute should by spec default to "foo.XBean/y", but see below private Y y; // Y is @Local } And elsewhere I have: @Stateless @Local({ Y.class }) public class YBean implements Y {} @Stateless @Local({ Y.class }) public class UnwantedYBean implements Y {} Suppose now I want (in an XML descriptor, using the minimal amount of XML) to override or explicitly specify what gets placed