java-ee-7

Injecting RequestScoped CDI Bean into ApplicationScoped CDI Bean via Producer class

蓝咒 提交于 2019-12-09 20:59:02
问题 This article explains that you can inject RequestScoped beans into ApplicationScoped beans and the client proxy will point to the correct instance during a request: Bean instance of a shorter scope injected in a bean instance of a larger scope in CDI - how does it work? How does this work when using a separate producer class that does some extra processing and produces the RequestScoped bean? Upon deployment to the application server I get a DeploymentException due to ambiguous dependencies

How to install Java 7 EE SDK download as .sh file for Mac OSX

喜欢而已 提交于 2019-12-09 05:42:10
问题 I am new to developing Java on Mac OSX. I wanted to download the Java 7 EE SDK so I could both desktop/mobile/enterprise development with Java. The download file is .sh (specifically java_ee_sdk-7-jdk7-macosx-x64 ) which I am not familiar with. The Java 7 SE SDK is a .dmg file which is the format I expected for the Enterprise Edition instead of the .sh file. Why are the SE and EE editions different file formats? ( .sh vs .dmg ) How do I install the Enterprise Edition being that it is a .sh

JAX-RS Response for XML or JSON is not working

这一生的挚爱 提交于 2019-12-08 20:45:17
问题 I have the following GenericRest class which I use to extend rest classes which are based on Entity classes annotated with @XmlRootElement. public class GenericRest<T extends BaseEntity> { @Inject @Service GenericService<T> service; public GenericService<T> getService() { return service; } @GET @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) public Response getAll() { // This works for JSON but does not work for XML Requests. List<T> list = getService().findAll(); // This

How to write main() using CDI in Java EE?

强颜欢笑 提交于 2019-12-08 18:21:25
I have a no-client application that I wish to run. It will have no clients but it will make HTTP calls and act as client for other services. It would run for perhaps a few hours or days (but it will not require periodic runs -- just one-shot). I want to run it in a Java EE 7 container, because of the benefits of standard Context Dependency Injection (CD), and a standard JAX-RS client (new since Java EE 7). It is also nice to have services such as JMS, JPA. The question is how do I write / annotate the main method in a standard way? @Inject on a method is no good because such methods must

How can I change default port number of Activemq

走远了吗. 提交于 2019-12-08 15:55:39
问题 I am using Windows 7 OS. I downloaded apache-activemq-5.8.0.zip from these Link and extracted in C:\Users\Infratab Bangalore\Desktop\Queueing\apache-activemq-5.8.0 directory. While Activemq initialization time I read Pre-Installation Requirements concept from these Link. I already installed apache-maven-3.0.5 in my system.For my conformation I run the following command in my system. mvn -version I am getting the following message,So Maven is installed successfully. Apache Maven 3.0.5

Java EE 7 : Can not find the tag library descriptor for “http://java.sun.com/jsp/jstl/core”

元气小坏坏 提交于 2019-12-08 09:19:41
问题 I am trying to use the following tag lib in my JSP page : <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> But Eclipse shows me this error : Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core" I am already having JSTL in my classpath using this dependency : <dependency> <artifactId>javaee-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> I use WildFly 9. I have the same problem with these 2 other taglibs : <%@ taglib

jax-rs service RolesAllowed Annotation throwing exception

余生颓废 提交于 2019-12-08 07:41:08
问题 I have following jax-rs Restful API which works fine if I won't add following Annotation line @RolesAllowed("AdminRole") above GET Annotation package service; import entities.Booking; import java.util.List; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.annotation

overriding equals and hashcode methods in java?

*爱你&永不变心* 提交于 2019-12-08 05:06:31
I have below class. Request.java public class Request implements Serializable { private String id; private String name; private String hid; // getters and setters // This class does not override any equals() and hashCode() methods } public class EmpRequest implements Serializable { private Request request; //Now here in this class I need override equals() and hashCode() methods based on **request** } In EmpRequest class, I need to override equals() and hashCode() based on properties of Request object. If two request objects id is equal then i need to return true . If two objects ids are not

EJB injection fails in custom ConstraintValidator on JPA persist

偶尔善良 提交于 2019-12-08 02:01:49
问题 I have a problem with my JSF/JPA/Bean Validation app. Custom constraints annotating (JPA) entity fields don’t function correctly on JPA pre-persist although they work fine during JSF form validation Environment: NetBeans IDE 8.0.2 / GlassFish Server 4.1 JPA 2.1/EJB 3.2 /CDI 1.1/BeanValidation 1.1 /Hibernate Validator 5.0.0.Final cdi-api.jar added to ejb/web projects as it seems it was missing. Problem My App contains a JSF 2.2 page whose backing/CDI bean (Register) contains references to

Injecting EJBs using @Inject in class library

泪湿孤枕 提交于 2019-12-07 17:24:59
问题 I have a full-fledged Java EE application using GlassFish Server 4.1 / Java EE 7. It is a standard NetBeans project i.e. it does not use Apache Maven. The application contains a class library named "ProjectLibrary" which is added to both the modules namely the EE module and the web module. The IDE shows the basic tree structure diagrammatically as follows. There is a requirement to inject an EJB into a JPA entity listener as follows. @ApplicationScoped public class EntityListener { @Inject