【问题标题】:junit glassfish v3 oracle dbjunit glassfish v3 oracle db
【发布时间】:2014-04-11 15:21:34
【问题描述】:

尝试在 netbeans8 上编写 ejb3 junit 我们使用 weblogic 12c,但我无法获得他们的嵌入式容器,所以放弃并尝试 glassfish

它走得更远,但奇怪的是,即使我的持久性 xml 使用 oracle 设置,它也会触发 derby 并说我的架构/表不存在

尝试使用德比

<?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="ACP-warPU" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <exclude-unlisted-classes>false</exclude-unlisted-classes> <shared-cache-mode>ALL</shared-cache-mode> <properties> <property name="eclipselink.logging.level" value="FINE"/> <property name="eclipselink.logging.logger" value="ServerLogger"/> <property name="javax.persistence.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:db11g"/> <property name="javax.persistence.jdbc.password" value="spa"/> <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver"/> <property name="javax.persistence.jdbc.user" value="spa"/> </properties> </persistence-unit> </persistence>

Map<String, Object> p = new HashMap<String, Object>();

    File[] modules = {
        new File("target/test-classes"),
        new File("target/classes")

    };
    p.put(EJBContainer.MODULES, modules);
    p.put("org.glassfish.ejb.embedded.glassfish.installation.root", "/target/gfv3");

    ejbContainer = EJBContainer.createEJBContainer(p);
    ctx = ejbContainer.getContext();
    ejbFacade = (AllocnGrpFacade) ctx.lookup("java:global/classes/AllocnGrpFacade");


Caused by: ERROR 42Y07: Schema 'SPA' does not exist
at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)
at org.apache.derby.impl.sql.catalog.DataDictionaryImpl.getSchemaDescriptor(Unknown Source)
at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(Unknown Source)
at org.apache.derby.impl.sql.compile.QueryTreeNode.getSchemaDescriptor(Unknown Source)
at org.apache.derby.impl.sql.compile.FromBaseTable.bindTableDescriptor(Unknown Source)
at org.apache.derby.impl.sql.compile.FromBaseTable.bindNonVTITables(Unknown Source)
at org.apache.derby.impl.sql.compile.FromList.bindTables(Unknown Source)
at org.apache.derby.impl.sql.compile.SelectNode.bindNonVTITables(Unknown Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bindTables(Unknown Source)
at org.apache.derby.impl.sql.compile.DMLStatementNode.bind(Unknown Source)
at org.apache.derby.impl.sql.compile.CursorNode.bindStatement(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepMinion(Unknown Source)
at org.apache.derby.impl.sql.GenericStatement.prepare(Unknown Source)
at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepareInternalStatement(Unknown Source)

【问题讨论】:

  • 版本信息 - jdk 1.6 , glassfish 3.1.2.2 - java ee 6

标签: oracle junit glassfish


【解决方案1】:

基本上你需要 glassfish 域设置,即使是嵌入式容器

我希望我可以用代码而不是生成的垃圾来做到这一点,但现在我就是这样做的

解决了看看

Caused by: javax.naming.NameNotFoundException: pools

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2010-12-06
    • 1970-01-01
    • 2010-12-28
    • 1970-01-01
    • 1970-01-01
    • 2011-09-20
    • 1970-01-01
    • 2011-07-03
    相关资源
    最近更新 更多