首页 文章

Vineet Reynolds / java-ee-6-galleria项目运行MySQL而不是Derby

提问于
浏览
0

我正在尝试关注/了解有关Java EE的更多信息,并找到了一篇非常好的文章http://blog.eisele.net/2012/03/java-ee-6-running-galleria-on-glassfish.html,这是如何在Glassfish上运行它的分步指南 . 原始源代码可以在“hg clone https://bitbucket.org/VineetReynolds/java-ee-6-galleria”找到

但是,现在我想将Derby数据库更改为MySQL和Eclipselink,因为我对它更熟悉 . 我已成功运行* IntegrationTest(s)但未运行单元测试RepositoryTest(s) .

我已将persistence-test.xml文件更改为:

<?xml version="1.0" encoding="UTF-8" ?>
<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"
  version="2.0" xmlns="http://java.sun.com/xml/ns/persistence">

  <persistence-unit name="galleria-ejb" transaction-type="JTA">  

  <!-- <persistence-unit name="galleria-ejb" transaction-type="RESOURCE_LOCAL"> -->
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    <jta-data-source>jdbc/galleriaDS</jta-data-source> <!-- Added -->

    <class>info.galleria.domain.Album</class>
    <class>info.galleria.domain.Group</class>
    <class>info.galleria.domain.Photo</class>
    <class>info.galleria.domain.User</class>

    <properties>        
        <property name="eclipselink.ddl-generation" value="none" />        
        <property name="eclipselink.logging.level" value="FINEST" />  

    </properties>
  </persistence-unit>

</persistence>

当我运行mvn clean test -Dtest = AlbumRepositoryTest #testCreateNewAlbum时,我得到以下内容:

EL Info]:2013-02-15 23:20:16.615 - ServerSession(4248874) - 线程(Thread [main,5,main]) - EclipseLink,版本:Eclipse Persistence Services - 2.3.2.v20111125- r10461 org.omg.CORBA.COMM_FAILURE:FINE:IOP00410001:连接失败:socketType:IIOP_CLEAR_TEXT; hostname:localhost; port:3700 vmcid:OMG次代码:1完成:在sun.reflect.GeneratedConstructorAccessor29.newInstance(未知来源)处于sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)at java.lang.reflect.Constructor.newInstance (Constructor.java:525)com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)at com.sun.corba.ee.spi.orbutil.logex.corba .corbaExtension.makeException(CorbaExtension.java:95)at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)at com.sun.corba.ee.spi.orbutil.logex .wrapperGenerator.access $ 400(WrapperGenerator.java:107)at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator $ 2.invoke(WrapperGenerator.java:511)at com.sun.corba.ee.spi.orbutil位于com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl的$ Proxy32.connectFailure(未知来源)的.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99) . (S ocketOrChannelConnectionImpl.java:257)com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl . (SocketOrChannelConnectionImpl.java:270)at com.sun.corba.ee.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:129 )com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:223)at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:228)at com . 位于org.omg.CosNaming.NamingContextHelper.narrow的org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:130)的sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:393) NamingContextHelper.java:69)at com.sun.enterprise.naming.impl.SerialContext $ ProviderCacheKey.getNameService(SerialContext.java:1241)at com.sun.enterprise.naming.impl.SerialContext.getRemoteProvider(SerialContext.java:411)在com.sun.enterprise.naming.impl.SerialContext.getProvider(SerialContext.j ava:347)com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:504)at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)at com.sun位于org.eclipse.persistence.sessions.JNDIConnector.connect的Javax.naming.InitialContext.lookup(InitialContext.java:415)中的.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:654)(JNDIConnector.java:103 )org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)atg.eclipse.persistence.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:584)org.eclipse.persistence.internal . 位于org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:488)的org.eclipse.persistence.internal.jpa.EntityManagerFactoryDelegate.getDatabaseSession(EntityManagerFactoryDelegate)中的jpa.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:206) . java:188)at org.eclipse.persistence.internal.jpa.EntityM org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:294)中的anagerFactoryDelegate.createEntityManagerImpl(EntityManagerFactoryDelegate.java:277)位于org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java: 272)在info.galleria.service.jpa.AbstractRepositoryTest.setUp(AbstractRepositoryTest.java:88)的info.galleria.service.jpa.AlbumRepositoryTest.setUp(AlbumRepositoryTest.java:26)atsun.reflect.NativeMethodAccessorImpl.invoke0(本地方法)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method . 调用(Method.java:601)在org.junit.runners.model.FrameworkMethod $ 1.runReflectiveCall(FrameworkMethod.java:44)在org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)在org.junit.runners.model.FrameworkMethod.invokeExplosively在org.junit.internal.runners.statements(FrameworkMethod.java:41)在org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27) . RunAfters.evaluate(RunAfters.java:31)org.junit.rules.TestWatchman $ 1.evaluate(TestWatchman.java:48)org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)org.junit . runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)at org.junit.runners.BlockJUnit4ClassRunner.runChild(Bloc) kJUnit4ClassRunner.java:49)org.junit.runners.ParentRunner $ 3.run(ParentRunner.java:193)org.junit.runners.ParentRunner $ 1.schedule(ParentRunner.java:52)org.junit.runners.ParentRunner .runChildren(ParentRunner.java:191)在org.junit.runners.ParentRunner.access $ 000(ParentRunner.java:42)在org.junit.runners.ParentRunner $ 2.evaluate(ParentRunner.java:184)在org.junit . internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)在org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)在org.junit.runners.ParentRunner.run(ParentRunner . java:236)org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:254)atg.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:149)org.apache位于sun.reflect的sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)的sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)中的.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) . 在org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray2(ReflectionUtils.java:208)上的java.lang.reflect.Method.invoke(Method.java:601)中委托MethodAethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) .apache.maven.surefire.booter.ProviderFactory $ ProviderProxy.invoke(ProviderFactory.java:158)在org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:86)在org.apache.maven.surefire .booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:95)引起:java.lang.RuntimeException:java.net.ConnectException:Connection在com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl拒绝了org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:340) . (SocketOrChannelConnectionImpl.java:242)... 58更多引起by:java.net.ConnectException:sun.nio.c上的sun.nio.ch.Net.connect0(本机方法)连接被拒绝h.Net.connect(Net.java:364)位于sun.nio.ch.Net.connect(Net.java:356),位于com.sun的sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:623) org.glassfish.enterprise.iiop.impl.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:325)的.corba.ee.impl.orbutil.ORBUtility.openSocketChannel(ORBUtility.java:110)... 59更多

所以我真正的问题是:有没有人可以告诉我如何使用mysql而不是derby运行Vineet Reynolds / java-ee-6-galleria项目? Hibernate或Eclipselink并不重要,我只想运行mysql而不是derby =)

最好的祝福

1 回答

  • 0

    它工作..愚蠢的错误,刚从头开始,它解决了问题..

相关问题