I'm trying to get a JavaEE project to run on Glassfish 4.0 but when I try to flush inserts (persist) to the Sql Server DB it throws this error:
org.omg.CORBA.MARSHAL: WARNING: 00810057: Could not load class com.microsoft.sqlserver.jdbc.SQLServerException vmcid: OMG minor code: 57 completed: Maybe
The connection works in Netbeans for running commands and generating entity classes.
Bean method:
public int addUser(UserDetails u) {
try{
User uP = new User(u.getUserName(), u.isEnabled(), u.isAdmin());
em.persist(uP);
return 0;
}
catch(Exception e)
{
throw new EJBException(e);
}
}
Persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="LibraryBeanPU" transaction-type="JTA">
<jta-data-source>JavaEE_Library</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties/>
</persistence-unit>
</persistence>
Client:
public static void main(String[] args) {
LibraryClient lc = new LibraryClient();
}
public LibraryClient()
{
LibraryFacadeRemote request = (LibraryFacadeRemote) getEJBBean("LibraryFacade");
request.addUser(new UserDetails("admin", true, true));
}
public Object getEJBBean(String beanName) {
try {
InitialContext ctx = new InitialContext();
return ctx.lookup(beanName);
} catch (Exception ex) {
System.err.println("ERROR: while locating bean from the server " + ex.getMessage());
return null;
}
}