camel jpa waiting for namespace handlers - jpa

I'm trying to write a RouteTest class for my camel jpa example and it does not work as expected because of the following line :
Bundle RouteTest is waiting for namespace handlers [http://aries.apache.org/xmlns/jpa/v1.1.0]
Please find here blueprint.xml file
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.1.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
http://aries.apache.org/xmlns/jpa/v1.1.0 http://aries.apache.org/schemas/jpa/jpa_110.xsd">
<bean id="jpa" class="org.apache.camel.component.jpa.JpaComponent">
<jpa:unit unitname="persistence-pu" property="entityManagerFactory" />
</bean>
<camelContext trace="true" id="blueprintContext" xmlns="http://camel.apache.org/schema/blueprint">
<route id="persist">
<from uri="direct:persist"/>
<to uri="jpa:Person"/>
</route>
</camelContext>
</blueprint>
and here RouteTest class :
public class RouteTest extends CamelBlueprintTestSupport {
#Override
protected String getBlueprintDescriptor() {
return "/OSGI-INF/blueprint/blueprint.xml";
}
#Test
public void testRoute() throws Exception {
getMockEndpoint("mock:result").expectedMinimumMessageCount(1);
ProducerTemplate producerTemplate = new DefaultCamelContext().createProducerTemplate();
Person person = new Person();
person.setName("Bob");
producerTemplate.sendBody("direct:persist", person);
// assert expectations
assertMockEndpointsSatisfied();
}
}

you need to provide Aries Blueprint, and especially you need to provide the aries JPA dependencies. How do you Test your Routes? I'd suggest using Pax-Exam or probably better to use Pax-Exam-Karaf and intall the aries jpa features.

Related

Apache Camel invoke SOAP service cast problem

I am new in Apache Camel and I use Red Hat CodeReady Studio 12.16.0.GA. I want invoke soap web service. I have used this example https://tomd.xyz/camel-consume-soap-service/
This is my camel context file
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:camel-cxf="http://camel.apache.org/schema/cxf"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring https://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<bean class="org.apache.cxf.transport.common.gzip.GZIPInInterceptor" id="gZipInInterceptor"/>
<bean
class="org.apache.cxf.transport.common.gzip.GZIPOutInterceptor" id="gZipOutInterceptor"/>
<camel-cxf:cxfEndpoint
address="http://webservices.oorsprong.org/websamples.countryinfo/CountryInfoService.wso"
id="fullCountryInfoResponseClient" serviceClass="org.oorsprong.websamples_countryinfo.CountryInfoServiceSoapType">
<camel-cxf:inInterceptors>
<ref bean="gZipInInterceptor"/>
</camel-cxf:inInterceptors>
<camel-cxf:outInterceptors>
<ref bean="gZipOutInterceptor"/>
</camel-cxf:outInterceptors>
</camel-cxf:cxfEndpoint>
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" id="bean-66d2672d-c6c0-4984-bc31-90bc30bfaaef"/>
<camelContext id="camel"
xmlns="http://camel.apache.org/schema/spring" xmlns:order="http://fabric8.com/examples/order/v7">
<route id="simple-route">
<from id="_to2" uri="timer:timerName?delay=0&repeatCount=1"/>
<setBody id="_setBody2">
<constant>"US"</constant>
</setBody>
<bean beanType="com.example.GetFullCountryInfoBuilder"
id="_bean1" method="getFullCountryInfo"/>
<setHeader headerName="operationNamespace" id="_setHeader1">
<constant>http://www.oorsprong.org/websamples.countryinfo</constant>
</setHeader>
<setHeader headerName="operationName" id="_setHeader2">
<constant>FullCountryInfo</constant>
</setHeader>
<to id="_to1" uri="cxf:bean:fullCountryInfoResponseClient"/>
<bean beanType="com.example.GetFullCountryInfoBuilder"
id="_bean2" method="getFullCountryInfoOutput"/>
<log id="_log1" message=">>>${body}"/>
</route>
</camelContext>
</beans>
this is my input bean
public class GetFullCountryInfoBuilder {
public GetFullCountryInfoBuilder() {}
#Bean
public FullCountryInfo getFullCountryInfo(#Body String id) {
FullCountryInfo request = new FullCountryInfo();
request.setSCountryISOCode(id);
return request;
}
#Bean
public String getFullCountryInfoOutput(#Body FullCountryInfoResponse response) {
String ret = response.getFullCountryInfoResult().getSName() + " - " + response.getFullCountryInfoResult().getSCapitalCity() + " - " + response.getFullCountryInfoResult().getSCurrencyISOCode();
return ret;
}
}
Still get error org.apache.cxf.interceptor.Fault: org.oorsprong.websamples.FullCountryInfo cannot be cast to java.lang.String
It looks like CXF don't handle FullCountryInfo object but String and Camel tries to convert it.
When I change return of getFullCountryInfo to String this exception disappear but couple of another come in.
Caused by: org.apache.camel.InvalidPayloadException: No body available of type: org.oorsprong.websamples.FullCountryInfoResponse but has value: [org.oorsprong.websamples.TCountryInfo#3c5110df] of type: org.apache.cxf.message.MessageContentsList on: Message[].
Caused by: [org.apache.camel.NoTypeConversionAvailableException - No type converter available to convert from type: org.apache.cxf.message.MessageContentsList to the required type: org.oorsprong.websamples.FullCountryInfoResponse with value [org.oorsprong.websamples.TCountryInfo#3c5110df]] Caused by: No type converter available to convert from type: org.apache.cxf.message.MessageContentsList to the required type: org.oorsprong.websamples.FullCountryInfoResponse with value [org.oorsprong.websamples.TCountryInfo#3c5110df]. Exchange[ID-sw70-1599555257341-0-1].
So input for CXF is not an object as is described in example but string.
Output of CXF is org.apache.cxf.message.MessageContentsList that you have to convert to string to log it. I have used getFullCountryInfoOutput bean in this case.

JPA not generating ddl files

I'm setting up a JavaEE Webapplication and want to generate ddl files so I can see what they look like
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence"
version="2.1">
<persistence-unit name="contentAggregatorPU">
<class>contentAggregator.model.Item</class>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
<property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/>
<property name="javax.persistence.schema-generation.scripts.create-target" value="contentAggregatorCreate.ddl"/>
<property name="javax.persistence.schema-generation.scripts.drop-target" value="contentAggregatorDrop.ddl"/>
</properties>
</persistence-unit>
</persistence>
It just does not generate the files.
Honestly I never used the mechanism. While it seems to work for my local-resource minimal JPA playground it gave me errors when attempting to deploy to wildfly. I've always used a small utility class for generating a schema.
public class SchemaTranslator {
public static void main(String[] args) throws IOException {
Class<?>[] entityClasses = {
Class1.class,
Class2.class,
};
MetadataSources metadata = new MetadataSources(new StandardServiceRegistryBuilder()
.applySetting("hibernate.hbm2ddl.auto", "create")
.applySetting("hibernate.dialect", "org.hibernate.dialect.MySQL5InnoDBDialect")
// .applySetting("hibernate.physical_naming_strategy", "package.MyImprovedNamingStrategy")
.build()
);
// [...] adding annotated classes to metadata here...
for (Class<?> clazz : entityClasses)
metadata.addAnnotatedClass(clazz);
EnumSet<TargetType> targetTypes = EnumSet.of(TargetType.STDOUT, TargetType.SCRIPT);
SchemaExport export = new SchemaExport()
// .setHaltOnError( haltOnError )
.setOutputFile("db-schema.sql")
.setDelimiter(";");
export.create(targetTypes, (MetadataImplementor) metadata.buildMetadata());
}
}

jpa 2.0 not injecting EntityManager

I have a simple implemenation of JPA 2.0 annotations that is not working. This is running in karaf 4.0.5 as a server. Below are listed the relevant excerpts from persistence.xml, blueprint.xml and the class. The exception is listed at the bottom.
The issue is that the EntityManager em is always null. I expected this to be injected by blueprint.
Can anyone point out where I've gone wrong?
Class
import javax.persistence.PersistenceContext;
import javax.transaction.Transactional;
#Transactional
public class LookupMfgService implements ILookupMfgService {
private static Logger logger = LoggerFactory.getLogger(LookupMfgService.class);
#PersistenceContext(unitName = "pu_motordb3")
private EntityManager em;
#Override
public List<String> getPreferredMfgNames() throws BusinessException {
List<String> list = new ArrayList<>();
try {
// em is null here so NPE thrown
TypedQuery<String> q = em.createNamedQuery("listMfgPreferredNames", String.class);
list = q.getResultList();
} catch (Throwable t) {
logger.error("Error selecting list of manufacturers", t);
throw JpaExceptionFactory.createGeneralError(t, this.getClass().getName());
}
return list;
}
public void setEm(EntityManager entityManager) {
logger.debug(this.getClass().getName() + ".setEntityManager()");
logger.debug("setEntityManager called with " + (entityManager == null ? "null" : entityManager.toString()));
this.em = entityManager;
}
}
DataSource.xml
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.w3.org/2001/XMLSchema-instance http://www.w3.org/2001/XMLSchema-instance
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 ">
<bean id="dataSource" class="org.postgresql.ds.PGPoolingDataSource" destroy-method="close">
<property name="serverName" value="XXX"/>
<property name="user" value="XXX"/>
<property name="password" value="XXX"/>
<property name="dataSourceName" value="pgConnectionPool"/>
<property name="initialConnections" value="5"/>
<property name="maxConnections" value="50" />
</bean>
<service interface="javax.sql.DataSource" ref="dataSource">
<service-properties>
<entry key="osgi.jndi.service.name" value="MotorDB"/>
</service-properties>
</service>
</blueprint>
Blueprint.xml
<blueprint default-activation="eager"
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0"
xmlns:tx="http://aries.apache.org/xmlns/transactions/v2.0.0" xmlns:jpa="http://aries.apache.org/xmlns/jpa/v2.0.0"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0 http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0
http://aries.apache.org/xmlns/transactions/v2.0.0 http://aries.apache.org/xmlns/transactions/v2.0.0
http://aries.apache.org/xmlns/jpa/v2.0.0 http://aries.apache.org/xmlns/jpa/v2.0.0
http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0 http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0">
<jpa:enable />
<tx:enable />
<service id="mfgLookupService" ref="mfgLookupEntityImpl" interface="ILookupMfgService"/>
</blueprint>
Persistence.xml
<?xml version="1.0" encoding="UTF-8" ?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="pu_motordb3" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name=MotorDB)</jta-data-source>
Classes listed here
</persistence-unit>
</persistence>
Karaf log
2016-09-01 09:45:48,689 | INFO | PersistenceBundleTracker | 90 - org.apache.aries.jpa.container - 2.3.0 | Found persistence unit reference3 in bundle entity with provider org.apache.openjpa.persistence.PersistenceProviderImpl.
2016-09-01 09:45:48,695 | INFO | PersistenceBundleTracker | 90 - org.apache.aries.jpa.container - 2.3.0 | Found persistence unit pu_motordb3 in bundle entity with provider org.apache.openjpa.persistence.PersistenceProviderImpl.
2016-09-01 09:45:48,695 | INFO | PersistenceBundleTracker | 90 - org.apache.aries.jpa.container - 2.3.0 | Persistence units added for bundle com.easa.server.entity event 128
Exception
2016-08-31 18:42:49,286 | ERROR | nelWorkerThread0 | LookupMfgService | Error selecting list of manufacturers
java.lang.NullPointerException
at LookupMfgService.getPreferredMfgNames(LookupMfgService.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_91]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_91]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_91]
at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_91]
at ch.ethz.iks.r_osgi.impl.ChannelEndpointImpl.handleMessage(ChannelEndpointImpl.java:1265)[69:ch.ethz.iks.r_osgi.remote:1.0.8.RC1_v20160823-2221]
at ch.ethz.iks.r_osgi.impl.ChannelEndpointImpl$2.run(ChannelEndpointImpl.java:315)[69:ch.ethz.iks.r_osgi.remote:1.0.8.RC1_v20160823-2221]
at ch.ethz.iks.r_osgi.impl.ChannelEndpointImpl$1.run(ChannelEndpointImpl.java:280)[69:ch.ethz.iks.r_osgi.remote:1.0.8.RC1_v20160823-2221]
Your datasource configuration appears to be missing. You are using osgi.jndi.service.name=MotorDB that is nowhere declared. So there is no service implementing javax.sql.DataSource
There has to be something similar to the following example which uses Oracle.
Change accordingly for other DBMS:
...
<bean id="dataSourceBeanMfgLookupService" class="oracle.jdbc.pool.OracleDataSource">
<property name="URL" value="???"/>
<property name="user" value="???"/>
<property name="password" value="???"/>
</bean>
<service id="dataSourceMfgLookupService" interface="javax.sql.DataSource" ref="dataSourceBeanMfgLookupService">
<service-properties>
<entry key="osgi.jndi.service.name" value="MotorDB" />
</service-properties>
</service>
...
Furthermore you may have to specify a persistence-provider in your persistence.xml. If you used hibernate with Oracle 10g it would look somehow like this:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" ...>
<provider>org.hibernate.ejb.HibernatePersistence</provider>
...
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" />
<property name="hibernate.temp.use_jdbc_metadata_defaults" value="false" />
...
Then you can link your datasource to your service:
<bean id="mfgLookupEntityImpl" class="LookupMfgService">
<jpa:context property="em" unitname="pu_motordb3" />
<tx:transaction method="*" value="Required" />
</bean>
If this still does not inject the EM provide a setter:
public void setEm(EntityManager entityManager) {
this.em = entityManager;
}
AFAIK there was/is a bug that property injection only worked if a setter was available.
The cause was an issue with karaf 4.0.5 and openjpa 2.4.1. It has been resolved in karaf 4.0.6

Apache camel cxfrs—Can't find the request for <URL> Observer

I tried to develop a rest service and expose the same via Apache Camel's CXFRS. I followed all the steps given in http://camel.apache.org/cxfrs.html and also referred to many samples given. I already referred to the question Can't find the the request for url Observer, but in my case it is a simple rest request. Below are the Service class, Route class, and cxf context used:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:context="http://www.springframework.org/schema/context"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://cxf.apache.org/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml" />
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<context:annotation-config />
<!-- enable Spring #Component scan -->
<context:component-scan base-package="org.camelsample.rest" />
<cxf:rsServer id="rsServer" address="/rest"
serviceClass="org.camelsample.rest.service.SampleRestService"
loggingFeatureEnabled="true" loggingSizeLimit="20">
<cxf:providers>
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider" />
</cxf:providers>
</cxf:rsServer>
<camel:camelContext id="samplerestservice"
xmlns="http://camel.apache.org/schema/spring">
<contextScan />
<jmxAgent id="agent" createConnector="true" />
</camel:camelContext>
</beans>
The Service Class:
package org.camelsample.rest.service;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
public class SampleRestService {
#GET
#Path("/")
public String sampleService() {
return null;
}
}
The Route Class:
package org.camelsample.rest.route;
import org.apache.camel.spring.SpringRouteBuilder;
public class SampleRestRoute extends SpringRouteBuilder {
#Override
public void configure() throws Exception {
// TODO Auto-generated method stub
from("cxfrs:bean:rsServer").log("Into Sample Route").setBody(constant("Success"));
}
}
But when I try to hit and test using http://localhost:8080/rest, I always get the following error message:
2015-05-29 13:38:37.920 WARN 6744 --- [nio-8080-exec-2] o.a.c.t.servlet.ServletController : Can't find the the request for http://localhost:8080/favicon.ico's Observer
2015-05-29 13:38:40.295 WARN 6744 --- [nio-8080-exec-3] o.a.c.t.servlet.ServletController : Can't find the the request for http://localhost:8080/rest's Observer
Am using Spring boot to test the rest sample.
Does it work with this URL instead ?
http://localhost:8181/cxf/rest
If you just use address="/rest" as your address then you will probably get the default Jetty port 8181 and default CXF servlet path /cxf as the base URL.
If you specifically want to use the URL you have given then try this instead:
address="http://0.0.0.0:8080/rest"

WEB9031 - cannot store entity with sequence generated id

I am using glassfish, postgres and openjpa.
I only have one bean and first want to create a new intance and store it in DB. I created a new User-Object, filled it (except the id) and got - trying to persist - following exception:
Caused by: java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource [org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1401)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
at org.myPlace.server.user.UserPDO.pcNewObjectIdInstance(UserPDO.java)
at org.apache.openjpa.enhance.PCRegistry.newObjectId(PCRegistry.java:142)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClass(MetaDataRepository.java:1694)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClasses(MetaDataRepository.java:1644)
... 128 more
WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for
servlet Faces Servlet threw exception
java.lang.IllegalStateException: WEB9031: WebappClassLoader unable to load resource
[org.apache.openjpa.util.LongId], because it has not yet been started, or was already stopped
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1401)
at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1359)
at org.myPlace.server.user.UserPDO.pcNewObjectIdInstance(UserPDO.java)
at org.apache.openjpa.enhance.PCRegistry.newObjectId(PCRegistry.java:142)
at org.apache.openjpa.meta.MetaDataRepository.processRegisteredClass(MetaDataRepository.java:1694)
My bean looks like this:
#Entity
#Table(name="tbl_User")
public class UserPDO implements Serializable {
private long id;
private String username;
private String password;
public UserPDO() {}
#Id
#GeneratedValue(strategy=GenerationType.SEQUENCE, generator="user_seq_gen")
#SequenceGenerator(name="user_seq_gen", sequenceName="user_seq")
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
... }
My persistence.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="myPlace" transaction-type="JTA">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>org.myPlace.server.user.UserPDO</class>
<properties>
<property name="openjpa.jdbc.DBDictionary" value="postgres"/>
<property name="openjpa.ConnectionDriverName" value="org.postgresql.Driver"/>
<property name="openjpa.ConnectionURL" value="jdbc:postgresql://localhost:5432/myPlace"/>
<property name="openjpa.ConnectionPassword" value="myPlace"/>
<property name="openjpa.ConnectionUserName" value="myPlace"/>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
<property name="openjpa.Log" value="File=/home/username/apache.log, DefaultLevel=ERROR, Tool=INFO, SQL=TRACE"/>
<property name="openjpa.DynamicEnhancementAgent" value="false" />
<property name="openjpa.RuntimeUnenhancedClasses" value="unsupported" />
<property name="openjpa.DataCache" value="false"/>
<property name="openjpa.QueryCache" value="false"/>
</properties>
</persistence-unit>
The table is created correctly, so is the sequence. But when I want to create a new user object via
public <T> T create(T t) {
this.em.persist(t);
this.em.flush();
this.em.refresh(t);
return t;
}
I get the exception mentioned above. I found some questions/answers here that suggest that deactiving runtime-enhancement should do the trick. But it didn't work for me. My first idea was, that it might be a Classloader-Leak. I copied postgres-driver and openjpa-jars into the glassfish/lib-folder.
Can anybody help? Thanks!