NHibernate.HibernateException

Test 'Sietech.Wms.Tianma.IntegrationTests.IntegrationTests.ArticleIntegreationTests.SaveArticleTest' failed: Spring.Objects.Factory.ObjectCreationException : Error creating object with name 'NHibernateSessionFactory' defined in 'assembly [Sietech.Wms.Tianma.Dao.NHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null], resource [Sietech.Wms.Tianma.Dao.Dao.xml] line 23' : Initialization of object failed : Could not compile the mapping document: Sietech.Wms.Tianma.Mappings.Article.hbm.xml
  ----> NHibernate.MappingException : Could not compile the mapping document: Sietech.Wms.Tianma.Mappings.Article.hbm.xml
  ----> NHibernate.HibernateException : Could not instantiate dialect class NHibernate.Dialect.OracleDialect
  ----> System.TypeLoadException : Could not load type NHibernate.Dialect.OracleDialect. Possible cause: no assembly name specified.
 在 Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure)
 在 Spring.Objects.Factory.Support.AbstractObjectFactory.CreateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments)
 在 Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectInternal(String name, Type requiredType, Object[] arguments, Boolean suppressConfigure)
 在 Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name)
 在 Spring.Objects.Factory.Support.DefaultListableObjectFactory.GetObjectsOfType(Type type, Boolean includePrototypes, Boolean includeFactoryObjects)
 在 Spring.Objects.Factory.ObjectFactoryUtils.ObjectsOfTypeIncludingAncestors(IListableObjectFactory factory, Type type, Boolean includePrototypes, Boolean includeFactoryObjects)
 在 Spring.Dao.Support.PersistenceExceptionTranslationInterceptor.DetectPersistenceExceptionTranslators(IListableObjectFactory objectFactory)
 在 Spring.Dao.Support.PersistenceExceptionTranslationInterceptor..ctor(IListableObjectFactory objectFactory)
 在 Spring.Dao.Attributes.PersistenceExceptionTranslationAdvisor..ctor(IListableObjectFactory objectFactory, Type repositoryAttributeType)
 在 Spring.Dao.Attributes.PersistenceExceptionTranslationPostProcessor.set_ObjectFactory(IObjectFactory value)
 在 Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ConfigureObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper)
 在 Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure)
 在 Spring.Objects.Factory.Support.AbstractObjectFactory.CreateAndCacheSingletonInstance(String objectName, RootObjectDefinition objectDefinition, Object[] arguments)
 在 Spring.Objects.Factory.Support.AbstractObjectFactory.GetObjectInternal(String name, Type requiredType, Object[] arguments, Boolean suppressConfigure)
 在 Spring.Objects.Factory.Support.AbstractObjectFactory.GetObject(String name)
 在 Spring.Objects.Factory.Support.DefaultListableObjectFactory.GetObjectsOfType(Type type, Boolean includePrototypes, Boolean includeFactoryObjects)
 在 Spring.Context.Support.AbstractApplicationContext.GetObjectsOfType(Type type, Boolean includePrototypes, Boolean includeFactoryObjects)
 在 Spring.Context.Support.AbstractApplicationContext.RegisterObjectPostProcessors(IConfigurableListableObjectFactory objectFactory)
 在 Spring.Context.Support.AbstractApplicationContext.Refresh()
 在 Spring.Context.Support.XmlApplicationContext..ctor(Boolean refresh, String name, Boolean caseSensitive, IApplicationContext parentContext, String[] configurationLocations)
 在 Spring.Context.Support.XmlApplicationContext..ctor(String[] configurationLocations)
 在 Spring.Testing.NUnit.AbstractSpringContextTests.LoadContextLocations(String[] locations)
 在 Spring.Testing.NUnit.AbstractDependencyInjectionSpringContextTests.LoadContextLocations(String[] locations)
 在 Spring.Testing.NUnit.AbstractSpringContextTests.GetContext(Object key)
 在 Spring.Testing.NUnit.AbstractDependencyInjectionSpringContextTests.SetUp()
 --MappingException
 在 NHibernate.Cfg.Configuration.LogAndThrow(Exception exception)
 在 NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
 在 NHibernate.Cfg.Configuration.ProcessMappingsQueue()
 在 NHibernate.Cfg.Configuration.AddDocumentThroughQueue(NamedXmlDocument document)
 在 NHibernate.Cfg.Configuration.AddXmlReader(XmlReader hbmReader, String name)
 在 NHibernate.Cfg.Configuration.AddInputStream(Stream xmlInputStream, String name)
 在 NHibernate.Cfg.Configuration.AddResource(String path, Assembly assembly)
 在 NHibernate.Cfg.Configuration.AddAssembly(Assembly assembly)
 在 NHibernate.Cfg.Configuration.AddAssembly(String assemblyName)
 在 Spring.Data.NHibernate.LocalSessionFactoryObject.AfterPropertiesSet()
 在 Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InvokeInitMethods(Object target, String name, IConfigurableObjectDefinition definition)
 在 Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.ConfigureObject(String name, RootObjectDefinition definition, IObjectWrapper wrapper)
 在 Spring.Objects.Factory.Support.AbstractAutowireCapableObjectFactory.InstantiateObject(String name, RootObjectDefinition definition, Object[] arguments, Boolean allowEagerCaching, Boolean suppressConfigure)
 --HibernateException
 在 NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName)
 在 NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props)
 在 NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
 --TypeLoadException
 在 NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError)
 在 NHibernate.Util.ReflectHelper.ClassForName(String name)
 在 NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName)

INFO  Sietech.Wms.Tianma.IntegrationTests.IntegrationTests.ArticleIntegreationTests - Loading config for: assembly://Sietech.Wms.Tianma.Dao.NHibernate/Sietech.Wms.Tianma.Dao/Dao.xml
INFO  Spring.Context.Support.XmlApplicationContext - ApplicationContext Refresh: Completed
INFO  Spring.Data.Common.DbProviderFactory - 37 DbProviders Available. [SqlServer-1.1,SqlServer-2.0,SqlServerCe-3.1,SqlServerCe-3.5.1,OleDb-1.1,OleDb-2.0,OracleClient-2.0,OracleODP-2.0,OracleODP-11-2.0,MySql,MySql-1.0.9,MySql-5.0,MySql-5.0.8.1,MySql-5.1,MySql-5.1.4,MySql-5.2.3,MySql-6.1.3,Npgsql-1.0,Npgsql-2.0-beta1,Npgsql-2.0,DB2-9.0.0-1.1,DB2-9.0.0-2.0,DB2-9.1.0-1.1,DB2-9.1.0.2,iDB2-10.0.0.0,SQLite-1.0.43,SQLite-1.0.44,SQLite-1.0.47,SQLite-1.0.56,SQLite-1.0.65,Firebird-2.1,SybaseAse-12,SybaseAse-15,SybaseAse-AdoNet2,Odbc-1.1,Odbc-2.0,Cache-2.0.0.1]
INFO  NHibernate.Cfg.Environment - NHibernate 2.1.2.4000 (2.1.2.4000)
INFO  NHibernate.Cfg.Environment - hibernate-configuration section not found in application configuration file
INFO  NHibernate.Cfg.Environment - Bytecode provider name : lcg
INFO  NHibernate.Cfg.Environment - Using reflection optimizer
INFO  Spring.Data.NHibernate.LocalSessionFactoryObject - Setting proxy factory to Spring provided one as user did not specify any
INFO  NHibernate.Cfg.Configuration - Searching for mapped documents in assembly: Sietech.Wms.Tianma.Dao.NHibernate
INFO  NHibernate.Cfg.Configuration - Mapping resource: Sietech.Wms.Tianma.Mappings.Article.hbm.xml
WARN  NHibernate.Util.ReflectHelper - Could not load type NHibernate.Dialect.OracleDialect. Possible cause: no assembly name specified.
ERROR NHibernate.Util.ReflectHelper - Could not load type NHibernate.Dialect.OracleDialect.
System.TypeLoadException: Could not load type NHibernate.Dialect.OracleDialect. Possible cause: no assembly name specified.
   在 NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError)
ERROR NHibernate.Cfg.Configuration - Could not compile the mapping document: Sietech.Wms.Tianma.Mappings.Article.hbm.xml
NHibernate.MappingException: Could not compile the mapping document: Sietech.Wms.Tianma.Mappings.Article.hbm.xml ---> NHibernate.HibernateException: Could not instantiate dialect class NHibernate.Dialect.OracleDialect ---> System.TypeLoadException: Could not load type NHibernate.Dialect.OracleDialect. Possible cause: no assembly name specified.
   在 NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError)
   在 NHibernate.Util.ReflectHelper.ClassForName(String name)
   在 NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName)
   --- 內部異常堆棧跟蹤的結尾 ---
   在 NHibernate.Dialect.Dialect.InstantiateDialect(String dialectName)
   在 NHibernate.Dialect.Dialect.GetDialect(IDictionary`2 props)
   在 NHibernate.Cfg.Configuration.AddValidatedDocument(NamedXmlDocument doc)
   --- 內部異常堆棧跟蹤的結尾 ---
ERROR Spring.Objects.Factory.Support.DefaultListableObjectFactory -    GetObjectInternal: error obtaining object &NHibernateSessionFactory
ERROR Spring.Objects.Factory.Support.DefaultListableObjectFactory - GetObjectInternal: error obtaining object Spring.Dao.Attributes.PersistenceExceptionTranslationPostProcessor#0

 

配置文件:

 <!-- NHibernate Configuration -->
  <object id="NHibernateSessionFactory" type="Spring.Data.NHibernate.LocalSessionFactoryObject, Spring.Data.NHibernate21">
    <property name="DbProvider" ref="DbProvider"/>
    <property name="MappingAssemblies">
      <list>
        <value>Sietech.Wms.Tianma.Dao.NHibernate</value>
      </list>
    </property>
    <property name="HibernateProperties">
      <dictionary>
        <entry key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider"/>
        <entry key="dialect" value="NHibernate.Dialect.OracleDialect" />
        <entry key="connection.driver_class" value="NHibernate.Driver.OracleClientDriver"/>
        <entry key="show_sql" value="true"/>
        <entry key="hbm2ddl.auto" value="update"/>
        <entry key="use_outer_join"  value="true" />
      </dictionary>
    </property>

    <!-- provides integation with Spring's declarative transaction management features -->
    <property name="ExposeTransactionAwareSessionFactory" value="true" />


  </object>

將方言改成 NHibernate.Dialect.Oracle10gDialect 搞定

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章