|
|
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
Пытался подключить jpa к spring вылетала hibernate.dialect must be set. Смотрел туториал http://www.javavids.com/video/spring-web-app-tutorial-5-twitter-bootstrap.html скачал проект их на гитхабе https://github.com/jirkapinkas/java-blog-aggregator Запустил и тоже получил такую ошибку, а у них все норм. Что я делаю не так? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 02:04 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
sergey_magicПытался подключить jpa к spring вылетала hibernate.dialect must be set. Смотрел туториал http://www.javavids.com/video/spring-web-app-tutorial-5-twitter-bootstrap.html скачал проект их на гитхабе https://github.com/jirkapinkas/java-blog-aggregator Запустил и тоже получил такую ошибку, а у них все норм. Что я делаю не так? Вы свое окружение проверили? Откуда запускаете (IDE или консоль)? Все нужные инструменты у вас есть? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 06:56 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
mad_nazgul, Eclispe. С двух компьютеров пытался. Да вроде есть. А какие именно должны быть? А у вас этот проект без ошибок запускается? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:07 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
sergey_magic, Вот тут приводил исходный код. http://vk.com/wall-1279_29726 Можете посмотреть ? Мучаюсь уже 3 дня ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:09 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
sergey_magic, Можно полный stacktrace ошибки посмотреть? Maven подключен? JDBC драйвер на месте? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:13 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
Blazkowicz, 09:23:01,433 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) JBAS015003: Found sampleBlog.war in deployment directory. To trigger deployment create a file called sampleBlog.war.dodeploy 09:23:06,451 INFO [org.jboss.as.server.deployment] (MSC service thread 1-14) JBAS015876: Starting deployment of "sampleBlog.war" 09:23:07,530 INFO [org.jboss.as.jpa] (MSC service thread 1-16) JBAS011401: Read persistence.xml for sampleBlog 09:23:07,641 WARN [org.jboss.as.ee] (MSC service thread 1-10) JBAS011006: Not installing optional component org.springframework.web.context.request.async.StandardServletAsyncWebRequest due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.springframework.web.context.request.async.StandardServletAsyncWebRequest at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:606) at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] 09:23:07,648 WARN [org.jboss.as.ee] (MSC service thread 1-10) JBAS011006: Not installing optional component org.springframework.http.server.ServletServerHttpAsyncRequestControl due to exception: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011054: Could not find default constructor for class org.springframework.http.server.ServletServerHttpAsyncRequestControl at org.jboss.as.ee.component.ComponentDescription$DefaultComponentConfigurator.configure(ComponentDescription.java:606) at org.jboss.as.ee.component.deployers.EEModuleConfigurationProcessor.deploy(EEModuleConfigurationProcessor.java:81) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final] at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] 09:23:07,697 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-10) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1) 09:23:07,710 INFO [org.jboss.as.jpa] (MSC service thread 1-16) JBAS011402: Starting Persistence Unit Service 'sampleBlog.war#sampleBlog' 09:23:07,711 INFO [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-16) HHH000204: Processing PersistenceUnitInfo [ name: sampleBlog ...] 09:23:07,722 WARN [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC service thread 1-16) HHH000181: No appropriate connection provider encountered, assuming application will be supplying connections 09:23:07,723 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-16) MSC00001: Failed to start service jboss.persistenceunit."sampleBlog.war#sampleBlog": org.jboss.msc.service.StartException in service jboss.persistenceunit."sampleBlog.war#sampleBlog": Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51] Caused by: javax.persistence.PersistenceException: [PersistenceUnit: sampleBlog] Unable to build EntityManagerFactory at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889) at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162) at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] ... 3 more Caused by: org.hibernate.HibernateException: Connection cannot be null when 'hibernate.dialect' not set at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:97) at org.hibernate.service.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:67) at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:176) at org.hibernate.service.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:75) at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:159) at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:131) at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:71) at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2270) at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2266) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1735) at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84) at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904) ... 9 more 09:23:07,931 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "sampleBlog.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"sampleBlog.war#sampleBlog\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"sampleBlog.war#sampleBlog\": Failed to start service"}} 09:23:07,993 INFO [org.jboss.as.server.deployment] (MSC service thread 1-9) JBAS015877: Stopped deployment sampleBlog.war in 61ms 09:23:07,994 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report JBAS014777: Services which failed to start: service jboss.persistenceunit."sampleBlog.war#sampleBlog": org.jboss.msc.service.StartException in service jboss.persistenceunit."sampleBlog.war#sampleBlog": Failed to start service 09:23:07,995 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"sampleBlog.war#sampleBlog\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"sampleBlog.war#sampleBlog\": Failed to start service"}}}} ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:24 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
maven подключен. jdbc драйвер тоже. Вот pom.xml http://pastebin.com/BD5LJUZL ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:26 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
Понял в чем дело. В примере и у вас DataSource, EMF и т.п. прописаны в Spring XML файлах. Но JBoss обнаружил в проекте JPA PersistenceUnit: Processing PersistenceUnitInfo [name: sampleBlog] Для которого не указаны ни правильный DataSource, ни настройки. По stacktrace видно, что проблемный вызов идет из JBoss без всяких Spring. persistence.xml есть в проекте? Откуда взялся? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:32 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
Blazkowicz, да есть persistance. я там прописывал просто классы <?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="sampleBlog"> <class>com.simple.entity.User</class> <class>com.simple.entity.Role</class> <class>com.simple.entity.Blog</class> </persistence-unit> </persistence> eclipse ругается если удаляю persistance.xml по туториалу делал все. ссылка выше ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:36 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
вообще же он должен смотреть изначально настройки из spring.xml ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:38 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
sergey_magiceclipse ругается если удаляю persistance.xml И? sergey_magicпо туториалу делал все. ссылка выше В проекте на github я этого файла не нашел. Смотреть 6 минут какое-то не внятное видео у меня желания нет. В чем именно проблема, вроде, объяснил. В целом нужно знать следующее. Есть JEE спецификация. И JEE технологии, такие как JPA. Можно писать JEE приложения без Spring. Есть полезный инструментарий - Spring, которые многие ценят по ряду причин. Так вот, нужно точно разделять, где у вас pure JEE, где Spring и где интеграция одного с другим. В вашем коде, создаётся EntityManagerFactory полностью Spring-ом. А падает потому что у вас так же есть JEE PersistenceUnit, который не доконфигурирован. И про ваш Spring-овый EntityManagerFactory он ничего не знает. Вам нужно выбрать, как именно вы хотите конфигурять JPA и оставить только один способ из двух. А тыкание в непонятные видео мне напоминает вот это ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:42 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
Blazkowicz, Спасибо! есть этот файл https://github.com/jirkapinkas/java-blog-aggregator/blob/master/src/main/java/META-INF/persistence.xml ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:45 |
|
||
|
spring + jpa hibernate.dialect
|
|||
|---|---|---|---|
|
#18+
sergey_magicесть этот файл https://github.com/jirkapinkas/java-blog-aggregator/blob/master/src/main/java/META-INF/persistence.xml Автор деплоит на какой-то Heroku. Вы на JBoss. Не все сервера одинаково полезны для кривых туториалов. Нафига там PU не совсем понятно. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 25.07.2014, 10:48 |
|
||
|
|

start [/forum/topic.php?fid=59&msg=38705556&tid=2126846]: |
0ms |
get settings: |
6ms |
get forum list: |
16ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
162ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
50ms |
get tp. blocked users: |
1ms |
| others: | 193ms |
| total: | 443ms |

| 0 / 0 |
