我試圖得到一個JavaEE的項目爲Glassfish 4.0上運行,但是當我嘗試刷新插件(堅持)到SQL Server數據庫,它拋出這個錯誤:無法加載類 - JDBC
org.omg.CORBA.MARSHAL: WARNING: 00810057: Could not load class com.microsoft.sqlserver.jdbc.SQLServerException vmcid: OMG minor code: 57 completed: Maybe
該連接在Netbeans中運行,用於運行命令和生成實體類。
Bean方法:
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>
客戶:
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;
}
}
您能否發佈相關代碼。 – Adarsh
從哪裏得到'OMG次要代碼:57已完成:可能' – Adarsh
在哪個服務器上運行您的應用程序 – elsadek