I have a test cluster with 2 embedded nodes (Infinispan 12.1.4.Final). I use a replicated cache with RocksDB cache-store. The cache's size is about 4 GB. And sometimes, when I restart nodes, I get that exception, and one of the nodes freezes - it waits for cache rebalance. The replicated cache's configurated like:
<replicated-cache name="event" statistics="true">
<expiration interval="3600000"/>
<persistence>
<rocksdb-store xmlns="urn:infinispan:config:store:rocksdb:12.1" path="rocksdb/data" fetch-state="true">
<expiration path="rocksdb/expired"/>
</rocksdb-store>
</persistence>
<memory max-count="100"/>
<indexing>
<index-reader refresh-interval="5000"/>
<indexed-entities>
<indexed-entity>org.example.model.IndexedEndpointEventModel</indexed-entity>
</indexed-entities>
</indexing>
</replicated-cache>
A whole stack trace:
2021-06-10 19:41:27,993 ERROR [org.inf.sta.StateProviderImpl] (non-blocking-thread--p2-t1) ISPN000261: Failed to execute outbound transfer: org.infinispan.persistence.spi.PersistenceException: java.lang.IllegalStateException: MarshallableUserObject marshaller not overridden in SerializationContext
at org.infinispan.marshall.persistence.impl.MarshallableEntryImpl.unmarshall(MarshallableEntryImpl.java:248)
at org.infinispan.marshall.persistence.impl.MarshallableEntryImpl.unmarshall(MarshallableEntryImpl.java:237)
at org.infinispan.marshall.persistence.impl.MarshallableEntryImpl.getValue(MarshallableEntryImpl.java:81)
at org.infinispan.statetransfer.StateProviderImpl.defaultMapEntryFromStore(StateProviderImpl.java:379)
at io.reactivex.rxjava3.internal.operators.flowable.FlowableMap$MapSubscriber.onNext(FlowableMap.java:64)
at io.reactivex.rxjava3.internal.operators.flowable.FlowableUsing$UsingSubscriber.onNext(FlowableUsing.java:104)
at io.reactivex.rxjava3.internal.util.HalfSerializer.onNext(HalfSerializer.java:45)
at io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatMap$ConcatMapImmediate.innerNext(FlowableConcatMap.java:204)
at io.reactivex.rxjava3.internal.operators.flowable.FlowableConcatMap$ConcatMapInner.onNext(FlowableConcatMap.java:559)
at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$ObserveOnSubscriber.runAsync(FlowableObserveOn.java:402)
at io.reactivex.rxjava3.internal.operators.flowable.FlowableObserveOn$BaseObserveOnSubscriber.run(FlowableObserveOn.java:176)
at io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler$ExecutorWorker$BooleanRunnable.run(ExecutorScheduler.java:322)
at io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler$ExecutorWorker.runEager(ExecutorScheduler.java:287)
at io.reactivex.rxjava3.internal.schedulers.ExecutorScheduler$ExecutorWorker.run(ExecutorScheduler.java:248)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: MarshallableUserObject marshaller not overridden in SerializationContext
at org.infinispan.marshall.protostream.impl.MarshallableUserObject.<init>(MarshallableUserObject.java:44)
at org.infinispan.marshall.protostream.impl.MarshallableUserObject$___Marshaller_ff6b068168b51aac5d0c18c371e02ff55d3bb0cb73296e9cf1f4a65917105dec.read(MarshallableUserObject$___Marshaller_ff6b068168b51aac5d0c18c371e02ff55d3bb0cb73296e9cf1f4a65917105dec.java:49)
at org.infinispan.marshall.protostream.impl.MarshallableUserObject$___Marshaller_ff6b068168b51aac5d0c18c371e02ff55d3bb0cb73296e9cf1f4a65917105dec.read(MarshallableUserObject$___Marshaller_ff6b068168b51aac5d0c18c371e02ff55d3bb0cb73296e9cf1f4a65917105dec.java:15)
at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.unmarshall(ProtobufTagMarshallerDelegate.java:32)
at org.infinispan.protostream.WrappedMessage.readMessage(WrappedMessage.java:539)
at org.infinispan.protostream.WrappedMessage.read(WrappedMessage.java:351)
at org.infinispan.protostream.ProtobufUtil.fromWrappedByteArray(ProtobufUtil.java:129)
at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectFromByteBuffer(AbstractInternalProtoStreamMarshaller.java:97)
at org.infinispan.marshall.persistence.impl.MarshallableEntryImpl.unmarshall(MarshallableEntryImpl.java:246)
... 16 more
Anybody had the same issue?
Edit1:
Add IndexedEndpointEventModel definition:
#Indexed
public class IndexedEndpointEventModel implements Serializable {
private static final Random RANDOM = new Random();
private String field1;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private LocalDateTime field2;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private LocalDateTime field3;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field4;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field5;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field6;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field7;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field8;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field9;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field10;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field11;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private Long field12;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private Integer field13;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private String field14;
#GenericField(projectable = Projectable.YES, searchable = Searchable.YES, sortable = Sortable.YES, aggregable = Aggregable.NO)
private Boolean field15;
private String field16;
private Map<String, List<String>> field17;
private Map<String, List<String>> field18;
public IndexedEndpointEventModel() {
field1 = UUID.randomUUID().toString();
field2 = LocalDateTime.now();
field3 = LocalDateTime.now();
field4 = UUID.randomUUID().toString();
field5 = UUID.randomUUID().toString();
field6 = UUID.randomUUID().toString();
field7 = UUID.randomUUID().toString();
field8 = UUID.randomUUID().toString();
field9 = UUID.randomUUID().toString();
field10 = UUID.randomUUID().toString();
field11 = UUID.randomUUID().toString();
field12 = RANDOM.nextLong();
field13 = RANDOM.nextInt();
field14 = UUID.randomUUID().toString();
field15 = RANDOM.nextBoolean();
field16 = UUID.randomUUID().toString();
field17 = Map.of(UUID.randomUUID().toString(), List.of(UUID.randomUUID().toString(), UUID.randomUUID().toString()));
field18 = Map.of(UUID.randomUUID().toString(), List.of(UUID.randomUUID().toString()), UUID.randomUUID().toString(), List.of(UUID.randomUUID().toString()));
}
// Setters/Getters
}
Edit2:
Additional exception stack trace (with await-initial-transfer="false"):
2021-06-11 21:29:57,973 ERROR [org.inf.int.imp.InvocationContextInterceptor] (non-blocking-thread--p2-t12) ISPN000136: Error executing command PutKeyValueCommand on Cache 'event', writing keys [cc05c0d7-b984-485d-8afd-298743550a7b]: java.lang.IllegalStateException: MarshallableUserObject marshaller not overridden in SerializationContext
at org.infinispan.marshall.protostream.impl.MarshallableUserObject.<init>(MarshallableUserObject.java:44)
at org.infinispan.marshall.protostream.impl.MarshallableUserObject$___Marshaller_ff6b068168b51aac5d0c18c371e02ff55d3bb0cb73296e9cf1f4a65917105dec.read(MarshallableUserObject$___Marshaller_ff6b068168b51aac5d0c18c371e02ff55d3bb0cb73296e9cf1f4a65917105dec.java:49)
at org.infinispan.marshall.protostream.impl.MarshallableUserObject$___Marshaller_ff6b068168b51aac5d0c18c371e02ff55d3bb0cb73296e9cf1f4a65917105dec.read(MarshallableUserObject$___Marshaller_ff6b068168b51aac5d0c18c371e02ff55d3bb0cb73296e9cf1f4a65917105dec.java:15)
at org.infinispan.protostream.impl.ProtobufTagMarshallerDelegate.unmarshall(ProtobufTagMarshallerDelegate.java:32)
at org.infinispan.protostream.WrappedMessage.readMessage(WrappedMessage.java:539)
at org.infinispan.protostream.WrappedMessage.read(WrappedMessage.java:351)
at org.infinispan.protostream.ProtobufUtil.fromWrappedByteArray(ProtobufUtil.java:129)
at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectFromByteBuffer(AbstractInternalProtoStreamMarshaller.java:97)
at org.infinispan.marshall.protostream.impl.AbstractInternalProtoStreamMarshaller.objectFromByteBuffer(AbstractInternalProtoStreamMarshaller.java:92)
at org.infinispan.persistence.rocksdb.RocksDBStore.unmarshall(RocksDBStore.java:524)
at org.infinispan.persistence.rocksdb.RocksDBStore.unmarshall(RocksDBStore.java:531)
at org.infinispan.persistence.rocksdb.RocksDBStore.putExpireDbData(RocksDBStore.java:1106)
at org.infinispan.persistence.rocksdb.RocksDBStore.addNewExpiry(RocksDBStore.java:551)
at org.infinispan.persistence.rocksdb.RocksDBStore.access$1200(RocksDBStore.java:82)
at org.infinispan.persistence.rocksdb.RocksDBStore$RocksDBHandler.lambda$write$2(RocksDBStore.java:753)
at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1736)
at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
at java.base/java.lang.Thread.run(Thread.java:834)
Related
I have spring boot hibernate TestRestTemplate project, and running "mvn test" with it.
I have two database tables: Customer and ShippingAddress:
public class Customer implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Basic(optional = false)
private Integer id;
#Basic(optional = false)
#Column(name = "first_name")
private String firstName;
#Basic(optional = false)
#Column(name = "last_name")
private String lastName;
#Basic(optional = false)
private String phone;
#Basic(optional = false)
#Column(name = "email_address")
private String emailAddress;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
private Collection<Product> productCollection;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
private Collection<PurchaseOrder> purchaseOrderCollection;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "customer")
private Collection<Review> reviewCollection;
#OneToMany(cascade = CascadeType.ALL, mappedBy = "customer", orphanRemoval = true)
private List<ShippingAddress> shippingAddressCollection = new ArrayList<>();
And the ShippingAddress table:
public class ShippingAddress implements Serializable {
private static final long serialVersionUID = 1L;
#Id
#GeneratedValue(strategy = GenerationType.IDENTITY)
#Basic(optional = false)
#Column(name = "id")
private Integer id;
#Basic(optional = false)
#NotNull
#Size(min = 1, max = 100)
#Column(name = "address1")
private String address1;
#Basic(optional = false)
#NotNull
#Size(min = 1, max = 100)
#Column(name = "address2")
private String address2;
#Basic(optional = false)
#NotNull
#Size(min = 1, max = 30)
#Column(name = "city")
private String city;
#Basic(optional = false)
#NotNull
#Size(min = 1, max = 30)
#Column(name = "state")
private String state;
#Basic(optional = false)
#NotNull
#Size(min = 1, max = 30)
#Column(name = "postcode")
private String postcode;
#JoinColumn(name = "cust_id", referencedColumnName = "id") // id is the primary key in Customer table
#ManyToOne(optional = false)
private Customer customer;
ShippingAddressControllerRestTemplateTest Controller:
#Test
public void create_shipping_address_and_customer() throws Exception {
Customer newCustomer = new Customer("wendy", "hades", "myname#shipping.com", "04000000");
ShippingAddress shippingAddress1 = new ShippingAddress("unit 1", "89 hanson road", "New York", "CA", "KKKDLDL");
shippingAddress1.setCustomer(newCustomer);
// ShippingAddress shippingAddress2 = new ShippingAddress("", "111 green st", "MA", "CA", "AAAAA");
// shippingAddress2.setCustomer(newCustomer);
ArrayList<ShippingAddress> shippingAddressList = new ArrayList<>();
shippingAddressList.add(shippingAddress1);
// shippingAddressList.add(shippingAddress2);
newCustomer.setShippingAddressCollection(shippingAddressList);
System.out.println("*****CustomerControllerRestTemplateTest***in save_save_OK() **********");
HttpEntity<Customer> requestBody = new HttpEntity<>(newCustomer);
ResponseEntity<String> response = restTemplate.postForEntity("/addcustomer", requestBody, String.class);
assertEquals(HttpStatus.CREATED, response.getStatusCode());
}
Exceptions from running "mvn test":
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.069 s <<< FAILURE! - in dorinca_rest.controller.ShippingAddressControllerRestTemplateTest
[ERROR] create_shippi`enter code here`ng_address_and_customer(dorinca_rest.controller.ShippingAddressControllerRestTemplateTest) Time elapsed: 0.057 s <<< ERROR!
org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON:`enter code here` Infinite recursion (StackOverflowError);
The StackOverflowError error seems to be my two tables are referencing to each other, but it isn't the case after I take a closer look at it. And I am not sure the way I am using restTemplate.PostForEntity() is correct. I basically posting a list / collection for the PostMapping. The Customer table and the ShippingAddress table has only one way referencing, that is one to many relationship.
I can see how shouldquote works with c# but does anyone have an example in vb.net?
I need to wrap every field with chr(34)
Private Sub Main()
Dim records = New List(Of Foo) From {
New Foo With {
.Id = 1,
.Name = "one"
}
}
Dim config = New CsvConfiguration(CultureInfo.InvariantCulture) With {
.ShouldQuote = Function(args) True
}
Using csv = New CsvWriter(Console.Out, config)
csv.WriteRecords(records)
End Using
End Sub
Public Class Foo
Public Property Id As Integer
Public Property Name As String
End Class
I have to convert my c# into vb but it didn't convert 100%, I'm stuck on adding items to lists with class objects.
I get error here (Value of type 'Boolean' cannot be converted to '_Default.Courses') on the course list add:
Public Class Courses
Public courseName As String
Public qualName As String
Public providerName As String
End Class
...
While r.Read
Dim coursename As String = r("courseName").ToString
Dim qualname As String = r("qualName").ToString
Dim providername As String = r("providerName").ToString
courseList.Add(New Courses() With {
Key.courseName = coursename,
Key.qualName = qualname,
Key.providerName = providername
})
End While
...
And this is the original c# code:
while (r.Read())
{
string coursename = r["courseName"].ToString();
string qualname = r["qualName"].ToString();
string providername = r["providerName"].ToString();
courseList.Add(new Courses
{
courseName = coursename,
qualName = qualname,
providerName = providername
});
}
Change your code as :
While r.Read
Dim coursename As String = r("courseName").ToString
Dim qualname As String = r("qualName").ToString
Dim providername As String = r("providerName").ToString
courseList.Add(New Courses() With {
.courseName = coursename,
.qualName = qualname,
.providerName = providername
})
End While
I have this code from obsolete dll's,
It works, but I know there are new dll's Google.Apis.Auth.OAuth2 - Can I still use it?
Public sub Activate
_parameters = New Google.GData.Client.OAuth2Parameters With {
.ClientId = CLIENT_ID,
.ClientSecret = CLIENT_SECRET,
.RedirectUri = REDIRECT_URL,
.Scope = "https://docs.google.com/feeds/ ",
.State = "documents",
.AccessType = "offline"
}
Dim url As String = Google.GData.Client.OAuthUtil.CreateOAuth2AuthorizationUrl(_parameters)
context.WebRoot.Response.Redirect(url, False)
End Sub
Public Sub CallBack()
Dim state As String = context.WebRoot.Request.QueryString("state")
If Not state Is Nothing Then
_parameters.AccessCode = .WebRoot.Request.QueryString("code")
Google.GData.Client.OAuthUtil.GetAccessToken(_parameters)
End If
End Sub
I am trying to pass several search parameters to an LINQ expression to retrieve all entries that contain one of the search items.
Example:
Dim query = From p In db.BEW_PROFIL
For Each searchItem As String In searchItems
Dim item As String = searchItem
query = query.Where(Function(p) p.NAME = item)
Next
Problem here is I don´t get any results because the Where clause looks with that code something like this.
... Where p.NAME = item1 AND p.NAME = item2
What i need is an OR between the parameters, but I don´t get it how I can achieve this.
Any help would be greatly appreciated.
Got it...
void Main()
{
var searchItems = new string[] { "test", "past", "most", "last", "fast", "feast", "yeast", "cast" };
var query = from p in searchItems select new MyClass { Name = p };
Predicate<MyClass> whereClause = _ => false;
foreach (var item in searchItems)
{
var searchItem = item;
Predicate<MyClass> oldClause = whereClause;
whereClause = p => p.Name == searchItem || oldClause(p);
}
query = query.Where(p => whereClause(p));
query.Dump();
}
public class MyClass
{
public MyClass() { }
public string Name { get; set; }
}
The code was ran in LINQPad, and that returned every element.
Here is that code translated to Vb.Net
Private Sub Main()
Dim searchItems = New String() {"test", "past", "most", "last", "fast", "feast", "yeast", "cast"}
Dim query = From p In searchItems Select New [MyClass]() With { .Name = p }
Dim whereClause As Predicate(Of [MyClass]) = Function(element) False
For Each item As String In searchItems
Dim searchItem = item
Dim oldClause As Predicate(Of [MyClass]) = whereClause
whereClause = Function(p) p.Name = searchItem OrElse oldClause(p)
Next
query = query.Where(Function(p) whereClause(p))
query.Dump()
End Sub
Public Class [MyClass]
Public Sub New()
End Sub
Public Property Name() As String
Get
Return m_Name
End Get
Set
m_Name = Value
End Set
End Property
Private m_Name As String
End Class