JOOQ record caching exception - redis

I am trying to cache JOOQ record result using redis. But the same is throwing the following error:
org.springframework.data.redis.serializer.SerializationException: Cannot serialize; nested exception is org.springframework.core.serializer.support.SerializationFailedException: Failed to serialize object using DefaultSerializer; nested exception is java.io.NotSerializableException: org.jooq.impl.Utils$Cache$Key
Any suggestion how to fix this?

This seems to be the same issue as https://github.com/jOOQ/jOOQ/issues/5290, which is a bug in jOOQ 3.8.1
I can see two workarounds around this issue:
You explicitly "detach" your records prior to serialisation in redis by calling Record.detach()
You turn off automatic attaching of records to the creating Configuration using the Settings.attachRecords property
In both cases, should you wish to retrieve a record from redis and store it again, you will need to explicitly call Record.attach(Configuration)

Related

Mule Dataweave : There is no variable named 'lookup'

I am trying to use the lookup function in a dataweave script but I am getting the error from the question "There is no variable named 'lookup'". Has anyone come across this and know how to fix it?
I am using Mule 3.7.1
Update
This works at runtime, but won't give a preview, is there a way to make a preview work when using lookup?
This is not possible during designtime in the current versions of Mule 3.7.x / 3.8.x and the current versions of Studio.
The invocation of the flow you are calling via DataWeave's lookup function only happens at execution time. I had a look in latest 3.8.5, you won't see the error but null as a value for the lookup.
Metadata population via DataSense from the flow that will be called doesn't come through via this function in Dataweave.
Debugging may also gave you a hard time in 3.7.x but improved in 3.8.x, so you can see the behaviour and values to and from the flow you execute the lookup to.

ravendb index replication with nservicebus

In an attempt to make the index replication more robust in RavenDB's latest stable build, I was looking to introduce NServiceBus into a custom index replciation bundle, such that inside ReplicateToSqlIndexUpdateBatcher dispose when it dequeues the commands and opens a connection to sql to execute, I did rather put them on a bus and process later in a failure tolerant way. I have put the relevant config entries on raven.server.exe.config, given a IStartableBus to the ctor of ReplicateToSqlIndexUpdateBatcher, inside the dispose method of ReplicateToSqlIndexUpdateBatcher I get IBus from the IStartableBus, dequeue the command, map it to a message and Bus.Send it, but some how I keep getting no message destination specified as an error in raven studio. I have added the message mappings to the config, and also tried adding it programmatically using the fluent interface when obtaining a IStartableBus, but to no avail.
What am I missing here?
There is no need to do so.
We have a new SQL Replication bundle that will handle this scenario robustly.

Exception [EclipseLink-2004]

I'm having the following issue since a bunch of weeks. See the pastebin link here
link was deleted and no more accurate with the question
here's the Runtime context :
GWT 2.4.0
Oracle 11g
EclipseLink Implementation-Version: 1.1.4.v20100812-r7860 (META-INF)
<persistence-unit name="EXPRESSO_resourceLocalUnit"
transaction-type="RESOURCE_LOCAL">
Tt happens only and always at application first time call, at that time the applications loads data from database to fill a Grid. Wether the exception is raised or not, data is loaded correctly.
No transaction is used while loading data (i.e: no tx.begin() is used)
Thanks in advance.
Pleaes turn logging on to Finest to see what objects are involved, and check if you have any event methods such as postload etc that might result in an exception or perform some operation on the EntityManager.
If the data is populated fine my guess is that it is because your application is handling the exception from the find call and continuing its processing. The stack indicates that the problem is occuring in a finally block, so it is difficult to determine if the exception is the result of another exception occuring in the try block.
EclipseLink 1.1.4 is rather old, so you might also want to try EclipseLink 2.3.3 or later just to verify that the underlying cause wasn't already fixed, or that it might give a better exception.

Multithreading with SQLite and Objective-C

I have a couple of threads and I'm using SQLite for storage. When I'm trying to access the database I'm getting SQLITE_BUSY error.
Is there a way how to fix this problem other than trying at each request ?
You are most likely running in serialized mode. But ... you're probably looking to run in multi-threaded mode instead. Note that you will need a separate database connection in each thread if you go that route.
Here is the link to the documentation goodness: http://www.sqlite.org/threadsafe.html
Ignore my last answer.
You can use the sqlite3_errmsg function to get the error message as string and print it using NSLog or other ways as soon as error occurs to find the more appropriate and proper reason.
http://www.sqlite.org/c3ref/errcode.html
You probably seem to be running in to serialization issue; I am not sure where.

Can I implement if-new-create JPA strategy?

My current persistence.xml table generation strategy is set to create. This guarantees that each new installation of my application will get the tables, but that also means that everytime the application it's started logs are polluted with exceptions of eclipselink trying to create tables that already exist.
The strategy I wish is that the tables are created only in their absence. One way for me to implement this is to check for the database file and if doesn't exist create tables using:
ServerSession session = em.unwrap(ServerSession.class);
SchemaManager schemaManager = new SchemaManager(session);
schemaManager.createDefaultTables(true);
But is there a cleaner solution? Possibly a try-catch way? It's errorprone for me to guard each database method with a try-catch where the catch executes the above code, but I'd expect it to be a property I can configure the emf with.
The Table creation problems should only be logged at the warning level. So you could filter these out by setting the log level higher than warning, or create a seperate EM that mirrors the actual application EM to be used just for table creation but with logging turned off completely.
As for catching exceptions from createDefaultTables - there shouldn't be any. The internals of createDefaultTables wrap the actual createTable portion and ignores the errors that it might throw. So the exceptions are only showing in the log due to the log level including warning messages. You could wrap it in a try/catch and set the session log level to off, and then reset it in the finally block though.