I am using a dependency with embedded glassfish in order to create an EJBContainer in the main() method and get the ejb I need for testing. Following the video in my course, it should work, but I get errors related to:
5:37:27 AM org.glassfish.web.embed.impl.ScatteredWebArchivist$EmbeddedWebScanner process
WARNING: Cannot load class com/sun/msv/scanner/dtd/EntityDecl.class
java.lang.ClassNotFoundException: ner.dtd.EntityDecl
5:37:27 AM org.glassfish.web.embed.impl.ScatteredWebArchivist$EmbeddedWebScanner process
WARNING: Cannot load class com/sun/msv/reader/trex/ng/RestrictionChecker$DuplicateAttributesChecker.class
etc.
public class Test{
public static void main(String[] args) {
try (EJBContainer container = EJBContainer.createEJBContainer(props)) {
MyBean myBean = (MyBean) container.getContext().lookup("java:module/MyBean");
System.out.println(myBean.getNumber());
} catch (NamingException e) {
throw new RuntimeException(e);
}
}
}
glassfish dependency that i use:
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>7.0.11</version>
<scope>test</scope>
</dependency>