I have an application based on spring-boot 1.4 with spring-jdbc.
I've added Flyway, which works in the application itself, but I get errors for my JdbcDAO test cases.
Question: I know spring-boot overrides 'dataSource' to embedded HSQLDB datasource, but I have no idea where it finds the SQL scripts to populate the empty database when I run tests.
Documentation says that it looks for 'schema.sql' or 'data.sql' in classpath, but I've renamed all of the script files in both main and test resource paths, but I still get this error:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed;
nested exception is org.flywaydb.core.api.FlywayException: Found non-empty schema(s) "PUBLIC" without schema history table! Use baseline() or set baselineOnMigrate to true to initialize the schema history table.
This error leads me to believe that Spring-boot had created a schema definition BEFORE Flyway scripts were applied.
UPDATE: I'm getting a different error now, this is a Bad SQL error:
org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [INSERT INTO BLUECOST_SSCDATA (SSCDATAID,PROCESSGROUPID,COSTINGAMOUNT,CHRG_TYP_CD,CONTROL_GROUP_CD,ACCOUNT_ID,CHRGHS_END_DT,ORIG_LOC_CD,SERVICE_TYP_CD,SERVICE_CD,SERVICE_GROUP_ID,SERVICE_ENV_CD,SERVICE_ADDER_CD,SERVICE_RESTYP_CD,RATECLAS_CD,PRICELST_UP_AMT,CHRGHS_USAGE_QTY,EMP_FA_CD,EMP_DIV_CD,EMP_DPT_CD,EMP_COUNTRY_CD,EMP_COMPANY_CD,EMP_NUM,EMP_INITS,EMP_LASTNAME,USER_ID,ADJUSTMENT_ID,CUST_REFERENCE_ID,ORIG_DIV_CD,ORIG_DPT_ID,ORIG_COUNTRY_CD,ORIG_COMPANY_CD,LOCAL_FIELD_1,LOCAL_FIELD_2,LOCAL_FIELD_3,LOCAL_FIELD_4,LOCAL_FIELD_5,LOCAL_FIELD_6,CREATETIME,PROCESSTIME,LAST_ALTER_TMS,TRX_TYP_CD,FILENAME) VALUES (100,null,368.60,'CTA','EMEA ','D286148 ','2018-03-19','SLR','SLR','SLIC','BASE',null,null,null,'OGS',null,null,null,null,null,null,null,null,null,'IBM SLIC BV',null,null,null,null,null,'653','SOFTLAYR','INVCE ID','X91927','ACCNT ID','FILENAME1.XLS',null,null,{ts '2018-04-22 01:30:21.437000'},null,{ts '2018-03-22 01:32:21.437000'},'I','FILENAME1.XLS')]; nested exception is java.sql.SQLSyntaxErrorException: requires either DEFAULT keyword or OVERRIDING clause
at com.ibm.cio.cloud.cost.spreadsheet.dao.UTJdbcBluecostSSCDataDAOTest.testDeleteBluecostSSCDataByLocalField2AndLocalField4(UTJdbcBluecostSSCDataDAOTest.java:265)
Caused by: java.sql.SQLSyntaxErrorException: requires either DEFAULT keyword or OVERRIDING clause
at com.ibm.cio.cloud.cost.spreadsheet.dao.UTJdbcBluecostSSCDataDAOTest.testDeleteBluecostSSCDataByLocalField2AndLocalField4(UTJdbcBluecostSSCDataDAOTest.java:265)
Caused by: org.hsqldb.HsqlException: requires either DEFAULT keyword or OVERRIDING clause
at com.ibm.cio.cloud.cost.spreadsheet.dao.UTJdbcBluecostSSCDataDAOTest.testDeleteBluecostSSCDataByLocalField2AndLocalField4(UTJdbcBluecostSSCDataDAOTest.java:265)
This gives me a clue: looks like my latest Flyway script is not applied to the schema when running the 'mvn test' goal.
How do I turn on the debugging to see what is happening with Flyway when running mvn test goal?
Fixed - retracting this question now.
<logger name="org.flywaydb" level="DEBUG">
<appender-ref ref="STDOUT"/>
</logger>
I am using minikube. I have a service named updatedaddress. I am calling updateaddress service from updatecustomer service using auto injection of kubernetes environment variables .
My Java code looks like this
#Value("${UPDATEADDRESS_SERVICE_HOST}")
private String updateAddressHost;
#Value("${UPDATEADDRESS_SERVICE_PORT}")
private String updateAddressPort;
...
greeting= restTemplate.getForEntity("http://"+updateAddressHost+":"+updateAddressPort+"/updateaddress", Greeting.class).getBody();
When I execute the following command
kubectl --namespace=default-staging exec updatecustomer-4023824433-r5r19 env
I can see the environment variables UPDATEADDRESS_SERVICE_HOST=10.0.0.180 and UPDATEADDRESS_SERVICE_PORT=80 among many other variables.
When I try building the spring boot service I get the error
Error creating bean with name 'updateCustomerInfoResilient': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.amwater.UpdateCustomerInfoResilient.updateAddressHost; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'UPDATEADDRESS_SERVICE_HOST' in string value "${UPDATEADDRESS_SERVICE_HOST}"
Any advice would be helpful. Thank you .
Instated of using server IP and port number, try to use the service DNS name and test the application.
It will be something like this my-svc.my-namespace.svc.cluster.local replace your servicename and namespace.
here is the documentation https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/
I am trying to set java options for my spring application in open shift and its not working. I tried exporting JAVA_OPTIONS and _JAVA_OPTIONS in my app and still I see a file not found exception in my spring initialization exception.
I am trying to load a properties file in spring which is picked based on the environment variable
stack trace:
org.springframework.beans.factory.BeanInitializationException: Could not load properties; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/config_${targetEnv}.properties]
any help is appreciated.
You should be using the JAVA_OPTS_EXT environment variable to set any extra JAVA_OPTS that you would like your application to use.
I have deployed ear files in oracle weblogic server and i also configured datasource for that project. When i try to test it it is giving me this error.
"Message icon - Error weblogic.application.ModuleException: :org.springframework.beans.factory.BeanDefinitionStoreException:Invalid bean definition with name 'userContext' defined in class path resource [voyager-seats-usercontext.xml]: Could not resolve placeholder 'IDM.USERNAME'
Message icon - Warning Errors were encountered while performing this operation."
I restarted and reconfigured this app still it is giving error.
I'm running into problems with JMS in Oracle AS 10.1.3.3.
The error I am getting is 'connectors\ojms.rar (The system cannot find the path specified)' from EM.
Below are a few bullets on the environment.
This is on a Windows XP SP3 machine.
All configuration is through EM.
The EM is a local instance that has been used for over a year.
This instance has existing db connection management exposed through JNDI.
Oracle_home is set to the directory where I unzip the OC4J zip file. c:\oc4j_10.1.3.3.
ojms.rar file is in %ORACLE_HOME%\j2ee\home\connectors
Configuring OC4J for JMS with Database Persistence
I've create a new data connection for Oracle AQ and exposed the connection through JNDI as jms/flexc
When creating the Resource Adapter through EM, I'm providing the following information:
Resource Name: JMS on FlexC
Adding a new resource
Name : jmsFlexc
Datasource JNDI : jms/flexc (selected from dropdown box)
Very quickly, I get the error below:
An error has occurred.
connectors\ojms.rar (The system cannot find the path specified)
connectors\ojms.rar (The system cannot find the path specified)
[Select to hide information] Hide Additional Trace Information
oracle.sysman.ias.studio.j2ee.deploy.DeployUtil$DeploymentFailureException at
oracle.sysman.ias.studio.j2ee.deploy.DeployUtil.deployArchive(DeployUtil.java:211) at
oracle.sysman.ias.studio.j2ee.deploy.DeployUtil.deployArchive(DeployUtil.java:85) at
oracle.sysman.ias.studio.oc4j.jms.JMXDeployDbProviderAdminBean.deployDBProviderAndConfigure(JMXDeployDbProviderAdminBean.java:121) at
oracle.sysman.ias.studio.oc4j.jms.DeployDbProviderHelper.deployDBProvider(DeployDbProviderHelper.java:242) at
oracle.sysman.ias.studio.oc4j.jms.DeployDbProviderHelper.handleEvent(DeployDbProviderHelper.java:127) at
oracle.sysman.ias.studio.sdk.AbstractController.handleEvent(AbstractController.java:769) at
oracle.sysman.emSDK.svlt.PageHandler.handleRequest(PageHandler.java:378) at
oracle.sysman.emSDK.svlt.EMServlet.myDoGet(EMServlet.java:765) at
oracle.sysman.emSDK.svlt.EMServlet.doGet(EMServlet.java:283) at
oracle.sysman.ias.studio.app.StudioConsole.doGet(StudioConsole.java:385) at
oracle.cabo.servlet.UIXServlet.doPost(Unknown Source) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:763) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at
com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65) at
oracle.sysman.ias.studio.app.BrowserVersionFilter.doFilter(BrowserVersionFilter.java:75) at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15) at
oracle.sysman.ias.studio.app.MultipleJVMFilter.doFilter(MultipleJVMFilter.java:85) at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17) at
oracle.sysman.ias.studio.app.PostLogonFilter.doFilter(PostLogonFilter.java:80) at
com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:17) at
oracle.sysman.ias.studio.app.ShortHostnameRedirectFilter.doFilter(ShortHostnameRedirectFilter.java:68) at
com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:621) at
com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:370) at
com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:871) at
com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:453) at
com.evermind.server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:221) at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:122) at
com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:111) at
oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at
oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:239) at
oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:34) at
oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:880) at
com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at
java.lang.Thread.run(Thread.java:619) Caused by: oracle.oc4j.admin.jmx.shared.exceptions.JMXRuntimeException: connectors\ojms.rar (The system cannot find the path specified) at
oracle.oc4j.admin.jmx.shared.util.JarTool.(JarTool.java:122) at
oracle.sysman.ias.studio.j2ee.deploy.DeployPageUtil.getArchiveType(DeployPageUtil.java:105) at
oracle.sysman.ias.studio.j2ee.deploy.DeployUtil.deployArchive(DeployUtil.java:133) ... 33 more Caused by: java.io.FileNotFoundException: connectors\ojms.rar (The system cannot find the path specified) at
java.util.zip.ZipFile.open(Native Method) at
java.util.zip.ZipFile.(ZipFile.java:114) at
java.util.jar.JarFile.(JarFile.java:135) at
java.util.jar.JarFile.(JarFile.java:99) at
oracle.oc4j.admin.jmx.shared.util.JarTool.(JarTool.java:119) ... 35 more
Discovered that this is a bug in OC4J.
The solution was found by a colleague as a comment made to this blog
I also got an error when deploying the
resource adapter. I found that this
was a bug in Oracle Standalone
10.1.3.3.0 (bug 6786060 on Metalink) and can be solved either by using
10.1.3.2.0 or by starting Oracle standalone without the ORACLE_HOME
environment variable. This is made by
the command "java -jar oc4j.jar". I
used the last solution and it worked
fine for me.