java-ee-7

Using a secured EJB from a JAX-RS web service

我的未来我决定 提交于 2019-12-07 14:42:48
问题 I'm running Glassfish 4 and Jersey as JAX-RS implementation. I have secured my EJB like this: @Stateless @DeclareRoles({"Authentication_Reader"}) @RolesAllowed({"Authentication_Reader"}) public class AuthenticationServiceBean { public void foo() { ... } } I have created a security-role-mapping entry in glassfish-web.xml, and I've also created a security-role declaration in web.xml. The following works from a servlet: @WebServlet(name = "TestServlet", urlPatterns = {"/test.do"}) @RunAs(

Java Web Socket ServerEndpoint Thread Safety

左心房为你撑大大i 提交于 2019-12-07 07:22:04
问题 Are individual ServerEndpoints thread safe or do they belong to all clients who are interacting with them at a given time? Or another way to ask the same question: Are global objects in the ServerEndpoint class in danger of creating concurrency issues, like they do in HttpServlets? This example seems to indicate that each Endpoint is thread-safe, or he is just using Set and praying that concurrency issues don't pop up? So, assuming that the they are thread safe, does the container (Tomcat,

Could not initialize class org.eclipse.persistence.jaxb.BeanValidationHelper while trying to get JSON response

烈酒焚心 提交于 2019-12-07 03:30:47
问题 I am making application using JAVA EE,JAX-RS,JPA,GLASSFISH. Response is working properly in case of MediaType.APPLICATION_XML . It's not working in MediaType.APPLICATION_JSON . Here is my pojo class @Entity @XmlRootElement public class Book { private int id; private String name; private String publication; private String price; @Id @Column(name = "id") public int getId() { return id; } public void setId(int id) { this.id = id; } @Basic @Column(name = "name") public String getName() { return

Maven not showing up in Eclipse (Kepler) even after m2e install

和自甴很熟 提交于 2019-12-06 23:42:56
问题 I've seen that others have had this problem where Maven doesn't show up for them in Eclipse after installing the m2e plugin, but most of the solutions seem to suggest doing something like "Configure>Convert to Maven." But Maven is not showing up for me in the Configure list, nor is it showing up in Console>Open Console or the File>New list. I see some solutions refer to editing the project's classpath, but I don't have a clear understanding of how to do that. I'm trying to begin working

what is the purpose of @Nonbinding annotation in a Qualifier supposed to be in Java EE7?

喜你入骨 提交于 2019-12-06 22:34:02
问题 I am reading through the CDI injections in JavaEE 7 particularly using @Qualifier and @Produces to inject a custom Data type into a bean. I have the following code taken from JBoss documentation towards ends of the page. @Qualifier @Retention(RUNTIME) @Target({TYPE, METHOD, FIELD, PARAMETER}) public @interface HttpParam { @Nonbinding public String value(); } import javax.enterprise.inject.Produces; import javax.enterprise.inject.spi.InjectionPoint; class HttpParams { @Produces @HttpParam("")

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

杀马特。学长 韩版系。学妹 提交于 2019-12-06 16:37:42
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 prefix="f" uri="http://java.sun.com/jsf/core"%> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

javax:javaee-api-6.0 contains non-abstract classes with no method body

纵饮孤独 提交于 2019-12-06 13:01:05
问题 I am fairly new to Java EE and when I look into the compiled code (I could not find the source code for javax:javaee-api-6.0), I notice this class. package javax.servlet; import java.util.EventObject; public class ServletContextEvent extends EventObject { public ServletContextEvent(ServletContext paramServletContext); public ServletContext getServletContext(); } However, the same class in javax:javaee-api-7.0 is this. package javax.servlet; import java.util.EventObject; public class

EJB injection fails in custom ConstraintValidator on JPA persist

被刻印的时光 ゝ 提交于 2019-12-06 11:57:53
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 fields of (JPA) entities on the server/EJB tier. The entities are annotated with constraint annotations,

How do I upgrade an existing NetBeans Java EE 6 Web project to Java EE 7?

可紊 提交于 2019-12-06 11:15:43
问题 The project uses JavaServer Faces and JPA. NetBeans 7.3.1 IDE does not allow to change the Java EE version. I already found this question: How do I upgrade an existing enterprise project from Java EE5 to Java EE 6 in Netbeans (6.9) tries to apply the changes as described. I have updated project.properties. endorsed.classpath=\ ${libs.javaee-endorsed-api-7.0.classpath} ... j2ee.platform=1.7-web ... javac.source=1.7 javac.target=1.7 回答1: I just had to do the same thing, I had an Java EE 6

JEE7 + WildFly (HornetQ) - Pause queue from application

半城伤御伤魂 提交于 2019-12-06 10:47:10
问题 We are using WildFly + HornetQ as our application server and JMS message queue, and have the requirement to be able to pause/resume queues from the application. Is this possible? 回答1: This can be done using JMX or using the hornetq core management api. For the purposes of this example, wildfly 8.1.0.Final was used running the standalone-full-ha profile. Required Maven Dependencies: <dependency> <groupId>org.hornetq</groupId> <artifactId>hornetq-jms-client</artifactId> <version>2.4.1.Final<