在 Web 应用程序中启动 Hibernate Search 时出错
有人可以帮忙吗,我将 hibernate 搜索放在我的网络应用程序中并收到以下错误:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost/postgres</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">noor</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="current_session_context_class">thread</property>
<property name="hibernate.search.default.indexBase">
/users/application/indexes
</property>
<property name="hibernate.search.default.indexBase">
/users/application/indexes
</property>
<mapping resource="com/BiddingSystem/Models/Users.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/ForumTopic.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/ForumMessage.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Administrator.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/PersonalUser.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/BusinessUser.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/BusinessContactNumbers.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Attribute.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/AttributeOption.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Category.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Item.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Auction.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Picture.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Bid.hbm.xml"/>
</session-factory>
</hibernate-configuration>
堆栈跟踪:
org.hibernate.HibernateException: could not init listeners
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1980)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
at com.BiddingSystem.server.ServiceImpl.<init>(ServiceImpl.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: org.hibernate.search.SearchException: Unable to initialize directory provider: com.BiddingSystem.Models.ForumMessage
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:169)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProviders(DirectoryProviderFactory.java:100)
at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:375)
at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:262)
at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:144)
at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:137)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
... 28 more
Caused by: org.hibernate.search.SearchException: Unable to create index directory: C:\users\application\indexes for index com.BiddingSystem.Models.ForumMessage
at org.hibernate.search.store.DirectoryProviderHelper.makeSanityCheckedDirectory(DirectoryProviderHelper.java:252)
at org.hibernate.search.store.DirectoryProviderHelper.getVerifiedIndexDir(DirectoryProviderHelper.java:234)
at org.hibernate.search.store.FSDirectoryProvider.initialize(FSDirectoryProvider.java:62)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:166)
... 36 more
can someone help, I placing hibernate search in my web app and getting the following error:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.postgresql.Driver</property>
<property name="hibernate.connection.url">jdbc:postgresql://localhost/postgres</property>
<property name="hibernate.connection.username">postgres</property>
<property name="hibernate.connection.password">noor</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="current_session_context_class">thread</property>
<property name="hibernate.search.default.indexBase">
/users/application/indexes
</property>
<property name="hibernate.search.default.indexBase">
/users/application/indexes
</property>
<mapping resource="com/BiddingSystem/Models/Users.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/ForumTopic.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/ForumMessage.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Administrator.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/PersonalUser.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/BusinessUser.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/BusinessContactNumbers.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Attribute.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/AttributeOption.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Category.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Item.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Auction.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Picture.hbm.xml"/>
<mapping resource="com/BiddingSystem/Models/Bid.hbm.xml"/>
</session-factory>
</hibernate-configuration>
Stack Trace:
org.hibernate.HibernateException: could not init listeners
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:205)
at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1980)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
at com.BiddingSystem.server.ServiceImpl.<init>(ServiceImpl.java:87)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
at org.mortbay.jetty.servlet.Holder.newInstance(Holder.java:153)
at org.mortbay.jetty.servlet.ServletHolder.getServlet(ServletHolder.java:339)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:463)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
Caused by: org.hibernate.search.SearchException: Unable to initialize directory provider: com.BiddingSystem.Models.ForumMessage
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:169)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProviders(DirectoryProviderFactory.java:100)
at org.hibernate.search.spi.SearchFactoryBuilder.initDocumentBuilders(SearchFactoryBuilder.java:375)
at org.hibernate.search.spi.SearchFactoryBuilder.buildNewSearchFactory(SearchFactoryBuilder.java:262)
at org.hibernate.search.spi.SearchFactoryBuilder.buildSearchFactory(SearchFactoryBuilder.java:144)
at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:137)
at org.hibernate.event.EventListeners$1.processListener(EventListeners.java:198)
at org.hibernate.event.EventListeners.processListeners(EventListeners.java:181)
at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:194)
... 28 more
Caused by: org.hibernate.search.SearchException: Unable to create index directory: C:\users\application\indexes for index com.BiddingSystem.Models.ForumMessage
at org.hibernate.search.store.DirectoryProviderHelper.makeSanityCheckedDirectory(DirectoryProviderHelper.java:252)
at org.hibernate.search.store.DirectoryProviderHelper.getVerifiedIndexDir(DirectoryProviderHelper.java:234)
at org.hibernate.search.store.FSDirectoryProvider.initialize(FSDirectoryProvider.java:62)
at org.hibernate.search.store.DirectoryProviderFactory.createDirectoryProvider(DirectoryProviderFactory.java:166)
... 36 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查看您在 Windows 上工作时的错误消息:
但是,在配置中指定索引基本 unix 样式:/users/application/indexes
索引基目录需要存在,并且它需要是操作系统的有效目录路径。
Looking at the error message you are working on Windows:
However, in the configuration you specify the index base unix style: /users/application/indexes
The index base directory needs to exist and it needs to be a valid directory path for your OS.
您的解决方案可能位于此处
Your solution may be here