Do you know where can I set auto-import="false" when working with hyperjaxb?. I have this exception when calling Persistence.createEntityManagerFactory().
Assuming that this auto-import solves my problem, I would assume that I have to do manual importing instead. Where would I go about looking for such information?
Thank you.
Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: com.sun.java.xml.ns.persistence:org.jvnet.hyperjaxb3.ejb.schemas.customizations:com.sun.java.xml.ns.persistence.orm:generated] Unable to configure EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:265)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
at PropertiesTest.Test1(PropertiesTest.java:68)
at PropertiesTest.main(PropertiesTest.java:121)
Caused by: org.hibernate.AnnotationException: Use of the same entity name twice: Basic
at org.hibernate.cfg.annotations.EntityBinder.bindEntity(EntityBinder.java:304)
at org.hibernate.cfg.AnnotationBinder.bindClass(AnnotationBinder.java:567)
at org.hibernate.cfg.AnnotationConfiguration.processArtifactsOfType(AnnotationConfiguration.java:546)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:291)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1226)
at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:173)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:854)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:191)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:253)
... 4 more
Caused by: org.hibernate.DuplicateMappingException: duplicate import: Basic refers to both org.jvnet.hyperjaxb3.ejb.schemas.customizations.Basic and com.sun.java.xml.ns.persistence.orm.Basic (try using auto-import="false")
at org.hibernate.cfg.Mappings.addImport(Mappings.java:164)
at org.hibernate.cfg.annotations.EntityBinder.bindEntity(EntityBinder.java:297)
... 13 more
Related
how can I avoid WARN messages to be displayed in logs (without putting the log4j level to ERROR) when I launch Confluent ?
I have set up my plugin.path variable in the properties file with value ${CONFLUENT_HOME}/share/java/kafka-connect-jdbc (with final comma).
I tried to put in the classpath the kafka-connect-jdbc repository, without success.
The following is just an example a small part of the log file:
[2018-07-10 15:40:30,168] INFO Reflections took 1 ms to scan 1 urls, producing 5 keys and 6 values [using 1 cores] (org.reflection
s.Reflections)
[2018-07-10 15:40:30,170] WARN could not get type for name org.jmock.Mockery from any class loader (org.reflections.Reflections)
org.reflections.ReflectionsException: could not get type for name org.jmock.Mockery
at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:390)
at org.reflections.Reflections.expandSuperTypes(Reflections.java:381)
at org.reflections.Reflections.<init>(Reflections.java:126)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader$InternalReflections.<init>(DelegatingClassLoader.java:
365)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanPluginPath(DelegatingClassLoader.java:277)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.scanUrlsAndAddPlugins(DelegatingClassLoader.java:216)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.registerPlugin(DelegatingClassLoader.java:208)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initPluginLoader(DelegatingClassLoader.java:177)
at org.apache.kafka.connect.runtime.isolation.DelegatingClassLoader.initLoaders(DelegatingClassLoader.java:154)
at org.apache.kafka.connect.runtime.isolation.Plugins.<init>(Plugins.java:56)
at org.apache.kafka.connect.cli.ConnectStandalone.main(ConnectStandalone.java:77)
Caused by: java.lang.ClassNotFoundException: org.jmock.Mockery
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at org.reflections.ReflectionUtils.forName(ReflectionUtils.java:388)
... 10 more
That does not seem causing any issues, but can be confusing to read about it.
Have you got any suggestions about that ?
Thanks in advance,
Diego
You can set log level for particular package in log4j config file:
log4j.logger.org.reflections=ERROR
This helped me
I have an app build with jodd 3.6.6 and when I try to run it on jetty9 it cannot initialize Madvoc :
1377 [ERROR] j.m.Madvoc.startNewWebApplication:161 - Madvoc startup failure.
jodd.madvoc.MadvocException: Scan classpath error; <--- java.lang.ClassNotFoundException: Class not found: org.eclipse.jetty.client.api.Result
at jodd.madvoc.config.AutomagicMadvocConfigurator.configure(AutomagicMadvocConfigurator.java:85)
at jodd.madvoc.config.AutomagicMadvocConfigurator.configure(AutomagicMadvocConfigurator.java:65)
at jodd.madvoc.WebApplication.configure(WebApplication.java:255)
at jodd.madvoc.Madvoc.start(Madvoc.java:238)
at jodd.madvoc.Madvoc.startNewWebApplication(Madvoc.java:157)
at jodd.madvoc.MadvocServletFilter.init(MadvocServletFilter.java:45)
at org.eclipse.jetty.servlet.FilterHolder.initialize(FilterHolder.java:138)
at org.eclipse.jetty.servlet.ServletHandler.initialize(ServletHandler.java:852)
at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:298)
at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1349)
at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1342)
at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:741)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:505)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
at org.eclipse.jetty.server.Server.start(Server.java:387)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
at org.eclipse.jetty.server.Server.doStart(Server.java:354)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at net.sourceforge.eclipsejetty.starter.jetty9.Jetty9Adapter.start(Jetty9Adapter.java:68)
at net.sourceforge.eclipsejetty.starter.common.AbstractJettyLauncherMain.launch(AbstractJettyLauncherMain.java:85)
at net.sourceforge.eclipsejetty.starter.jetty9.Jetty9LauncherMain.main(Jetty9LauncherMain.java:42)
Caused by: jodd.io.findfile.FindFileException: Scan entry error: EntryData{org.eclipse.jetty.client.api.Result'}; <--- java.lang.ClassNotFoundException: Class not found: org.eclipse.jetty.client.api.Result
at jodd.io.findfile.ClassFinder.scanEntry(ClassFinder.java:391)
at jodd.io.findfile.ClassFinder.scanJarFile(ClassFinder.java:292)
at jodd.io.findfile.ClassFinder.scanPath(ClassFinder.java:261)
at jodd.io.findfile.ClassFinder.scanPaths(ClassFinder.java:226)
at jodd.madvoc.config.AutomagicMadvocConfigurator.configure(AutomagicMadvocConfigurator.java:83)
... 22 more
Caused by: jodd.madvoc.MadvocException: Invalid Madvoc result class: org.eclipse.jetty.client.api.Result; <--- java.lang.ClassNotFoundException: Class not found: org.eclipse.jetty.client.api.Result
at jodd.madvoc.config.AutomagicMadvocConfigurator.onEntry(AutomagicMadvocConfigurator.java:108)
at jodd.io.findfile.ClassFinder.scanEntry(ClassFinder.java:389)
... 26 more
The same app runs without a problem on tomcat. Any idea ?
Ok, it should be simple: just skip the scanning of netty classes.
Here is the explanation: In Madvoc you can optionally use the Result class (source) to work with the results (documentation). In short, if you have a field with Result type, Madvoc will use it for this feature.
So it looks like Netty has the same class name, hence the error. To prevent this (until we make a better recognition), just skip scanning the full class path, and make the scanner scan only your classes - that will improve the startup performances too. Here is how to do that:
By default, the AutomagicMadvocConfigurator is used for configuring the actions (by scanning the path). Get this instance (in WebApplication for example) and configure it (since it is a ClassFinder subclass). So what I do is:
classFinder.setExcludeAllEntries(true);
classFinder.setIncludedEntries(myapp.getClass().getPackage().getName() + ".*");
classFinder.setIncludedJars("somejar.jar", "myapp*.jar");
This will narrow down the classpath that is being searched.
Let me know if you need more help with this. Meanwhile, we will definitely make changes so this never happens again!
I am unable to run a sample application using Kundera Sample.
Exception:
Exception in thread "main" javax.persistence.PersistenceException: invalid persistence.xml
at com.impetus.kundera.loader.PersistenceXMLLoader.getDocument(PersistenceXMLLoader.java:107)
at com.impetus.kundera.loader.PersistenceXMLLoader.findPersistenceUnits(PersistenceXMLLoader.java:142)
at com.impetus.kundera.loader.PersistenceUnitLoader.findPersistenceMetadatas(PersistenceUnitLoader.java:130)
at com.impetus.kundera.loader.PersistenceUnitLoader.getPersistenceMetadata(PersistenceUnitLoader.java:78)
at com.impetus.kundera.loader.PersistenceUnitLoader.load(PersistenceUnitLoader.java:63)
at com.impetus.kundera.loader.ApplicationLoader.load(ApplicationLoader.java:43)
at com.impetus.kundera.KunderaPersistence.initializeKundera(KunderaPersistence.java:95)
at com.impetus.kundera.KunderaPersistence.createEntityManagerFactory(KunderaPersistence.java:72)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at javax.persistence.Persistence.createEntityManagerFactory(Unknown Source)
at com.tcs.main.KunderaExample.main(KunderaExample.java:19)
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'persistence'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1887)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:685)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3095)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
at com.impetus.kundera.loader.PersistenceXMLLoader.getDocument(PersistenceXMLLoader.java:103)
... 10 more
This is related to loading remotel persistence.xsd from sun java site. Change this in your persistence.xml
https://raw.github.com/impetus-opensource/Kundera/Kundera-2.0.4/kundera-core/src/test/resources/META-INF/persistence_2_0.xsd"
version="2.0">
2.0.6 release will also load it locally.
-Vivek
I'm running a spring/hibernate java app on tomcat and I'm seeing this funky error on update:
JDBC driver did not return the expected number of row counts
Caused by: java.lang.NullPointerException
at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:90)
at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:262)
at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:179)
I recently updated my mysql connector to version 5.1.15.
Has anyone seen anything like this?
I think I encountered this once and fixed it by implementing hashCode and Equals methods for the object type returned by the query.
I have installed hudson on Ubuntu server and then run java -jar hudson.war, giving me this exception error message:
Status Code: 500 Exception: The error
below occurred during context
initialisation, so no further requests
can be processed:
java.lang.ExceptionInInitializerError
at
java.lang.Class.initializeClass(libgcj.so.10)
at
hudson.WebAppMain.installLogger(WebAppMain.java:257)
at
hudson.WebAppMain.contextInitialized(WebAppMain.java:112)
at
winstone.WebAppConfiguration.(WebAppConfiguration.java:889)
at
winstone.HostConfiguration.initWebApp(HostConfiguration.java:131)
at
winstone.HostConfiguration.(HostConfiguration.java:73)
at
winstone.HostGroup.initHost(HostGroup.java:85)
at
winstone.HostGroup.(HostGroup.java:45)
at
winstone.Launcher.(Launcher.java:196)
at
winstone.Launcher.main(Launcher.java:391)
at
java.lang.reflect.Method.invoke(libgcj.so.10)
at Main.main(Main.java:200) Caused
by:
com.thoughtworks.xstream.XStream$InitializationException:
Could not instantiate converter :
com.thoughtworks.xstream.converters.extended.DurationConverter
: null at
com.thoughtworks.xstream.XStream.dynamicallyRegisterConverter(XStream.java:735)
at
com.thoughtworks.xstream.XStream.setupConverters(XStream.java:699)
at
com.thoughtworks.xstream.XStream.(XStream.java:445)
at
com.thoughtworks.xstream.XStream.(XStream.java:385)
at
com.thoughtworks.xstream.XStream.(XStream.java:323)
at
hudson.util.XStream2.(XStream2.java:61)
at
hudson.model.Hudson.(Hudson.java:3571)
at
java.lang.Class.initializeClass(libgcj.so.10)
...11 more Caused by:
java.lang.reflect.InvocationTargetException
at
java.lang.reflect.Constructor.newInstance(libgcj.so.10)
at
com.thoughtworks.xstream.XStream.dynamicallyRegisterConverter(XStream.java:728)
...18 more Caused by:
javax.xml.datatype.DatatypeConfigurationException:
java.lang.ClassNotFoundException:
gnu.xml.datatype.JAXPDatatypeFactory
at
javax.xml.datatype.DatatypeFactory.newInstance(libgcj.so.10)
at
com.thoughtworks.xstream.converters.extended.DurationConverter.(DurationConverter.java:33)
at
java.lang.reflect.Constructor.newInstance(libgcj.so.10)
...19 more Caused by:
java.lang.ClassNotFoundException:
gnu.xml.datatype.JAXPDatatypeFactory
at
java.lang.Class.forName(libgcj.so.10)
at
javax.xml.datatype.DatatypeFactory.newInstance(libgcj.so.10)
...21 more
Stacktrace:
java.lang.ExceptionInInitializerError
at
java.lang.Class.initializeClass(libgcj.so.10)
at
hudson.WebAppMain.installLogger(WebAppMain.java:257)
at
hudson.WebAppMain.contextInitialized(WebAppMain.java:112)
at
winstone.WebAppConfiguration.(WebAppConfiguration.java:889)
at
winstone.HostConfiguration.initWebApp(HostConfiguration.java:131)
at
winstone.HostConfiguration.(HostConfiguration.java:73)
at
winstone.HostGroup.initHost(HostGroup.java:85)
at
winstone.HostGroup.(HostGroup.java:45)
at
winstone.Launcher.(Launcher.java:196)
at
winstone.Launcher.main(Launcher.java:391)
at
java.lang.reflect.Method.invoke(libgcj.so.10)
at Main.main(Main.java:200) Caused
by:
com.thoughtworks.xstream.XStream$InitializationException:
Could not instantiate converter :
com.thoughtworks.xstream.converters.extended.DurationConverter
: null at
com.thoughtworks.xstream.XStream.dynamicallyRegisterConverter(XStream.java:735)
at
com.thoughtworks.xstream.XStream.setupConverters(XStream.java:699)
at
com.thoughtworks.xstream.XStream.(XStream.java:445)
at
com.thoughtworks.xstream.XStream.(XStream.java:385)
at
com.thoughtworks.xstream.XStream.(XStream.java:323)
at
hudson.util.XStream2.(XStream2.java:61)
at
hudson.model.Hudson.(Hudson.java:3571)
at
java.lang.Class.initializeClass(libgcj.so.10)
...11 more Caused by:
java.lang.reflect.InvocationTargetException
at
java.lang.reflect.Constructor.newInstance(libgcj.so.10)
at
com.thoughtworks.xstream.XStream.dynamicallyRegisterConverter(XStream.java:728)
...18 more Caused by:
javax.xml.datatype.DatatypeConfigurationException:
java.lang.ClassNotFoundException:
gnu.xml.datatype.JAXPDatatypeFactory
at
javax.xml.datatype.DatatypeFactory.newInstance(libgcj.so.10)
at
com.thoughtworks.xstream.converters.extended.DurationConverter.(DurationConverter.java:33)
at
java.lang.reflect.Constructor.newInstance(libgcj.so.10)
...19 more Caused by:
java.lang.ClassNotFoundException:
gnu.xml.datatype.JAXPDatatypeFactory
at
java.lang.Class.forName(libgcj.so.10)
at
javax.xml.datatype.DatatypeFactory.newInstance(libgcj.so.10)
...21 more
Generated by Winstone Servlet Engine
v0.9.10 at Mon Oct 25 14:55:59 PDT
20102010
Do you know what I am missing?
any suggestions would be very appreciated.
regards
Naoya
You probably run the wrong java. Check if you use sun's oracle's java.
See here for other people that had this problem:
http://ubuntuforums.org/showthread.php?t=1434376
same comment, you probably have the wrong java version.
You can specify the correct path to the java binary in /etc/default/hudson.
If you use jenkins then edit /etc/default/jenkins instead.
# /etc/default/{hudson,jenkins}
JAVA_HOME=/path/to/jdk_1.6
JAVA=$JAVA_HOME/bin/java
Encountered a similar issue due to no more space in /tmp (root partition).