EAR vs separate EJB + WAR

There seems to be some confusion between 3 variants of deployment: An EAR that includes an EJB and WEB module Deploying a separate EJB module and a separate WEB module Deploying a WEB module that includes EJB classes or an EJB jar. In the first situation, you have logically one application, but one that is … Read more

DCH class error with JavaMail

Add these before you send your message: MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); mc.addMailcap(“text/html;; x-java-content-handler=com.sun.mail.handlers.text_html”); mc.addMailcap(“text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml”); mc.addMailcap(“text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain”); mc.addMailcap(“multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed”); mc.addMailcap(“message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822”); CommandMap.setDefaultCommandMap(mc); I got the problem in my Android app and it works.

Testing an EJB with JUnit

The accepted answer requires mocking a lot of code, including the persistence layer. Use an embedded container to test the actual beans, instead; otherwise, mocking the persistence layer results in code that barely tests anything useful. Use a session bean with an entity manager that references a persistence unit: @Stateless public class CommentService { @PersistenceContext(unitName … Read more

what is the right path to refer a jar file in jpa persistence.xml in a web app?

Taking a look at jsr always works! 8.2.1.6.3 Jar Files One or more JAR files may be specified using the jar-file elements instead of, or in addition to the mapping files specified in the mapping-file elements. If specified, these JAR files will >be searched for managed persistence classes, and any mapping metadata annotations found on … Read more