Apache Netbeans 12.4 with eclipseLink 2.1 / Payara Server 5.20 - Converter class specified was not found - eclipselink

The goal is to use persistence with a class that contains a geometry information and to store this information into an Oracle SDO_GEOMETRY field.
Tools used :
Apache Netbeans 12.4 with eclipseLink 2.1 driver
Payar Server 5.2021 for application deployment
The class calls a class transformer to transform JGeometry type to MDSYS_SDO_GEOMETRY expected by Oracle if I understand well. It looks like :
Adresse.java class with converter call: java class
My persistence file looks like : persistence.xml
I used "eclipselink.classloader" but it seems not to solve the problem.
When executing the appplication the server returns this error :
Exception Description: Predeployment of PersistenceUnit [com.spt_adressagenumerique_war_1.0-SNAPSHOTPU] failed.
Internal Exception: Exception [EclipseLink-7351] (Eclipse Persistence Services - 2.7.7.payara-p3): org.eclipse.persistence.exceptions.ValidationException
Exception Description:
The converter class [org.eclipse.persistence.platform.database.oracle.converters.JGeometryConverter] specified on the mapping attribute [position_gps] from the class [com.spt.database.Adresse]
was not found. Please ensure the converter class name is correct and exists with the persistence unit definition.

I finally found the following solution :
Use of eclipse IDE 2021-06
Use of hibernate instead of eclipseLink
Use of hibernate-spatial and indication of org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect in hibernate.cfg.xml
Creation of a geometry point Point G2D based on org.geolatte.geom
Mapping with the same type in the class definition.
With this solution no need to get sdoapi.jar from Oracle installation.
Thanks and may this solution helpful .

Related

Is there transaction support (TransactionalOperator) for Spring Web Flux projects using Spring Data Neo4j?

I tried using TransactionalOperator in the following component:
#Component
class OrganisationHandler(
private val repository: OrganisationRepository,
private val operator: TransactionalOperator
) { ... }
Starting the application results in the following error:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of constructor in com.keen.backend.organisation.OrganisationHandler required a bean of type 'org.springframework.transaction.reactive.TransactionalOperator' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'transactionalOperator' in 'TransactionAutoConfiguration' not loaded because #ConditionalOnSingleCandidate (types: org.springframework.transaction.ReactiveTransactionManager; SearchStrategy: all) did not find any beans
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.transaction.reactive.TransactionalOperator' in your configuration.
I used this documentation as reference. I also stumbled upon this blog post from a year ago. It doesn't seem like there's any SDN implementation of AbstractReactiveTransactionManager to use with TransactionalOperator#create(ReactiveTransactionManager). I couldn't find any relevant ticket on the feature either.
Is there a workaround or perhaps a different approach to transactions for SDN in a Web Flux environment?

apache camel REST failing with [Error creating bean with name 'rest-configuration']

My route looks like below -
#Override
public void configure() throws Exception {
from("kafka:adapterTopic")
.to("rest://post:gatewayinbound-dev11.devsite.com");
}
I have tried with this as well,
.to("rest:post:gatewayinbound-dev11.devsite.com");
and this as well,
restConfigutation().host("gatewayinbound-dev11.devsite.com");
from("kafka:adapterTopic")
.to("rest:post:provideStatus/");
I have tried with camel-rest-starter dependency in the classpath and without it as well.
I have tried putting camel-rest instead of camel-rest-starter in the pom.
But nothing is making the exception go away, below is the stacktrace-
{"timestamp":"2020-04-21 18:17:45.327","severity":"ERROR","class":"org.springframework.boot.SpringApplication","crId":"","msg":"Application run failed","exception":"org.apache.camel.RuntimeCamelException","cause":"org.apache.camel.FailedToCreateRouteException: Failed to create route route10 at: >>> To[rest:post:gatewayinbound-dev11.devsite.com] <<< in route: Route(route10)[[From[kafka:adapterTopic]] -> [To[rest:... because of Failed to resolve endpoint: rest:\/\/post:gatewayinbound-dev11.devsite.com due to: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rest-configuration' defined in class path resource [org\/apache\/camel\/model\/rest\/springboot\/RestConfigurationDefinitionAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.camel.spi.RestConfiguration]: Factory method 'configureRestConfigurationDefinition' threw exception; nested exception is java.lang.IllegalArgumentException: Cannot configure option [useXForwardHeaders] with value [true] as the bean class [org.apache.camel.spi.RestConfiguration] has no suitable setter method, or not possible to lookup a bean with the id [true] in Spring Boot registry"
Please help me here. Looking at the examples at Camel's website it looks quite easy to configure a rest producer endpoint but for me it has been very difficult.
Edit-
As Rest component is part of camel-core, I was using camel-core-2.22.1.
Then as suggested by Raúl Cancino, I tried this as well-
to("rest:post:provideStatus?host=gatewayinbound-dev11.devsite.com:443")
please try the following uri format on your to(), as a starting point:
to("rest:post:provideStatus?host=gatewayinbound-dev11.devsite.com:443")
then you can switch to rest configuration
restConfiguration().host("gatewayinbound-dev11.devsite.com:443");
also, using camel-http this would be:
.setHeader(Exchange.HTTP_METHOD,constant(org.apache.camel.component.http.HttpMethods.POST))
.to("https:gatewayinbound-dev11.devsite.com/provideStatus?bridgeEndpoint=true")
Hope it works for you
The problem was with the version of camel-core library my applcation was using (as transitive dependency), when I switched to camel-core-2.24.2 the problem got resolved.
I compared org.apache.camel.spi.RestConfiguration classes from both versions of camel-core, 2.22.1 and 2.24.2 and found that property useXForwardHeaders was missing in older version.

NoValueFactoryException when using Zeroc Ice - Sliced vs. compact format?

I am trying to use an Ice client in an OSGi context. Running the server and a minimal example client in a non-OSGi environment works fine. With the client in an OSGi environment I get the following exception:
com.zeroc.Ice.NoValueFactoryException
reason = "no value factory found and compact format prevents slicing (the sender should use the sliced format instead)"
type = "::MyModule::Knowledge::CMKnowledge"
However, I am not 100% sure, if the OSGi runtime makes a difference here. The Slice file looks like this:
module MyModule{
module Knowledge{
class KnowledgePart{
string value;
}
class FMKnowledge extends KnowledgePart{}
class CMKnowledge extends KnowledgePart{}
interface IKnowledge{
void sendKnowledge(KnowledgePart knowledge);
FMKnowledge getFMKnowledge();
CMKnowledge getCMKnowledge();
}
}
}
What does this exception mean in this context and how can I fix it? I already tried to set ["format:sliced"] instead of the implicitly used compact format.
The error mean that Ice run-time try to load MyModule.Knowledge.CMKnowledge class but it failed to do so. You must ensure that the class loader used by the application can load MyModule.Knowledge.CMKnowledgeclass.
See also https://doc.zeroc.com/ice/3.7/language-mappings/java-mapping/custom-class-loaders

Error while setting up Spring Data JPA Read-Only Repository

Spring Boot: 1.3.0.RC1
Spring Boot Starter JPA: 1.3.0.RC1
Having an issue with setting up a Spring Data JPA Read Only Repository.
#NoRepositoryBean
public interface ReadOnlyRepository<T, ID extends Serializable> extends Repository<T, ID> {
T findOne(ID id);
Iterable<T> findAll();
Iterable<T> findAll(Sort sort);
Page<T> findAll(Pageable pageable);
}
Using IntelliJ 15 I am getting this compile error:
Error:(16, 83) java: type org.springframework.stereotype.Repository does not take parameters
The error points at this bit of code: Repository<T, ID>
Has something changed within Spring Data JPA? Am I doing something wrong?
Following examples as listed here: Fine-tuning Spring Data repositories
The error points in the right direction. IntelliJ 15 when using ctrl space pulls the Repository Stereotype import org.springframework.stereotype.Repository rather than the correct import org.springframework.data.repository.
If you type quickly and don't notice the wrong import you will receive the error above.

The server encountered an error processing the request. See server logs for more details

I have a simple problem.
I've created a WCF Data Service 5.6 in visual studio 2013, and in its *.svc.cs file, modified line
public class CustomdataService : DataService< /* TODO: put your data source class name here */ >
to connect my entities
public class CustomdataService : DataService< SchedulerEntities >
But when I want to see the service in browser it gives me following error
Request Error
The server encountered an error processing the request. See server logs for more details.
The entity framework is nothing but a single table...
The actual error can be different. In my case I got the same general error message when starting with AdventureWorks2012 database.
So the actual problem can be seen by appending an attribute to the service class as described at here:
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class WcfDataServiceAW : EntityFrameworkDataService<AdventureWorks2012Entities> { ... }
Hope it helps someone.
PS. My error is:
The exception message is 'The property 'SpatialLocation' on type 'Address' is of type 'Geography' which is not a supported primitive type.'.
It seems that Entity Framework 6 and WCF Data Services 5.6.0 need some provider to work together, read more on Using WCF Data Services 5.6.0 with Entity Framework 6+.
You can download the provider simply by using NuGet Package Console Manager:
Install-Package Microsoft.OData.EntityFrameworkProvider -Pre
Its version is alpha 2, so in future, search for final release. it worked for me however.
Final thing is, instead of using DataService<T>, you need to use EntityFrameworkDataService<T>. T is the name of your entities.
According to this post, you have to change inherited type of CustomdataService.
Replace the base type of your DataService. For EF 5 or below, your data service should inherit from DataService where T is a DbContext or ObjectContext. For EF 6 or greater, your data service should inherit from EntityFrameworkDataService where T is a DbContext. See What’s the difference between DataService and EntityFrameworkDataService below for more details.
go to edmx, in the diagram, remove all the tables until the only one you want is remain,
then should be okay, cannot have all the tables, this is what I found,
KT Wong