Я знаю, что проблема выглядит довольно старой, но я буду признателен за любые предложения. Поскольку хост-сервер принимает только Tomcat 8, я изменил проект, который отлично работал с Tomee Plume: внес также некоторые изменения в Tomcat 8.5 (добавьте jar, например, catalina-ws, jaxrp c -1.4.0, wsdl4j.wso2- 1.6.3.wso2v3),
Теперь, как ни странно, ни один проект, и ни один Tocat 9 не работает с mySQL.
Файл pom:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.12</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.9</version>
</dependency>
</dependencies>
@SpringBootApplication(exclude = { SecurityAutoConfiguration.class })
@EnableJpaAuditing
@EntityScan(basePackages = "ro.prj.mysqlsboot.model")
@EnableJpaRepositories(basePackages = "ro.prj.mysqlsboot.model")
@ComponentScan(basePackages = "ro.prj.mysqlsboot.controller")
public class MysqlSbootApplication {
public static void main(String[] args) throws IOException {
SpringApplication.run(MysqlSbootApplication.class, args);
}
}
@Repository
@Component
public interface CondRepository extends JpaRepository<Cond, Integer>{
}
@Service
@RestController
@EntityScan(basePackages = "ro.rodit.mysqlsboot.model")
public class Controller {
@Autowired
CondRepository condRepo;
@GetMapping({"/login", ""})
public String getView() {
return "index";
}
@GetMapping("/gd")
@ResponseBody
public ModelAndView getId(@RequestParam Integer id) {
ModelAndView mv = new ModelAndView("index");
Cond cd = condRepo.findById(id).orElse(new Cond());
mv.addObject(cd);
return mv;
}
}
Класс сущности:
@Entity
public class Cond {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@NotFound(action = NotFoundAction.IGNORE)
private Integer id;
//the other parameters, incl. getter & setters ...
}
Некоторые сообщения кота:
13-Jan-2020 12:09:08.045 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deployment of deployment descriptor [C:\TomeePlume\apache-tomee-plume-7.0.0-M1\conf\Catalina\localhost\mavenMobils.xml] has finished in [8,748] ms
Hibernate:
select
cond0_.id as id1_0_0_,
cond0_.ecran as ecran2_0_0_,
cond0_.fcorectie_aer_liber as fcorecti3_0_0_,
cond0_.fcorectie_f1 as fcorecti4_0_0_,
cond0_.fcorectie_f2 as fcorecti5_0_0_,
cond0_.gradul_de_incarcare as gradul_d6_0_0_,
cond0_.i_adm as i_adm7_0_0_,
cond0_.i_adm_efg as i_adm_ef8_0_0_,
cond0_.izolatie as izolatie9_0_0_,
cond0_.k1 as k10_0_0_,
cond0_.k2 as k11_0_0_,
cond0_.manta as manta12_0_0_,
cond0_.material_cu_al as materia13_0_0_,
cond0_.mod_pozare55 as mod_poz14_0_0_,
cond0_.nr_cond_incarcate as nr_cond15_0_0_,
cond0_.rezist_termica_sol as rezist_16_0_0_,
cond0_.sectiunen as sectiun17_0_0_,
cond0_.temp_ambianta_de_referinta as temp_am18_0_0_,
cond0_.temp_funct_adm as temp_fu19_0_0_,
cond0_.temp_solului as temp_so20_0_0_,
cond0_.tensiune as tensiun21_0_0_
from
cond cond0_
where
cond0_.id=?
2020-01-13 12:09:16.153 TRACE 4064 --- [io-8080-exec-47] o.h.type.descriptor.sql.BasicBinder : binding parameter [1] as [INTEGER] - [11]
13-Jan-2020 12:09:18.052 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Deploying deployment descriptor [C:\TomeePlume\apache-tomee-plume-7.0.0-M1\conf\Catalina\localhost\account.xml]
13-Jan-2020 12:09:18.053 WARNING [ContainerBackgroundProcessor[StandardEngine[Catalina]]] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke The path attribute with value [/account] in deployment descriptor [C:\TomeePlume\apache-tomee-plume-7.0.0-M1\conf\Catalina\localhost\account.xml] has been ignored
13-Jan-2020 12:09:18.054 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.tomee.catalina.TomcatWebAppBuilder.init ------------------------- localhost -> /account
13-Jan-2020 12:09:18.197 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke Creation of the naming context failed: [javax.naming.OperationNotSupportedException: Context is read only]
13-Jan-2020 12:09:18.568 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.ConfigurationFactory.configureApplication Configuring enterprise application: D:\NBean\Projects\Spring\gihub\registration-login-spring-xml-maven-jsp-mysql-master\registration-login-spring-xml-maven-jsp-mysql-master\target\account-1.0-SNAPSHOT
13-Jan-2020 12:09:18.738 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.ConfigurationFactory.configureService Configuring Service(id=account-1.0-SNAPSHOT/jdbc/TestDB, type=Resource, provider-id=ProvidedByTomcat)
13-Jan-2020 12:09:18.740 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.ConfigurationFactory.configureService Configuring Service(id=account-1.0-SNAPSHOT/jdbc/pol, type=Resource, provider-id=ProvidedByTomcat)
13-Jan-2020 12:09:18.740 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createRecipe Creating Resource(id=account-1.0-SNAPSHOT/jdbc/TestDB)
13-Jan-2020 12:09:18.745 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createRecipe Creating Resource(id=account-1.0-SNAPSHOT/jdbc/pol)
13-Jan-2020 12:09:18.748 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/account-1.0-SNAPSHOT/jdbc/TestDB' in bean account.Comp380682656 to Resource(id=account-1.0-SNAPSHOT/jdbc/TestDB)
13-Jan-2020 12:09:18.748 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/jdbc/TestDB' in bean account.Comp380682656 to Resource(id=account-1.0-SNAPSHOT/jdbc/TestDB)
13-Jan-2020 12:09:18.748 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/account-1.0-SNAPSHOT/jdbc/pol' in bean account.Comp380682656 to Resource(id=account-1.0-SNAPSHOT/jdbc/pol)
13-Jan-2020 12:09:18.749 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.AutoConfig.processResourceRef Auto-linking resource-ref 'openejb/Resource/jdbc/pol' in bean account.Comp380682656 to Resource(id=account-1.0-SNAPSHOT/jdbc/pol)
13-Jan-2020 12:09:18.782 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.config.AppInfoBuilder.build Enterprise application "D:\NBean\Projects\Spring\gihub\registration-login-spring-xml-maven-jsp-mysql-master\registration-login-spring-xml-maven-jsp-mysql-master\target\account-1.0-SNAPSHOT" loaded.
13-Jan-2020 12:09:18.783 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.createApplication Assembling app: D:\NBean\Projects\Spring\gihub\registration-login-spring-xml-maven-jsp-mysql-master\registration-login-spring-xml-maven-jsp-mysql-master\target\account-1.0-SNAPSHOT
12:09:19.026 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
12:09:19.113 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO o.h.validator.internal.util.Version - HV000001: Hibernate Validator 5.2.1.Final
13-Jan-2020 12:09:19.115 INFO [ContainerBackgroundProcessor[StandardEngine[Catalina]]] org.apache.openejb.assembler.classic.Assembler.destroyApplication Undeploying app: D:\NBean\Projects\Spring\gihub\registration-login-spring-xml-maven-jsp-mysql-master\registration-login-spring-xml-maven-jsp-mysql-master\target\account-1.0-SNAPSHOT
13-Jan-2020 12:09:19.115 SEVERE [ContainerBackgroundProcessor[StandardEngine[Catalina]]] jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke ContainerBase.removeChild: destroy:
org.apache.catalina.LifecycleException: An invalid Lifecycle transition was attempted ([before_destroy]) for component
StandardEngine[Catalina].StandardHost[localhost].StandardContext[/account]] in state [STARTING_PREP]