Error: m2e Install In Eclipse

I ran into a similar issue today and found that this question also has recently been asked and answered at the atlassian forum as well. My solution was to install slf4j based on guidelines from this blog post about “SLF4J Logging in Eclipse Plugins”. To extract, here is what I did: Eclipse -> Help -> … Read more

The meaning of NoInitialContextException error

The javax.naming package comprises the JNDI API. Since it’s just an API, rather than an implementation, you need to tell it which implementation of JNDI to use. The implementations are typically specific to the server you’re trying to talk to. To specify an implementation, you pass in a Properties object when you construct the InitialContext. … Read more

How to set up JAX-RS Application using annotations only (no web.xml)?

** PLEASE READ IF YOU USE TOMCAT OR JETTY! ** The accepted answer does work, but only if the webapp is deployed to an app server like Glassfish or Wildfly, and possibly servlet containers with EE extensions like TomEE. It doesn’t work on standard servlet containers like Tomcat, which I’m sure most people looking for … Read more

what is java:comp/env? [duplicate]

java:comp/env is the node in the JNDI tree where you can find properties for the current Java EE component (a webapp, or an EJB). Context envContext = (Context)initContext.lookup(“java:comp/env”); allows defining a variable pointing directly to this node. It allows doing SomeBean s = (SomeBean) envContext.lookup(“ejb/someBean”); DataSource ds = (DataSource) envContext.lookup(“jdbc/dataSource”); rather than SomeBean s = … Read more

JPA Multiple Embedded fields

The generic JPA way to do it is with @AttributeOverride. This should work in both EclipseLink and Hibernate. @Entity public class Person { @AttributeOverrides({ @AttributeOverride(name=”street”,column=@Column(name=”homeStreet”)), … }) @Embedded public Address home; @AttributeOverrides({ @AttributeOverride(name=”street”,column=@Column(name=”workStreet”)), … }) @Embedded public Address work; } @Embeddable public class Address { @Basic public String street; … } }

When to use Stateful session bean over Stateless session bean?

First, you have to understand how the beans are created and handled on the server. For stateless session beans the server can maintain a variable amount of instances in a pool. Each time a client requests such a stateless bean (e.g. through a method) a random instance is chosen to serve that request. That means … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)