FAQ Database Discussion Community


EntityManager not injected in Stateless Session Bean

java-ee,ejb,jboss7.x,entitymanager
I have been looking through a lot of similar questions which did not reflect my exact problem. If i overlooked that someone already had this problem solved, please let me know. I am currently migrating an old EJB 2.1 application on JBoss 3.x to EJB 3.x on JBoss 7.x. Due...

EJB entities: Best way to update a single column

java,ejb
Using EJB entities, I need to update a single column of a single row in a 100+ columns table. I usually read/load the row and make necessary updates, but that seems overwhelming as all remaining columns will be updated unnecessarily, not to mention the performance penalty. Is there a way...

Is the Microservices architectural Pattern similar to EJB 1.0?

ejb,components,microservices
What we see with microservices is an isolated component, communicating over a protocol over the wire to a parent consumer of that component. We see a very similar pattern with EJB 1.0. My question is: Is the Microservices architectural Pattern similar to EJB 1.0?...

Can Two Session Bean Implement Same Remote Interface?

java-ee,ejb,ejb-3.1,glassfish-4
I'm a newbie to ejb .I want to know is can two session beans implement the same remote(local) interface, if not why? The code example is welcome. Thanks for any help!...

How use @Ressource SessionContext right?

ejb,jaas
I need a bean for inject @Ressource SessionContext ctx with JAAS. With the SessionContext can I check the user rights about ctx.isCallerInRole("ROLE"); But what is the right Bean declaration? @Statful? @Stateless? and @SessionScope? I need a instance for every User....

ejb-example is not working properly when trying to integrate TomEE 1.7.2 with embedded Tomcat

java,ejb,jndi,openejb,tomee
I'm trying to integrate TomEE 1.7.2 to an embedded tomcat server instance along with OpenEJB 4.7.2 and OWB 1.2.7. I have created an OSGi bundle which contains them and CXF. I'm trying to test the TomEE integration using the ejb-example which is provided with TomEE. I tested the JNDI dump...

Arquillian: Attempted to register the same Observer, ServerSetupObserver multiple times

junit,ejb,cdi,wildfly-8,jboss-arquillian
I am trying to configure arquillian with wildfly but am the following Getting error in the process of running test: java.lang.RuntimeException: Could not create new instance of class org.jboss.arquillian.test.impl.EventTestRunnerAdaptor at org.jboss.arquillian.test.spi.SecurityActions.newInstance(SecurityActions.java:165)....... Caused by: java.lang.reflect.InvocationTargetException: null at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ........... Caused by: java.lang.RuntimeException: Could not create new instance...

JPA select query on ManyToMany

sql,database,java-ee,jpa,ejb
Can anybody help me with SELECT query on this ManyToMany connection? I want to select enrolled users specified by id of user in my EJB class. Course entity snippet Public class Course implements Serializable { ... @Id @GeneratedValue(strategy=GenerationType.IDENTITY) private long id; @ManyToMany @JoinTable(name="course_user", joinColumns={@JoinColumn(name="course_id", referencedColumnName="id")}, inverseJoinColumns={@JoinColumn(name="user_id", referencedColumnName="id")}) private List<User> enrolledStudents;...

Inject an EJB into a JSF managed bean

jsf,jboss,ejb,jsf-1.2
I have a war application with some JSF managed beans and EJB for some business logic. I'm using JSF 1.2, JBoss 5 and java 1.6 My managed bean: @ManagedBean(name = "managedBean") @SessionScoped public class MyManagedBean implements Serializable { @EJB(mappedName = "ejbBean") public MyEjbBean ejbBean; .... } EJB bean: @Singleton(name =...

why the deployement of .jar on JBOSS gives me :java.lang.NoClassDefFoundError?

java,eclipse,maven,jboss,ejb
I have tow maven projects: 1) named test where i have my tow interfaces: package interfaces.locals; import javax.ejb.Local; @Local public interface IClientLocal { void showClientName(); } package interfaces.Remotes; import javax.ejb.Remote; @Remote public interface IClientRemote { void showClientName(); } The pom.xmllooks like: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">...

setMessageDrivenContext is not invoked

java,java-ee,jboss,ejb,jboss5.x
I am using EJB 2.0 without annotation. I have a ejb-jar.xml like: <?xml version="1.0"?> <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd"> <ejb-jar> <enterprise-beans> <message-driven> <ejb-name>XMLEventQueueBean00</ejb-name> <ejb-class>com.test.XMLEventRequestService</ejb-class> <transaction-type>Bean</transaction-type>...

EJB - EJBTransactionRolledbackException argument type mismatch - overloaded method

ejb,jboss7.x,ejb-3.0,illegalstateexception,wildfly-8
I really need some help! By invoking an EJB that has method overloading, I'm having the following exception: javax.ejb.EJBTransactionRolledbackException: argument type mismatch Interestingly, this happens randomly and only in this overloaded method. See the structure below: // superclass public abstract class GenericService<T> { public void update(T object) throws Exception {...

RESTful services on Jboss 7 not responding

web-services,rest,jboss,ejb,resteasy
I got some application in which i try to expose some RESTful webservices. Unfortunately I'm stuck. Project builds and deploys fine but i just cannot access my services using GET requests. My war looks alike: war. war |--index.html |--WEB-INF |--web.xml |--classes |--classes here.. I got empty web.xml: <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"...

Is it possible to activate the Session Scope and Conversation Scope from the existing Request Scope?

java,java-ee,ejb,weld,conversation-scope
I have an @EJB injected bean TransactionCompleteJob. This bean has an @Asynchronous method on it asyncCompleteTransaction(Integer transactionId). When I try to make use of other injected beans and entities that are either session scoped or conversation scoped within this method I end up getting an error: WELD-001303: No active contexts...

To look an EJB , i have to deploy the implementations .jar or interfaces .jar?

java,jboss,ejb,jndi,lookup
I try to look up and EJB under jboss EAP6. I have 2 mavenized projects : Interfaces where I have justeinterfaces. Implementations where I have only the implementations of interfaces and my tests classes (I use testNG) My question is: Do I have to deploy on the server the interfaces...

WildFly8 EJB3 MySQL load driver don't work

java,mysql,ejb,wildfly
Hi I use IDE Eclipse Luna,JavaSE8.40,WildFly8.2,MySQL5.6.23 and Windows7 32bit. I would like with @Stateful bean connect do MySQL server. When I use datasource it´s work correctly(I create datasource throw webconsole). I would like connect to database without datasource.I have a problem with load the driver. This work correctly public class...

Error if the @Local annotation is used (EJB)

java,java-ee,ejb
GIT: https://github.com/AndreaCatania/libreria I have an ear file that contain two module, EJB and WAR. I have this interface for EJB @Remote public interface Library2IFace{ public String getName(); public void setName(String name); public String getText(); public void setText(String text); } All works fine. The WAR module does the lockup of the...

@Specializes for EJB

ejb,cdi,java-ee-6
I'm trying to specialize an EJB. I have package com.foo.core; @Stateless public class MyFacade { } and package com.foo.extension; @Specializes @Stateless public class MyFacade extends com.foo.core.MyFacade { } In my opinion, this should work, because the meaning of @Specializes is, that CDI should forget about the core-class and instead use...

@PostConstruct called twice on simple @Singleton @Startup bean

java,singleton,ejb,startup,postconstruct
my problem is that the @PostConstruct is called twice even though it shouldn't. I searched a lot and found similiar problems with jersey https://java.net/jira/browse/JERSEY-1883?filter=-3. However I tried to make a small example which apparently still causes the problem even without any clatter. import javax.annotation.PostConstruct; import javax.ejb.Singleton; import javax.ejb.Startup; @Singleton @Startup...

Commit and Push Enterprise Application Project into BitBucket

java,git,ejb,bitbucket
I have an Enterprise Application Project, let's call it iMe, that splits into 5 different projects: - iMe - iMeClient - iMeEJB - iMeEJBCLient - iMeWeb How can i push it into BitBucket, without having to create 5 different repositories and committing one at a time?...

What is the difference between Stateless Session Beans and Request Scoped beans

jsf,java-ee,scope,ejb,cdi
I know that Stateless Session Beans refers to EJB beans while Request Scoped refer to CDI beans (or JSF managed beans), so I will start by giving their both definitions from the Java EE Tutoriel. Stateless Session Beans definition: A stateless session bean does not maintain a conversational state with...

Is there a simple way to just select entity's id using criteria query?

java-ee,jpa,ejb,jpql
JPQL makes this kind of change very easy: Select o from Orders as o where.... Select o.id from Orders as o where.... But in Criteria Query: CriteriaBuilder builder = kem.getCriteriaBuilder(); CriteriaQuery<Orders> query = builder.createQuery(Orders.class); Root<Order> orders= query.from(Orders.class); query.select(orders); .... It looks that the select item is defined by builder.createQuery(Order.class) already...

Singleton injection order

java-ee,dependency-injection,singleton,ejb,ejb-3.0
I have the following: @Singleton public class A { @Inject private B b; @PostConstruct void initialize(){ b.someMethod(); } } @Singleton public class B { } Can we be sure that B will always be injected before A?...

Can a messagelistener or mdb be stateful?

ejb,message-driven-bean,jca,stateful
related to my question on jca inbound transaction management. How to control XAResource in inbound jca resource adapter for conversational transaction? For an inbound resource adapter I need to keep a transaction open and execute different actions in that transaction. This could be solved by making the message endpoint @Stateful,...

How to get EJB @Schedule expired date time

java-ee,ejb,ejb-3.1
Is it possible to get the date/time that the @Schedule expired? If there is a delay in running the @Schedule, then the actual expired time is in the past. e.g. A persistant timer will run missed @Schedule when the server is restarted after a shutdown. Example Job I tried. import...

How can I use Arquillian without Maven?

java,java-ee,ejb,jboss-arquillian
I'm making my first Java EE project and can't figure how to test my EJB. I've read that Arquillian is really useful to do integration tests, but it seems like using it without Maven is difficult. Could someone tell me if there is a way to use it or a...

@Schedule with CDI error:Could not get current FacesContext

java,ejb,scheduled-tasks,cdi
I'm trying to make a scheduler with the use of CDI My EJB Scheduler import java.time.LocalDateTime; import javax.ejb.Schedule; import javax.ejb.Singleton; import javax.inject.Inject; import javax.security.auth.login.LoginException; import br.com.timbrasil.bluemonster.csr.Crawler; @Singleton //@Startup public class Scheduler { @Inject private Crawler crawler; //TODO https://java.net/jira/browse/EJB_SPEC-1 @Schedule(hour="*",minute="*/1",second="0") public void downloadCsr() { System.out.println("Iniciando download dos CSRS"); LocalDateTime...

ClassCastException Error from List to Single Object

hibernate,java-ee,ejb
I have a problem to get a Single Location Object from a List. Calling getLocations() in primefaces dataTable works. And I can display all Locations. But when I want to get a Single Location from the locations List, then I get always a ClassCastException. I use JPA (Hibernate). Entity Bean:...

EJB Entity: database row is automatically updated from Entity without save in EJB

java,ejb
The method loads a user entity bean from the database and returns it, but before doing that clears the password (setting it with null). The issue is that in the database itself the password is set with null, even though I don't have a merge or any other method that...

Create an ant Ejb/Jar With all the data inside a folder

java-ee,ant,jar,ejb,ear
i've got a problem inside a Java-EE Application. Due to some choice the system is the following one: Java Class and Properties inside a Java Package. Java Package inside a Ejb Project. Ear of all the data. For creating all of this we need to use ant, i cannot use...

org.hibernate.ejb.event.EJB3MergeEventListener missing after upgrading from Hibernate 3 to 4.3.9

java,hibernate,jpa,ejb
I am trying to upgrade from Hibernate 3.6.10 to 4.3.9 (and JPA 2.0 to 2.1). Some code in my application uses the org.hibernate.ejb.event.EJB3MergeEventListener class, which used to be in the hibernate-entitymanager jar, but is missing from the 4.3.9 version. From what I can tell, it was removed as of 4.3,...

Dao, Service layer in legacy code [closed]

java,spring,ejb,cdi
This Question is about design in business layer. What is the best way to instantiate Dao or Service class in legacy code. new in every class where Dao or Service is needed is imho bad approach. They should be stateless, singletons. For sure I am not able to use Spring,...

EJB Ambiguous dependencies: How to specify which class to Inject

java,java-ee,dependency-injection,ejb,cdi
I am trying to inject an object in my EJB like this: @Stateless @Path("/auth") public class Login { @Inject UsernamePasswordCredentials credentials; The problem is the UsernamePasswordCredentials has a child class and both classes have the same qualifiers which causes an ambiguous dependencies. How do I specify that I want to...

Java EJB @Schedule annotation method is being called twice

java,java-ee,ejb,schedule
I am working on a J2EE project that, in short, sends an automated email to a user at a designated time, and allows the user to download files from the webpage that is emailed to them. It works pretty well. However, my timer method that uses the @Schedule annotation is...

EJB Interceptors and transaction lifecycle OR how to intercept a commit/failure event?

java,java-ee,ejb,cdi
I have an EJB interceptor and I follow the BCE pattern suggested by Adam Bien, that is, all EJB calls on the boundary starts and finish a transaction which means there is no nested EJB calls (there might be nested CDI injected Bean calls though, but those should be inside...

JPA Create Parent/child relationship with a lot of children

postgresql,ejb,postgis,jpa-2.1,hibernate-spatial
I am trying to store entity Track with children entities TrackPoints with JPA method create. However, to store Track with its children TrackPoints last really long - about 30 seconds. I tried GenerationType.Identity and GenerationType.SEQUENCE. If I also have Hibernate Spatial (Postgis) column, it lasts even longer - about 60...

EntityManager thread safety and Java EE

multithreading,hibernate,java-ee,ejb
I am new to the EJB and hibernate, and the following confuses me because there seems to be contradiction whenever i search for the definite answer. Question: Is it thread-safe to inject Entity manager directly into stateless bean in the following way? @Stateless public class SomeBean implements SomeInterface { //.....

Get Observer pattern on EJBs working on my web app

java,java-ee,annotations,ejb,observer-pattern
I am trying to get the EJB Observer pattern to work and it seems very straight forward from examples like this: http://www.devchronicles.com/2011/11/javaee-revisits-design-patterns_28.html however when I implement the method: public void doLogging(@Observes String message){ System.out.println("Observed:"+message); } the @Observer annotation import does not get inserted. Also if I do it manually as:...

Convert a web project to EJB Project with CDI and JPA

maven,java-ee,jpa,ejb
I have a web project that was developed using JSP , Servlets and JDBC. When built it generates a web archive. Now my task is to remove the JDBC , introduce JPA, EJB and CDI which is done for some pages. After this I want to split the same project...

how to create ejb jar with conditional statement

java,web-services,ejb,java-ee-7
I have a web service that will be deployed two separate VM (example: VM123 and VM300). Depending on the VM id (VM123 or VM300), a subset of message driven beans should be deployed. Is it possible to create ejb-jar.xml with a conditional statement to specify or define the set of...

EJB Timer retry Interval

timer,ejb,websphere
Is it possible to increase the retry interval of EJB Timer in WAS ? When I m getting a database timeout error, the Timer was keep retrying after every 30 seconds which I dont want to be like that.

How to make a generic EJB class

java,ejb,ejb-3.0
I have tow entities named : Address and Client. I have an interface whitch looks like : public interface IDAOEnitityFactory extends Serializable{ List<Address> findAllByClass(); } The implementation looks like : @Stateless @Local(IDAOEnitityFactory.class) public class DAOEnitityFactory implements IDAOEnitityFactory { @PersistenceContext(unitName = "MY_PU") protected EntityManager entityManager; @Override public List<Address> findAllByClass() { return...

Is there a way to inject dependency in code using interface?

java,java-ee,ejb,ejb-3.0
I want to get the reference to some Stateless bean inside my code. The problem is I only know the Interface it is implementing (i do not know the name, classname or any other). Normally for any other EJB i would use @EJB annotation with an Interface private @EJB MyInt...

Inject ConversationScoped beans within an asynchronous method

jsf,asynchronous,ejb,conversation-scope
I need to call a method annotated with @Asynchronous in EJB from a ConversationScoped bean. Inside this method I create instances of some classes using @Inject to inject ConversationScoped beans. Is it somehow possible to set the context of the asynchronous method to given Conversation? I hope you can help...

If we inject a SessionScoped bean into a Stateless bean, what happens if there is no HTTP session?

java,java-ee,architecture,ejb,cdi
Our application consists of web pages that interact with backing beans and Stateless EJB services, but there is also a remote client that interacts with the Stateless EJB services. Many of the services query the DB and then filter the result set based on the current user/caller (for example, users...

Creating a customized API for a mobile app to access your web app (Java EE 6)

android,rest,mobile,ejb,jax-ws
Here is my dilemma. We have an existing web application. Created in Java 1.4 and had been running is Websphere Application Server 6.1 (J2EE 1.4) for the past x years. Just late last year it was migrated to Webshere 8 (Java EE 6). There is a plan to create a...

Can Inject (@EJB) Bean in method of other Bean Session(Remote or Local) class

java,ejb,ejb-3.1,glassfish-4,java-ee-7
I'm a newbie to EJB. I want to know is can inject EJB in method of other bean session, if not why? as code below: @Local interface car { public void drive(); } @Stateless public class Toyota implements Car { @Override public void drive() { @EJB Color color; ... }...

404 Error while deploying simple web-app in JBoss AS 6 and JBoss AS 7?

rest,jboss,ejb,jboss7.x,java-ee-6
I followed this blog for injecting EJB in REST layer. Here is the code that I tried deploying in JBOSS AS 6 and 7 using Eclipse: REST: package com.example.rest; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.ws.rs.GET; import javax.ws.rs.Path; @Stateless @Path("current") public class ServiceFacade { @EJB ServiceImpl service; @GET public String getDate(){...

Problems with Injection (Using vaadin)

java,dependency-injection,ejb,vaadin7
I am newbie with EJB and Injections... I am currently using Vaadin framework with CDI I have been trying to using injection but i have not could do it... In my Vaadin UI class MyVaadinUI i have tried... CDIUI("") @SuppressWarnings("serial") public class MyVaadinUI extends UI { @EJB UserController userController; @Override...

May I throw an AssertionError in an EJB method?

java,java-ee,error-handling,ejb
Following the style used in Joshua Bloch's Effective Java and in agreement with the answers to this question, I've used AssertionErrors in the past in the Java SE environment for code paths that should never possibly be executed. Looking at Java EE, the EJB 3.1 specification says If the bean...

What are the techniques to manage “session” or invocation context for Stateless EJBs during Remote calls?

session,java-ee,ejb,rmi,java-ee-6
I am writing an application that uses RMI to invoke EJBs. The EJBs are Stateless; the business requirements do not require conversational state with the client. One of the parameters to the EJB method calls is a "User" object used to determine if the user associated with the call has...

Remote JMS communication works, EJB communication fails

ejb,jms,wildfly,java-ee-7
I'm currently introducing myself into Java EE, especially into how to use EJB and JMS. The Issue in a Nutshell I have a local client and a remote server in the internet. JMS communication works fine, EJB communication doesn't. Either communication succeeds in my local network. The Issue in More...

Spring: Autowired is null in ejb class

spring,ejb,repository,autowired,inject
I have the following situation: @Controller public class myController { @Autowired private IProxy service; public ModelAndView init(HttpServletRequest request, HttpServletResponse response) throws Exception { List<String> list = service.getName(); } } Then my Service is define as follow: public interface IProxy { public List<String> getName(); } Proxy class is responsible for the...

Why is my EntityManager not properly injected?

jpa,ejb,wildfly,entitymanager
I tried to build a project with manages Employees using JPA and Beans and JSF. I started trying to manipulated an existing user which I manually created in the database. (before I tried to read the data from the database, this worked well) I tried this in various ways, by...

How to call EJB 3.0 by external Servlet

java,java-ee,servlets,ejb
I am learning EJB 3 and trying some simple stuff on it. I am using eclipse -> Luna Service Release 1 (4.4.1) with JBOSS AS 7.1.1 (final) I created a simple EJB project in eclipse with name -> SalutationEJBProj. Under this project created a simple session, stateless Bean. code: package...

Jackson error: java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/Versioned

java,json,jackson,ejb
I am working on Maven-EJB and want to convert a java object to JSON, I use Jackson jars lib but I got: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.Versioned I added these dependencies in pom.xml file: <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.4.0</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId>...

JAVA EE Stateless EJB IllegalArgumentException: Can not set field

java,java-ee,servlets,ejb,illegalargumentexception
I'm heaving some trouble while learning ejb. All I want is write a simple app operatign on database. Here's my code: Servlet - Main.java package main; import java.io.IOException; import java.io.PrintWriter; import java.util.List; import javax.ejb.EJB; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet(name = "Main", urlPatterns = {"/"})...

JavaEE - RMI code injection

java,security,java-ee,ejb,rmi
I am developing a JavaEE application using EJB container and EJB. Suppose I have class Student: class Student{ private int id; private String resume; public void clearXss(){ ///some logic to clear resume from js scripts } } I have a standalone client and JavaEE server. Client conntects via RMI to...

Use EJB in XmlAdapters

java,ejb,resteasy,xmladapter
How can I inject EJBs into the XmlAdapters? The idea is I want to get list of IDs by rest API and convert this array of IDs to List of Objects for Entity Object. For example: public class Post { List<Category> categories; ... } public class AdaptedPost { List<Long> categories;...

EJB injection not working in different classes

java-ee,netbeans,jersey,ejb,jax-rs
I have tried to inject an Entity EJB(Facade and entity from MySQL database) but it doesn't work depending on the class it is in. I use a Rest webService and it work in the webService class. I use a multi layered architecture and I don't want my EJB to be...

Instantiate EJB Via Factory

java,dependency-injection,ejb,java-ee-7
So I have a service I am hooking by instantiating it through a factory that creates a proxy so it can process some annotations I have on the service. So my question is this...is there a way with JavaEE to have my dependency injection instantiate the instances of said service...

Singleton session bean

java-ee,singleton,ejb,ejb-3.1,session-bean
Singleton session bean has been introduced to address what problems ?? is it only for sharing the data that is common for all the beans ?? How that problem is managed in ejb 3.0 and versions before that ? If it retains the client specific conversational state , that...

deploying ejb-module for ObjectDB fails: PersistenceProvider not found

java,maven,ejb,wildfly,objectdb
I have two almost identical projects (both created with maven, both very simple) where one deploys without any problems, the other gives me a PersistenceException: javax.persistence.PersistenceException: JBAS011466: PersistenceProvider 'com.objectdb.jpa.Provider' not found And I just don't see what I am missing here. The working project is web application. I got it...

NULL EJB referece

java-ee,glassfish,ejb,ejb-3.0,glassfish-4
I have a EAP created with Eclipse containing two modules: a Dynamic Web Application, and a EJB module. The application.xml of the EAP: <?xml version="1.0" encoding="UTF-8"?> <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" id="Application_ID" version="7"> <display-name>JExecuterEAP</display-name> <module>...

Internal Exception: java.sql.SQLSyntaxErrorException: ORA-00972: identifier is too long

jpa,ejb,eclipselink
i develop an application with swing i habe a database with few tables; these Tables are connected with foreign key When I try to run this application , i have the error; Exception in thread "AWT-EventQueue-0" javax.ejb.EJBException: EJB Exception: ; nested exception is: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.2.v20130514-5956486):...

Remote ejb method parameter isolation

java,ejb
I have a remote ejb which takes an object. It modifies the data in that object using the setter methods. In the client, I printed the value by using a getter method and observed that the value has changed. But the documentation here says that the parameters are isolated. Can...

How to show category dropdown on add product page in using Javaee jsp servlet jpa jstl ejb?

jsp,java-ee,servlets,ejb,jstl
I have been following ecommerce tutorial from Netbeans . This tutorial however lacks many real world services and one of them is inserting new products so i tried to implement it on my own however i am having problem to display categories on select's options dynamically on addProduct.jsp i created....

JPA batch insert causing ConstraintViolationException

java,hibernate,jpa,ejb
I'm working on project where I use mainly EJB and JPA, but I have problem with ConstraintViolationException that should not happen. First of all I have MyEntity class with @Id and few unique fields. I have @Stateless MyEntityRepository class with find() method which just returns MyEntity (or null) by calling...

Building/deploying a EJB .jar with its dependencies

maven,java-ee,jar,jboss,ejb
I am new to Java EE. I use Maven, Eclipse and jBoss/WildFly. I have a war project. When I build the project all its dependencies are packaged inside the war file in WEB-INF/lib. Now I am trying to create a ejb project (I have <packaging>ejb</packaging> in the pom.xml). I want...

Runtime exception is @ApplicationException(rollback=false) but transaction is finally rolled back

java,java-ee,transactions,ejb
My runtime exception @ApplicationException(rollback=false) public class UncheckedException extends RuntimeException {} My EJB code @Stateless @Transactional(TxType.REQUIRES_NEW) public class ContainerManagedTransactionBean { @PersistenceContext EntityManager em; public void insertAndThrowUnchecked() throws UncheckedException { em.persist(new Entry()); throw new UncheckedException(); } } My another EJB is client @Singleton @Startup @Transactional(TxType.NOT_SUPPORTED) public class Start { @EJB ContainerManagedTransactionBean bean;...

Client specific state in a stateless ejb

java,ejb
I did not understand about stateless session beans. The documentation says that the instances variables may contain client specific state and then says that when the method is finished the state should not be retained. Lets say there is a method X and two clients called at the same time....

EJB find method and multiple identifiers

java-ee,ejb
I have the following entity bean that contains multiple @Id: @Entity @Table (name="meta_tables") public class MetaTableEnt implements Serializable{ @Id @Column(name="data_ind") private Integer dataInd; @Id @Column(name="sk") private Integer sk; // other columns } and need to implement the find method: MetaTableEnt mte = em.find(MetaTableEnt.class, object); I defined object as follows, however...

Multithreading transactions hanging during persisting entity to postgresql via wildfly

java,hibernate,transactions,ejb,wildfly
I've got a bean definition with an entityManager like this: @Stateless public class JPABean<T> { private static final Logger LOG = Logger.getLogger(JPABean.class); @PersistenceContext(unitName = "myPersistanceSettings") private EntityManager em; public void write(T o) { LOG.info("PERSISTING"); em.persist(o); LOG.info("FLASHING"); em.flush(); LOG.info("SUCCESS"); } My persistance.xml <persistence-unit name="eSystemJPA" transaction-type="JTA" > <provider>org.hibernate.ejb.HibernatePersistence</provider>...

EJB on a remote client

java,java-ee,ejb,ejb-3.0,ejb-3.1
I have successfully compiled, deployed, and tested a simple, Remote, Stateless Session Beans on my local machine using this tutorial. The program just prints out "Hello World" in NetBeans output window when run. However I wish to run the client application on another home machine which doesn't has GlassFish or...

SessionContext not injected when using decorators

java,java-ee,glassfish,ejb,cdi
I'm using Glassfish 4 to deploy an application. It used to have an EJB where the SessionContext is injected via a @Resource annotation. @Stateless @DeclareRoles({"StandardRole1", "StandardRole2"}) public class MyClass implements MyInterface { @Resource private SessionContext ctx; @Override public String getPrincipalName() { return ctx.getPrincipal().getName(); } } This worked fine like it...

java.lang.NullPointerException at com.sun.ejb.codegen.EjbOptionalIntfGenerator.generateSubclass(EjbOptionalIntfGenerator.java:280)

java-ee,nullpointerexception,glassfish,ejb,subclass
So I was using EJB to create users in DB. It worked. So after that I made a profile page that user can change. Unfortunately I'm hit with an NPE because the EJB can't load. So I've another @Stateless class and that I pretty much copy pasted to create this...

How is an EJB stateful session bean passivated to secondary storage

java,ejb,ejb-passivation
I have read for stateful session bean: "While in the ready stage, the EJB container may decide to deactivate, or passivate, the bean by moving it from memory to secondary storage" So what is this secondary storage? Is it the underline database? Also, how is an object saved (persisted) in...

Wildfly - Infinispan Transactions configuration

java,transactions,ejb,wildfly,infinispan
I am using Wildfly 8.2 with its included Infinispan (6.0.2) and I am trying to cache all values from some Oracle database table in an Infispan cache. In most cases, it seems to work, but sometimes it does not. When accessing the cache.values() (which also may not be a good...

Security+Authentication+Authorization with Java EE 7 [closed]

java,java-ee,authentication,ejb,authorization
I am new to Java EE, so to learn Java EE (EJB+CDI+either Zkoss/JSF 2.0) I am trying to build a sample application. In this application I don't want to use any spring-security related stuff. I do want the Authentication+Authorization mix which is provided by Spring Security. Further more I want...

Make @PostConstruct do only for first instance of StateLess EJB

java,java-ee,glassfish,ejb
I have a class of staleless EJB (not singleton!). I need one method to be called (load configuration) only once when first bean of this class is created. @PostConstruct solves half of my problem but it's executed for every bean. What is the most elegant way to solve such problem?

JSF Controller, Service and DAO

jsf,java-ee,jpa,ejb,dao
I'm trying to get used to how JSF works with regards to accessing data (coming from a spring background) I'm creating a simple example that maintains a list of users, I have something like <h:dataTable value="#{userListController.userList}" var="u"> <h:column>#{u.userId}</h:column> <h:column>#{u.userName}</h:column> </h:dataTable> Then the "controller" has something like @Named(value = "userListController") @SessionScoped...

Why an MDB class cannot be final

java,oop,java-ee,ejb
This tutorial says that Message Driven Bean class cannot be defined as abstract or final. What is the reason for this? Why this class cannot be closed for extensions? UPDATE: I test this on JBoss Eap 6.3, And what I noted is MDB doesn't get fired though there are messages...