शुरू करने में असमर्थ मेरे पास स्प्रिंग बूट एप्लिकेशन है। यह 2 सर्वर पर चलता है। सर्वरों में एक ही विन्यास है। इस यह काम करता है में से एक से एक है ... जब यहस्प्रिंगबूट - एम्बेडेड टॉमकैट
2016-04-26 08:24:17.633 ERROR [localhost-startStop-1]: Error starting Tomcat context: org.springframework.beans.factory.BeanCreationException
2016-04-26 08:24:17.903 ERROR [main]: Application startup failed
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:766)
at org.springframework.boot.SpringApplication.createAndRefreshContext(SpringApplication.java:361)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1191)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1180)
at it.besmart.parkserver.StartServer.main(StartServer.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:54)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:99)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:76)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:457)
at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:168)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:160)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
... 14 more
स्टैक ट्रेस पंक्तियों का एक बहुत के लिए जारी है शुरू कर दूसरे पर मैं इस अपवाद हो रही है, ज्यादातर मैं ऑटो तारों और इंजेक्शन लगाने गतिविधियों के बारे में समस्याओं मिलता है, मूल कारण से
Invocation of init method failed; nested exception is org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
लेकिन मेरे db.properties फ़ाइल है:
jdbc.driverClassName = com.mysql.jdbc.Driver
jdbc.url = jdbc:mysql://192.168.3.240:3306/SMARTPARK?useSSL=false
jdbc.username = parkuser
jdbc.password = xxxxxxxxxxxxxxxx
hibernate.dialect = org.hibernate.dialect.MySQLDialect
hibernate.show_sql = false
hibernate.format_sql = false
डीबी चल रहा है (दूसरे सर्वर नियमित रूप से उससे कनेक्ट हो ..) और सभी विशेषाधिकार उपयोगकर्ताओं और मेजबान सही हैं
यह मेरा pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.besmart</groupId>
<artifactId>eparkserver</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>eparkserver</name>
<description>ePark server</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<start-class>it.besmart.parkserver.StartServer</start-class>
<!--
<tomcat.version>8.0.29</tomcat.version>
-->
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>com.pi4j</groupId>
<artifactId>pi4j-core</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>server-copy</id>
<goals>
<goal>run</goal>
</goals>
<phase>package</phase>
<configuration>
<target>
<echo message="Push to server /home/pi/park/" />
<scp trust="yes" todir="pi:[email protected]:/home/pi/park/">
<fileset dir="${basedir}/target">
</fileset>
</scp>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-jsch</artifactId>
<version>1.9.6</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
मेरे सभी हाइबरनेट सेटिंग्स HibernateConfiguration.class में हो रहा है
@Configuration
@EnableTransactionManagement
@ComponentScan({ "it.besmart" })
@PropertySource(value = { "classpath:db.properties" })
public class HibernateConfiguration {
@Autowired
private Environment environment;
@Bean
public LocalSessionFactoryBean sessionfactory(){
LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setPackagesToScan(new String[] {"it.besmart.models"});
sessionFactory.setHibernateProperties(hibernateProperties());
return sessionFactory;
}
@Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName(environment.getRequiredProperty("jdbc.driverClassName"));
dataSource.setUrl(environment.getRequiredProperty("jdbc.url"));
dataSource.setUsername(environment.getRequiredProperty("jdbc.username"));
dataSource.setPassword(environment.getRequiredProperty("jdbc.password"));
return dataSource;
}
private Properties hibernateProperties() {
Properties properties = new Properties();
properties.put("hibernate.dialect", environment.getRequiredProperty("hibernate.dialect"));
properties.put("hibernate.show_sql", environment.getRequiredProperty("hibernate.show_sql"));
properties.put("hibernate.format_sql", environment.getRequiredProperty("hibernate.format_sql"));
return properties;
}
@Bean
@Autowired
public HibernateTransactionManager transactionManager(SessionFactory s) {
HibernateTransactionManager txManager = new HibernateTransactionManager();
txManager.setSessionFactory(s);
return txManager;
}
}
(मैं वसंत बूट करने के लिए स्प्रिंग MVC से इस एप्लिकेशन को चले गए)
मुझे नहीं पता कि क्या हो रहा है
वसंत बूट सामान्य रूप से अपने डेटासोर्स और EntityManagerFactory को कॉन्फ़िगर करता है ... आपने जो प्रदान किया है उसके बजाय अपना खुद का निर्माण क्यों चुना है? यह हो सकता है कि यह आपकी खुद की कॉन्फ़िगरेशन में हस्तक्षेप कर रहा है। दूसरा सर्वर भी सर्वर से कनेक्ट करने में सक्षम है, यानी फ़ायरवॉल नियम इत्यादि। –
आप 'db.properties' कैसे लोड कर रहे हैं? । स्प्रिंग बूट मानक ['application.properties'] है (https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external- config-प्रोफ़ाइल विशिष्ट-गुण)। –
संपादित मूल प्रश्न, मेरे पास एक हाइबरनेट कॉन्फ़िगरेशन क्लास है क्योंकि मैंने वसंत एमवीसी से बूट करने के लिए ऐप को दोहराया। लेकिन ऐप एक सर्वर पर काम करता है, और हमेशा काम करता है ... – besmart