How can I access the current ZonedDateTime (or Date) in a "route" when processing with a "timer" loop? - java-8

Background:
The "configure()" method, in the sample code below, loops at specified time interval at which time I wish to log the current "ZonedDateTime.now() value
Problem:
The ZonedDateTime.now() value is always the same value, despite the interval time difference.
Question:
What technique can I used to access the current ZonedDateTime.now() value at each interval?
(NOTE: I ultimately, wish to use this value as a parameter in a REST call)
Sample code:
package aaa.bbb.ccc.dateparmissue;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.cdi.ContextName;
#ContextName("rest-dsl")
public class DateParmIssue extends RouteBuilder {
public DateParmIssue() {
}
private final String codeList = "AA,BB,CC";
private final int notifyTime = 10; //<==10 second interval
#Override
public void configure() throws Exception {
org.apache.log4j.MDC.put("app.name", "dateParmIssue");
System.getProperties().list(System.out);
onException(Exception.class)
.log("onException_processing_exception:" + this.exceptionMessage().toString() + "...send to_error_queue:" + body(String.class).toString())
.handled(true);
from("timer://foo?fixedRate=true&period=" + (notifyTime * 1000))
.setBody(constant(this.codeList))
.to("seda:node0");
from("seda:node0")
.split().tokenize(",")
.to("seda:node1");
from("seda:node1")
.log("seda:node1...body-code=${body}...zdt=" + simple(ZonedDateTime.now().format(DateTimeFormatter.ISO_OFFSET_DATE_TIME)));
}
}
Sample output...
2017-12-27 12:17:11,649 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=AA...zdt=Simple: 2017-12-27T12:17:10.306-05:00
2017-12-27 12:17:11,653 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=BB...zdt=Simple: 2017-12-27T12:17:10.306-05:00
2017-12-27 12:17:11,653 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=CC...zdt=Simple: 2017-12-27T12:17:10.306-05:00
2017-12-27 12:17:21,630 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=AA...zdt=Simple: 2017-12-27T12:17:10.306-05:00
2017-12-27 12:17:21,630 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=BB...zdt=Simple: 2017-12-27T12:17:10.306-05:00
2017-12-27 12:17:21,631 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=CC...zdt=Simple: 2017-12-27T12:17:10.306-05:00
2017-12-27 12:17:31,633 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=AA...zdt=Simple: 2017-12-27T12:17:10.306-05:00
2017-12-27 12:17:31,636 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=BB...zdt=Simple: 2017-12-27T12:17:10.306-05:00
2017-12-27 12:17:31,637 | INFO | 1 - seda://node1 | route3 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | direct:node1...body-code=CC...zdt=Simple: 2017-12-27T12:17:10.306-05:00

It turns out that the "timer" inserts a "firedTime" property in the header that can be used (although it is currently as a java.util.Date object, rather than one of the newer Java 8 date objects - e.g., ZonedDateTime).
So, an alternative might be as follows - i.e., which shows the changing date...
from("seda:node1")
.process(new Processor(){
public void process(Exchange exchange) {
exchange.getIn().setHeader("code", exchange.getIn().getBody().toString());
exchange.getIn().setBody((new Date(exchange.getIn().getHeader("firedTime").toString()).toInstant()).atZone(ZoneId.systemDefault()).format(DateTimeFormatter.ISO_OFFSET_DATE_TIME));
}
})
.log("seda:node1...body-code=${in.header.code}...zdt=${body}");
...and date now changes...
2017-12-28 15:37:18,017 | INFO | 7 - seda://node1 | route17 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | seda:node1...body-code=AA...zdt=2017-12-28T15:37:18-05:00
2017-12-28 15:37:18,019 | INFO | 7 - seda://node1 | route17 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | seda:node1...body-code=BB...zdt=2017-12-28T15:37:18-05:00
2017-12-28 15:37:18,020 | INFO | 7 - seda://node1 | route17 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | seda:node1...body-code=CC...zdt=2017-12-28T15:37:18-05:00
2017-12-28 15:37:28,017 | INFO | 7 - seda://node1 | route17 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | seda:node1...body-code=AA...zdt=2017-12-28T15:37:28-05:00
2017-12-28 15:37:28,017 | INFO | 7 - seda://node1 | route17 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | seda:node1...body-code=BB...zdt=2017-12-28T15:37:28-05:00
2017-12-28 15:37:28,018 | INFO | 7 - seda://node1 | route17 | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | seda:node1...body-code=CC...zdt=2017-12-28T15:37:28-05:00

Related

Config Processing error circle-ci when I do build

I'm facing a problem with Config Processing error (circle-ci).
Material that I use
Aws cloud front
aws s3
circle-ci
situation
I did set up on AWS and added value to Environment Variables (circle-ci ). I did commit on git and build on circle-ci and an error occurs and I could not get out this error.
This is my repo
error
bin/sh -eo pipefail
ERROR IN CONFIG FILE:
[#/jobs] 8 schema violations found
Any string key is allowed as job name.
1. [#/jobs/deploy-to-aws-cloudfront] 0 subschemas matched instead of one
| 1. [#/jobs/deploy-to-aws-cloudfront] only 1 subschema matches out of 2
| | 1. [#/jobs/deploy-to-aws-cloudfront] 3 schema violations found
| | | 1. [#/jobs/deploy-to-aws-cloudfront] required key [steps] not found
| | | 2. [#/jobs/deploy-to-aws-cloudfront/docker/0] 2 schema violations found
| | | | 1. [#/jobs/deploy-to-aws-cloudfront/docker/0] extraneous key [steps] is not permitted
| | | | | Permitted keys:
| | | | | - image
| | | | | - name
| | | | | - entrypoint
| | | | | - command
| | | | | - user
| | | | | - environment
| | | | | - aws_auth
| | | | | - auth
| | | | | Passed keys:
| | | | | - image
| | | | | - working_directory
| | | | | - steps
| | | | 2. [#/jobs/deploy-to-aws-cloudfront/docker/0] extraneous key [working_directory] is not permitted
| | | | | Permitted keys:
| | | | | - image
| | | | | - name
| | | | | - entrypoint
| | | | | - command
| | | | | - user
| | | | | - environment
| | | | | - aws_auth
| | | | | - auth
| | | | | Passed keys:
| | | | | - image
| | | | | - working_directory
| | | | | - steps
| 2. [#/jobs/deploy-to-aws-cloudfront] expected type: String, found: Mapping
| | Job may be a string reference to another job
2. [#/jobs/deploy-to-aws-s3] 0 subschemas matched instead of one
| 1. [#/jobs/deploy-to-aws-s3] only 1 subschema matches out of 2
| | 1. [#/jobs/deploy-to-aws-s3] 3 schema violations found
| | | 1. [#/jobs/deploy-to-aws-s3] required key [steps] not found
| | | 2. [#/jobs/deploy-to-aws-s3/docker/0] 2 schema violations found
| | | | 1. [#/jobs/deploy-to-aws-s3/docker/0] extraneous key [steps] is not permitted
| | | | | Permitted keys:
| | | | | - image
| | | | | - name
| | | | | - entrypoint
| | | | | - command
| | | | | - user
| | | | | - environment
| | | | | - aws_auth
| | | | | - auth
| | | | | Passed keys:
| | | | | - image
| | | | | - working_directory
| | | | | - steps
| | | | 2. [#/jobs/deploy-to-aws-s3/docker/0] extraneous key [working_directory] is not permitted
| | | | | Permitted keys:
| | | | | - image
| | | | | - name
| | | | | - entrypoint
| | | | | - command
| | | | | - user
| | | | | - environment
| | | | | - aws_auth
| | | | | - auth
| | | | | Passed keys:
| | | | | - image
| | | | | - working_directory
| | | | | - steps
| 2. [#/jobs/deploy-to-aws-s3] expected type: String, found: Mapping
| | Job may be a string reference to another job
-------
Warning: This configuration was auto-generated to show you the message above.
Don't rerun this job. Rerunning will have no effect.
false
The reason that the Config processing error was ignoring schema on a circle-ci.
In my case, that's an indentation error.
https://github.com/CircleCI-Public/circleci-cli/issues/326
This post was helpful for solving my error.

How to calculate the "distance" between two rectangles?

Given one rectangle and a bunch of images (also rectangles), I need to find the best image to place in it. That would be the one that requires less stretching or shrinking and that covers the area the best. I want to find the one with the least distance (as in, least transformation) to the target rectangle. The images are screenshots of websites, so, they contain a mix of text and images. The screenshots suffer whether they are stretched (pixelation) or shrunk (text becomes unreadable).
But it also feels like one of these problems that someone might have looked into already and there might be an algorithm to properly solve it.
The data is stored in a SQL database so I would need the analysis to be doable in SQL. The data might look like this:
---------------------------------------------------------
| Id | Width | Height |
---------------------------------------------------------
| 00b701c6-1c31-4323-a292-700b4dff2e45 | 784 | 1310 |
| 0a46a0f6-a3b2-4a5d-a8be-55bad84ba37d | 1414 | 957 |
| 0b79fbe8-6b9e-48d1-89da-8981570e23d7 | 784 | 561 |
| 0e9f5935-0e58-42d2-bba2-3e89db55260f | 400 | 400 |
| 0ebf14fb-094b-47f5-9e25-b4f54bc2eab9 | 2260 | 957 |
| 17131cd6-f5b2-4e4d-a63b-b909e04e2d89 | 1414 | 957 |
| 2298fc73-0bcb-49c8-b54e-3184cf4153d4 | 784 | 1310 |
| 28ffee4a-2d08-4862-aeb0-6546cda4e225 | 2560 | 1387 |
| 29cf92ad-b6fd-43c6-abb1-7c5a7e4af92d | 2260 | 957 |
| 307b2b6e-1f66-4784-bd7d-b6bfc4768fbd | 2560 | 1387 |
| 3edc916b-4b3d-4fd8-a1f9-6418a4d8d27a | 2333 | 435 |
| 3ef1132a-d059-487a-9cad-dbb3895ad25a | 1414 | 957 |
| 43e044e5-5f82-4b86-95ba-a9e76f5d2519 | 657 | 435 |
| 464be0ec-5cb7-4f3f-856d-6beb5fbc2f5e | 657 | 435 |
| 510d0236-e61a-4f1c-bb0b-754c4c1f80f7 | 2260 | 957 |
| 52f217d5-038c-475d-af96-89d1930e8c2f | 657 | 435 |
| 532cadf5-c20b-4b1c-84d4-78e1b501495f | 2333 | 435 |
| 5f3e55aa-12a4-4502-a159-fdc128b53e11 | 2260 | 957 |
| 626c33a9-aaa0-47b6-a6f3-bd5235f1655b | 784 | 561 |
| 6711a717-e1ee-4930-9f21-5e225a99a769 | 657 | 435 |
| 7125c301-c311-4339-b36c-519dc3714c68 | 784 | 561 |
| 8f5d8e3b-8213-4cd6-8ea0-311297f4cfc3 | 2333 | 435 |
| c3d7661f-12e6-4297-8830-15e82850bc32 | 784 | 1310 |
| cd32106e-2f3e-4614-ac40-19e3f5d7fa1f | 784 | 561 |
| d7191194-1f8a-4230-8ee0-8a8b427b86e7 | 784 | 1310 |
| d737de66-849d-4ec3-bf3b-cc48bfa1f3a6 | 2560 | 1387 |
| d935e10b-88f3-4aba-a2b4-a1a9cfd8acb4 | 2560 | 1387 |
| dcc8e9e6-4ee3-4737-a530-d2fcffd35a86 | 2333 | 435 |
| ec3187be-5a81-4ecb-a908-ddedaa5930ec | 1414 | 957 |
---------------------------------------------------------
You can compute the Jaccard index as follows:
function jaccard(rect : Rectangle, img : Rectangle) : float
rectArea := rect.width * rect.height
imgArea := img.width * img.height
interArea := min(rect.width, img.width) * min(rect.height, img.height)
return interArea / (rectArea + imgArea - interArea)
end
Then choose the highest scoring image (values go from zero to one).
I don't have a complete algorithm but my approach would be to score each image based on how good it matches the rectangle. The interesting parameter would the ratio (width/height), so calculate the ratio for each image and compare it to the ratio of the rectangle. The nearest ratio wins.
As for the second problem I'd probably set a threshold, if the ratio of the best fit is really close to the rectangle (below the threshold) you can get away with stretching (looks better than two very thin borders), if it's above the threshold add black borders since distorted text is hideous.

grails webflow notserializableexception

Grails upgrade from 1.3.7 to Grails 2.1.0.
Grails run-app executed. No errors.
Call to webflow action throws GrailsExceptionResolver error. States a grails webflow object isn’t serializable. I have navigated all classes to ensure all have ‘implements serializable’.
Error not identifying object not being serialized, so unable to identify if a class field should be made transient to be ignored by serializable runtime.
Full Stacktrace:
2016-12-20 09:51:25,750 [http-bio-80-exec-1] DEBUG services.RpgService - ************
| Error 2016-12-20 09:51:26,450 [http-bio-80-exec-1] ERROR errors.GrailsExceptionResolver - NotSerializableException occurred when processing request: [GET] /…/…/order
org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext. Stacktrace follows:
Message: Could not serialize flow execution; make sure all objects stored in flow or flash scope are serializable
Line | Method
->> 384 | doFilterInternal in org.jsecurity.web.servlet.JsecurityFilter
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 183 | doFilter in org.jsecurity.web.servlet.OncePerRequestFilter
| 886 | runTask . . . . in java.util.concurrent.ThreadPoolExecutor$Worker
| 908 | run in ''
^ 662 | run . . . . . . in java.lang.Thread
Caused by NotSerializableException: org.codehaus.groovy.grails.commons.spring.GrailsWebApplicationContext
->> 1164 | writeObject0 in java.io.ObjectOutputStream
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 1518 | defaultWriteFields in ''
| 1483 | writeSerialData in ''
| 1400 | writeOrdinaryObject in ''
| 1158 | writeObject0 . . in ''
| 1518 | defaultWriteFields in ''
| 1483 | writeSerialData in ''
| 1400 | writeOrdinaryObject in ''
| 1158 | writeObject0 . . in ''
| 330 | writeObject in ''
| 1001 | writeObject . . in java.util.HashMap
| 940 | invokeWriteObject in java.io.ObjectStreamClass
| 1469 | writeSerialData in java.io.ObjectOutputStream
| 1400 | writeOrdinaryObject in ''
| 1158 | writeObject0 . . in ''
| 1518 | defaultWriteFields in ''
Found the resolution.
My controller service was calling sessionFactory which also needed to be transient.
code change:
def sessionFactory => transient sessionFactory.
Did not need make any domain class variables transient directly.
fixed the issue.

org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-28001: the password has expired )

I have an app that is using Oracle 11g as the db, and we had neglected to set the password expiration to never and the app itself then failed when the original password expired. We corrected that, and reset the password back to the original, and for some reason, while most of the functionality is working properly, part is not (throws the error in title). Below is the output from the log file. I have tried rebooting the server etc, but still get the same issue. Any thought?
Thanks!!!
INFO | jvm 1 | 2012/11/01 13:13:23 | INFO: webClient: Request attributes: [service=tsapprovals][tb=managedresources][oid=][action=splitpanecontroller][orderBy=][sortBy=] from Host[108.28.145.157]
INFO | jvm 1 | 2012/11/01 13:13:23 | AbandonedObjectPool is used (org.apache.commons.dbcp.AbandonedObjectPool#51f1e39b)
INFO | jvm 1 | 2012/11/01 13:13:23 | LogAbandoned: true
INFO | jvm 1 | 2012/11/01 13:13:23 | RemoveAbandoned: true
INFO | jvm 1 | 2012/11/01 13:13:23 | RemoveAbandonedTimeout: 300
INFO | jvm 1 | 2012/11/01 13:13:24 | org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-28001: the password has expired
INFO | jvm 1 | 2012/11/01 13:13:24 | )
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1225)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:880)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.util.DBConnectionFactory.getPooledConnection(DBConnectionFactory.java:459)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.util.DBConnectionFactory.getConnection(DBConnectionFactory.java:242)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.util.DBConnectionFactory.getConnection(DBConnectionFactory.java:221)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.util.DBConnectionFactory.<init>(DBConnectionFactory.java:157)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.util.DBConnectionFactory.getInstance(DBConnectionFactory.java:208)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.report.db.CrossPointDBUtility.<init>(CrossPointDBUtility.java:45)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.report.queries.DBQuery.initialize(DBQuery.java:64)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.report.queries.approval.PendingApprovalsQuery.initialize(PendingApprovalsQuery.java:34)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.web.command.splitpane.services.PendingApprovals.execute(PendingApprovals.java:65)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.web.command.splitpane.SplitPaneCommand.displayControllerPane(SplitPaneCommand.java:120)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.web.command.splitpane.SplitPaneCommand.execute(SplitPaneCommand.java:57)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.web.servlet.CommandProcessor.processAction(CommandProcessor.java:1587)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.web.servlet.CommandProcessor.process(CommandProcessor.java:1156)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.web.servlet.Controller.handleRequest(Controller.java:210)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:358)
INFO | jvm 1 | 2012/11/01 13:13:24 | at isc.thinclient.web.servlet.Controller.doRequest(Controller.java:838)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:317)
INFO | jvm 1 | 2012/11/01 13:13:24 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
INFO | jvm 1 | 2012/11/01 13:13:24 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
INFO | jvm 1 | 2012/11/01 13:13:24 | at java.lang.Thread.run(Thread.java:595)
INFO | jvm 1 | 2012/11/01 13:13:24 | Caused by: java.sql.SQLException: ORA-28001: the password has expired
INFO | jvm 1 | 2012/11/01 13:13:24 |
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:283)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:278)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:791)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:362)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:439)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:165)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:35)
INFO | jvm 1 | 2012/11/01 13:13:24 | at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:801)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:294)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1247)
INFO | jvm 1 | 2012/11/01 13:13:24 | at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1221)
INFO | jvm 1 | 2012/11/01 13:13:24 | ... 34 more
INFO | jvm 1 | 2012/11/01 13:13:24 | loggedInUSer: System Administrator Thu Nov 01 18:13:24 UTC 2012
INFO | jvm 1 | 2012/11/01 13:13:24 | isc.thinclient.api.ThinAPIException: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (ORA-28001: the password has expired
It seems the password for your user profile has been expired, please try to execute the below query which can resolve this issue - for username and password use your values.
ALTER USER username IDENTIFIED BY password;

Load jndi.xml before beans.xml

I have two files beans.xml and jndi.xml. We want to retrieve something in beans.xml that is put into JNDI through jndi.xml. Unfortunately, beans in beans.xml are created before jndi.xml is loaded, so when we try to do the JNDI lookup in beans.xml, nothing is in JNDI. Is there a way to get jndi.xml to be loaded before beans.xml?
beans.xml
...
<bean id="geronimoTransactionManager" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/UserTransaction" />
</bean>
...
jndi.xml
<beans>
<bean id="jndi"
class="org.apache.xbean.spring.jndi.SpringInitialContextFactory"
factory-method="makeInitialContext"
singleton="true">
<property name="entries" ref="jndiEntries" />
</bean>
<map id="jndiEntries">
<entry key="java:comp/UserTransaction" value-ref="geronimoTransactionManager" />
</map>
<bean id="jtaTransactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="userTransaction" ref="geronimoTransactionManager" />
</bean>
<bean id="geronimoTransactionManager" class="org.apache.geronimo.transaction.manager.TransactionManagerImpl" />
</beans>
Here is the log that makes me believe beans.xml is loaded before jndi.xml.
21:43:26,927 | INFO | l Console Thread | ultOsgiApplicationContextCreator | 72 - org.springframework.osgi.extender - 1.2.0 | Discovered configurations {osgibundle:/META-INF/spring/*.xml} in bundle [SWIM Prototype :: AqMqJDBC Pooling (camel-osgi-aqmq)]
21:43:26,939 | INFO | ExtenderThread-4 | OsgiBundleXmlApplicationContext | 61 - org.springframework.context - 3.0.5.RELEASE | Refreshing OsgiBundleXmlApplicationContext(bundle=camel-osgi-aqmq, config=osgibundle:/META-INF/spring/*.xml): startup date [Wed Apr 20 21:43:26 GMT+00:00 2011]; root of context hierarchy
21:43:26,939 | INFO | ExtenderThread-4 | OsgiBundleXmlApplicationContext | 61 - org.springframework.context - 3.0.5.RELEASE | Unpublishing application context OSGi service for bundle SWIM Prototype :: AqMqJDBC Pooling (camel-osgi-aqmq)
21:43:26,973 | INFO | ExtenderThread-4 | XmlBeanDefinitionReader | 59 - org.springframework.beans - 3.0.5.RELEASE | Loading XML bean definitions from URL [bundleentry://202.fwk22939763/META-INF/spring/beans.xml]
21:43:27,295 | INFO | ExtenderThread-4 | CamelNamespaceHandler | 75 - org.apache.camel.camel-spring - 2.6.0.fuse-01-09 | OSGi environment detected.
21:43:29,167 | INFO | ExtenderThread-4 | WaiterApplicationContextExecutor | 72 - org.springframework.osgi.extender - 1.2.0 | No outstanding OSGi service dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=camel-osgi-aqmq, config=osgibundle:/META-INF/spring/*.xml)
21:43:29,283 | INFO | ExtenderThread-5 | DefaultListableBeanFactory | 59 - org.springframework.beans - 3.0.5.RELEASE | Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#77e77a: defining beans [template,consumerTemplate,camel-1:beanPostProcessor,camel-1,required,jtaTransactionManager,geronimoTransactionManager,activeMQ,jmsConnectionFactory,jmsManagedConnectionFactory,jmsResourceAdapter,jencksConnectionManager,jencksPoolingSupport,requiredBeanForOracleAq,oracleQueue,oracleQueueCredentials,aqConnectionFactoryQueue,aqXADataSource,jdbcXADataSource,managedXADataSource,myTransform,preProps,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0]; root of factory hierarchy
21:43:29,736 | INFO | ExtenderThread-5 | OsgiSpringCamelContext | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | JMX enabled. Using ManagedManagementStrategy.
21:43:29,839 | INFO | ExtenderThread-5 | JtaTransactionManager | 74 - org.springframework.transaction - 3.0.5.RELEASE | Using JTA UserTransaction: org.apache.geronimo.transaction.manager.TransactionManagerImpl#1f07586
21:43:29,839 | INFO | ExtenderThread-5 | JtaTransactionManager | 74 - org.springframework.transaction - 3.0.5.RELEASE | Using JTA TransactionManager: org.apache.geronimo.transaction.manager.TransactionManagerImpl#1f07586
21:43:29,839 | INFO | ExtenderThread-5 | JtaTransactionManager | 74 - org.springframework.transaction - 3.0.5.RELEASE | Using JTA TransactionSynchronizationRegistry: org.apache.geronimo.transaction.manager.TransactionManagerImpl#1f07586
21:43:30,104 | INFO | ExtenderThread-5 | OsgiSpringCamelContext | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Apache Camel 2.6.0-fuse-01-09 (CamelContext: 202-camel-3) is starting21:43:30,430 | INFO | ExtenderThread-5 | Activator | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Found 13 #Converter classes to load
21:43:30,469 | INFO | ExtenderThread-5 | Activator | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Found 1 #Converter classes to load
21:43:30,473 | INFO | ExtenderThread-5 | Activator | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Found 1 #Converter classes to load
21:43:30,477 | INFO | ExtenderThread-5 | Activator | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Found 2 #Converter classes to load
21:43:34,173 | INFO | ExtenderThread-5 | OsgiSpringCamelContext | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Route: route1 started and consuming from: Endpoint[activeMQ://queue:BROKER2.QUEUE?concurrentConsumers=10]
21:43:34,194 | INFO | ExtenderThread-5 | OsgiSpringCamelContext | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Total 1 routes, of which 1 is started.
21:43:34,196 | INFO | ExtenderThread-5 | OsgiSpringCamelContext | 68 - org.apache.camel.camel-core - 2.6.0.fuse-01-09 | Apache Camel 2.6.0-fuse-01-09 (CamelContext: 202-camel-3) started in 4.089 seconds
21:43:34,204 | INFO | ExtenderThread-5 | OsgiBundleXmlApplicationContext | 61 - org.springframework.context - 3.0.5.RELEASE | Publishing application context as OSGi service with properties {org.springframework.context.service.name=camel-osgi-aqmq, Bundle-SymbolicName=camel-osgi-aqmq, Bundle-Version=4.3.0.fuse-03-00}
21:43:34,205 | INFO | ExtenderThread-5 | ContextLoaderListener | 72 - org.springframework.osgi.extender - 1.2.0 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=camel-osgi-aqmq, config=osgibundle:/META-INF/spring/*.xml))
21:43:41,674 | INFO | tenerContainer-7 | SpringInitialContextFactory | 110 - org.apache.xbean.spring - 3.7 | Loading JNDI context from: class path resource [jndi.xml]
21:43:41,685 | INFO | tenerContainer-7 | XBeanXmlBeanDefinitionReader | 59 - org.springframework.beans - 3.0.5.RELEASE | Loading XML bean definitions from class path resource [jndi.xml]
In jndi.xml, you should try :
<beans>
<import resource="beans.xml"/>
(...)

Resources