A message body writer for Java type, class myPackage.B, and MIME media type, application/octet-stream, was not found

In your client code you are not specifying the content type of the data you are sending – so Jersey is not able to locate the right MessageBodyWritter to serialize the b1 object. Modify the last line of your main method as follows: ClientResponse response = resource.type(MediaType.APPLICATION_XML).put(ClientResponse.class, b1); And add @XmlRootElement annotation to class B … Read more

Use Enum type as a value parameter for @RolesAllowed-Annotation

How about this? public enum RoleType { STUDENT(Names.STUDENT), TEACHER(Names.TEACHER), DEANERY(Names.DEANERY); public class Names{ public static final String STUDENT = “Student”; public static final String TEACHER = “Teacher”; public static final String DEANERY = “Deanery”; } private final String label; private RoleType(String label) { this.label = label; } public String toString() { return this.label; } } … Read more

How do CDI and EJB compare? interact?

It is currently indeed a bit confusing as there are now multiple component models in Java EE. They are CDI, EJB3 and JSF Managed Beans. CDI is the new kid on the block. CDI beans feature dependency injection, scoping and an event bus. CDI beans are the most flexible with respect to injection and scoping. … Read more

Java EE 6 @javax.annotation.ManagedBean vs. @javax.inject.Named vs. @javax.faces.ManagedBean

First of all let me do some clarifications: Managed bean definition : generally a managed bean is an object that its life cycle (construction, destruction, etc) is managed by a container. In Java ee we have many containers that manage life cycle of their objects, like JSF container, EJB container, CDI container, Servlet container, etc. … Read more