java-ee-7

TomEE CDI @Inject NullPointerException

家住魔仙堡 提交于 2021-02-17 02:14:11
问题 I'm trying to get CDI to work in my application, but I only get NullPointerExceptions when I do. When normally instantiating the playlistService, it works perfectly fine, but when I try to use CDI, it doesn't anymore. The server is able to start, but when I add beans.xml to META-INF/ and WEB-INF/ it's also not able to start anymore. PlaylistRESTController.java import javax.inject.Inject; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.*; import javax.ws.rs.core.*; @Path("/api

How to send a message through web socket to a connected user?

ぐ巨炮叔叔 提交于 2021-02-08 10:13:03
问题 I want to send a message through a web socket to a specific user. So far I can open a web socket and read message from client like that: @ServerEndpoint(value = "/wsep") public class WebSocketEndpoint { private static final Logger LOGGER = LoggerFactory.getLogger(WebSocketEndpoint.class); private Session session; @OnOpen public void onOpen(Session session) { this.session = session; try { session.getBasicRemote().sendText("You are connected. Your ID is " + session.getId()); } catch (Exception

JEE7 @Transactional annotation not always fires

橙三吉。 提交于 2021-01-28 23:40:31
问题 For several days I'm trying to manage with JPA transactions after moving to WildFly 8 server and JEE7 and I cannot understand why in some cases @Transactional (javax.transaction.Transactional) annotation doesn't intercept method annotated with it. I cannot see any rule why sometimes it works and sometimes not. Example of my not working code: import javax.inject.Inject; import javax.inject.Named; import javax.persistence.EntityManager; import javax.faces.view.ViewScoped; import com.i4u.app

EJB Container initialization error, Error while binding JNDI name *** for EJB ***

廉价感情. 提交于 2020-12-30 03:28:44
问题 I am new to Java and I developed a sample Java EE application that works with normal Java client, but it does not work with Servlets. I developed EE project in Netbeans IDE with an Application Client, EJB module and Web module. Customer.java @Entity @Table(name = "customer") public class Customer implements Serializable { private static final long serialVersionUID = 1L; @Id @Column (name="id") private String id; @Column (name="name") private String name; public void setName(String name) {

what is the difference between jndi binding of module and app in Java ee 6/7?

不羁的心 提交于 2020-07-10 03:27:07
问题 We migrated from Jboss EAP 5 to EAP 6 in our development environment. I now see the following in my JBOSS logs. I am trying to understand how this binding happens. I have read JBOSS docs on JNDI namespace binding. Still I am not totally clear how it works. Here is my log. java:global/customerCare/services/UserDaoImpl!com.example.services.UserDao java:app/services/UserDaoImpl!com.example.services.UserDao java:module/UserDaoImpl!com.services.UserDao java:global/customerCare/services/UserDaoImpl

what is the difference between jndi binding of module and app in Java ee 6/7?

不想你离开。 提交于 2020-07-10 03:25:22
问题 We migrated from Jboss EAP 5 to EAP 6 in our development environment. I now see the following in my JBOSS logs. I am trying to understand how this binding happens. I have read JBOSS docs on JNDI namespace binding. Still I am not totally clear how it works. Here is my log. java:global/customerCare/services/UserDaoImpl!com.example.services.UserDao java:app/services/UserDaoImpl!com.example.services.UserDao java:module/UserDaoImpl!com.services.UserDao java:global/customerCare/services/UserDaoImpl

Glassfish 4.1 CDI WELD-001409: Ambiguous dependencies

不打扰是莪最后的温柔 提交于 2020-07-07 12:58:28
问题 I'm working in a project deployed in Glassfish 4.1 . Dependency injection is made using CDI and I'm having an issue when trying to deploy the application. The error I'm getting is the following (usually I "translate" the name of my classes in the code so the whole post is in the same language, I`ll not do that now so I can copy/paste and avoid some translate typing mistakes): Server log org.glassfish.deployment.common.DeploymentException: CDI deployment failure:Exception List with 3

Different behaviour on JAX-RS json (java.util.Date) serialization

倖福魔咒の 提交于 2020-06-16 18:50:27
问题 I'm migrating my application (Jee7) from Wildfly 9.0.1 to Wildfly 16.0.0. I noticed different Responses from JAX-RS json (java.util.Date) deserialization on both wildfly version. Is it a bug or Jee spec changed? Is there a way to globally fix it for entire application? Example classes: @ApplicationPath("/rest") public class RestConfig extends Application { } @Path("/test") public class TestResource { @GET @Produces(MediaType.APPLICATION_JSON) public TestEntity get() { return new TestEntity