iReport, error during spring loaded hibernate connection in netbeans plugin - java

i try to use iReport with an hibernate connection loaded using spring xml config file.
So, in netbeans wizard, i choose new datasource and i select "spring loaded Hibernate collection".
I set my xml spring file, but when i click test i have this exception:
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring.cfg.xml]; nested exception is org.springframework.beans.FatalBeanException: NamespaceHandler class [org.springframework.context.config.ContextNamespaceHandler] for namespace [http://www.springframework.org/schema/context] not found; nested exception is java.lang.ClassNotFoundException: org.springframework.context.config.ContextNamespaceHandler
The spring xml is ok beacouse al works great in application, the problem is when i try to use it for iRepor in netbeans plugin.
Documentation about jasper report using hibernate and spring are very very slightly.
EDIT
I added all spring-dependance jar in Tools->Options->iReport->classpath (i'm refering to netbeans, this is totaly undocumented...) and finally seem to load context, but now i have this excpetions:
WARNING [org.netbeans.ProxyClassLoader]: Will not load class org.springframework.beans.factory.xml.NamespaceHandlerSupport arbitrarily from one of ModuleCL#10eaeda[com.jaspersoft.ireport] and ModuleCL#19e3bdd[org.netbeans.libs.springframework] starting from SystemClassLoader[569 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
WARNING [org.netbeans.ProxyClassLoader]: Will not load class org.springframework.beans.factory.xml.NamespaceHandler arbitrarily from one of ModuleCL#10eaeda[com.jaspersoft.ireport] and ModuleCL#19e3bdd[org.netbeans.libs.springframework] starting from SystemClassLoader[569 modules]; see http://wiki.netbeans.org/DevFaqModuleCCE
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [META-INF/spring.cfg.xml]; nested exception is org.springframework.beans.FatalBeanException: Class [org.springframework.context.config.ContextNamespaceHandler] for namespace [http://www.springframework.org/schema/context] does not implement the [org.springframework.beans.factory.xml.NamespaceHandler] interface
I think this is a problem of the netbeans plugin only and i can do anything :(
Thanks.

Installing iReport standalone app all work good, so is a problem of iReport plugin in netbeans.

Related

Exception in Manual Loading of Spring Context in a Web Project

I am using multiple projects in a single .war and it successfully works in my tomcat.
When I try to load the spring context manually for testing, It gives exception while loading .xml from other projects.Below I am sharing the details of my project.
build tool : ANT
Context Loading method :
ApplicationContext context = new FileSystemXmlApplicationContext("file:resources/spring/root-context.xml");
Exception :
Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from URL [classpath:com/abc/service/config/test.xml]; nested exception is java.io.FileNotFoundException: com/abc/service/config/test.xml (No such file or directory)
test.xml is part of core project and Loading via config Class.
#Configuration
#ImportResource({
"classpath:com/abc/service/config/test.xml",
})
I could not understand why spring context loaded in tomcat and failed in manual loading. Please someone help to figure out the problem.

Configuration issue: Unable to locate Spring NamespaceHandler for XML schema namespace [urn:infinispan:config:7.0]

I'm testing infinispan cache embeded mode.
but it occurred in springframework.. but it's ok in stand alone mode...
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [urn:infinispan:config:7.0]
Offending resource: file [C:\dev\ide\eGovFrameDev-3.5.1-64bit\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\demo\WEB-INF\classes\egovframework\spring\com\context-infinispan.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:70) ~[spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85) ~[spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:80) ~[spring-beans-4.0.9.RELEASE.jar:4.0.9.RELEASE]
Yes, this might be caused by a classpath issue or missing schema location (see this link for reference).
So, in order to fix this I would advice checking:
If it deploys correctly to your container (without using IDE)
check if xsi:schemaLocations are correct
However if it still doesn't work - could you please paste me your Spring configuration XML as well as your pom (ant or gradle file)?

JavaBean as Datasource in iReport: "NoClassDefFoundError" (jar is in the classpath!)

I am using JasperReports 5.6 via API.
I am building a report using iReport. The problem is that I've already set a jar with bean factory in the classpath of iReport as
com.myname.beanproject.beanpackage.BeanFactoryClass
Also I set up static method to call a list of beans:
getEntries
but still getting a error while testing a connection.
What am I doing wrong?
Error is
NoClassDefFoundError!
Check your classpath!
Could not initialize class com.myname.beanproject.beanpackage.BeanFactoryClass
I added org.slf4j.loggerfactory to the classpath, and error changed. Now it's just "General problem" without any explanation.

Hibernate 3.6.10 NoSuchMethodError

I'm having the following issue with my hibernate 3.6.10 project:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testSessionFactory' defined in class path resource [db.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: javax.persistence.OneToMany.orphanRemoval()Z
Reading some of the issues here on stack overflow, it said I was using the wrong persistence API. So I downloaded the matching hibernate (I've been using the Spring deployment) and copied out the hibernate-jpa-2.0-api-1.0.1.Final.jar which comes with the hibernate distrib, only to get the self-same message.
Is this telling me that OneToMany is not supported by Hibernate 3.6.10?
It tells your that you have a JPA 1.0 API jar somewhere in your classpath. Such a problem cannot be reliably solved by adding proper JPA 2.0 jar to the classpath, you need to find and remove the offending jar before.

Spring Configuration file error

I am trying to run a simple program using a spring configuration file. In the configuration I am creating a bean for the JMS template. When I run it from eclipse everything works perfect but if I try to run it from the command line I get the following error.
Error creatign bean with name JMSTEMPLATE definded in class path resource [config.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/jms/JMSException
Does anyone know why this could be? I've double checked my class path and it is fine.
You are forgetting to include the jms.jar in your classpath.
Are you including JMS jars in your classpath? This error suggests that they are missing at runtime.

Categories