I am using spring boot 1.5.4 with mybatis-spring 3.1. I am able to successfully run my application via eclipse. But when I used commandline (java -jar jarname), I get below exception. my standalone application is stopping. I want to move my app to deploy to different machine with the jar. Please help.
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias 'MyClass'. Cause: java.lang.ClassNotFoundException: Cannot find class: MyCLass at org.apache.ibatis.type.TypeAliasRegistry.resolveAlias(TypeAliasRegistry.java:120) at org.apache.ibatis.builder.BaseBuilder.resolveAlias(BaseBuilder.java:149) at org.apache.ibatis.builder.BaseBuilder.resolveClass(BaseBuilder.java:116) ... 36 more
I resolved the same issue by moving to autoconfigure(using spring properties) I originally had my db configuration(datasource, session factory) configured in a javaconfig class. I'm removed the config and moved my config to my application properties(yml format) .. Below is what I have
mybatis:
typeAliasesPackage: com.wiredinformatics.preauth.domain
spring:
datasource:
url: jdbc:mysql://127.0.0.1:3306/preauth?
useSSL=false&serverTimezone=UTC
username: myuser
password: mypass
dbcp2:
driver: com.mysql.cj.jdbc.Driver
initial-size: 2
max-total: 10
max-idle: 10
min-idle: 5
max-wait-millis: 30000
validation-query: SELECT 1
I haven't had time yet to figure out why having my own java config broke the scanning. It worked ok in eclipse, but failed when running from the command line