spring + hibernate web application - spring

I have started Web Application using Spring + Hibernate MVC. I Created All File. There are some issues when i'm debug my application. Here I have attached test-servlet.xml. First one is that how to add' ' then there are 3 errors when i'm debug my application. I have also mentioned that error line. So any one help me plz on this???
error :
![javax.servlet.ServletException: Servlet.init() for servlet test threw exception
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from ServletContext resource \[/WEB-INF/config/test-servlet.xml\]; nested exception is java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor
java.lang.NoClassDefFoundError: org/springframework/transaction/interceptor/TransactionInterceptor]

The exception says:
java.lang.NoClassDefFoundError:
org/springframework/transaction/interceptor/TransactionInterceptor
Check your WEB-INF/lib and make sure you have the spring jar file that contains this class.

Download the org.springframework.transaction.jar and add add it to your classpath.

This class is found in "spring-tx" jar that should be present in your classpath (lib). Please check this. If not present please download appropriate version from here.

Related

How to use Jersey in Sling?

I've got Sling 8. I then include Jersey and this Jersey connector in my build: https://github.com/hstaudacher/osgi-jax-rs-connector
My next step should be simply write a Jersey Service and test it, but I'm getting this Exception immediately:
27.01.2017 10:54:16.696 *ERROR* [FelixDispatchQueue] com.eclipsesource.jaxrs.publisher FrameworkEvent ERROR (org.osgi.framework.ServiceException: Service factory returned null.)org.osgi.framework.ServiceException: Service factory returned null.
and
[FelixDispatchQueue] com.eclipsesource.jaxrs.publisher FrameworkEvent ERROR (org.osgi.framework.ServiceException: Service factory exception: org/apache/felix/shell/Command)
org.osgi.framework.ServiceException: Service factory exception: org/apache/felix/shell/Command
and
Caused by: java.lang.NoClassDefFoundError: org/apache/felix/shell/Command
So I look at my bundles list in Felix, and I don't see any bundle that appears to provide this... So I find it online and install it myself. Now I get this exception:
Service factory exception: org/apache/sling/extensions/threaddump/internal/ThreadDumpCommand
and
Caused by: java.lang.NoClassDefFoundError: org/apache/sling/extensions/threaddump/internal/ThreadDumpCommand
and
Caused by: java.lang.NoClassDefFoundError: org/apache/felix/webconsole/plugins/memoryusage/internal/MemoryUsageCommand
Now, I DO have a bundle installed with this class (it's "Apache Felix Web Console Memory Usage Plugin"). So now I really don't understand what the heck is going on.
I have a feeling that I'm not supposed to be providing my own "felix shell" bundle and that the OSGI in Sling is failing to provide it...
Is anybody successfully using Sling 8 and Jersey?
Maybe you should try with just a vanilla OSGi environment for starters. Once you have Jersey working then you can try integrating with Sling.
I have had success with jaxrs in OSGi, specifically using the Amdatu REST bundles.
https://amdatu.org/application/tutorial/step1/
With this I was able to use JAX-RS annotations to serve HTTP services:
https://github.com/figurate/figurate-core/blob/master/modules/figurate-osgi/src/main/groovy/org/figurate/osgi/http/ServiceInfo.groovy
You can see the bundles I used here:
https://github.com/figurate/figurate-core/blob/master/modules/figurate-osgi/src/test/resources/config/HttpVersionSpec.config

spring integration jdbc init error

error info:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/integration/jdbc]
Offending resource: class path resource [META-INF/spring/applicationContext-integration.xml]
I have added xmlns and xsi:schemaLocation to the header of configuration file, it didn't show any error, but why excepiton occured when project startup?
anybody helps me...
It's interest, what was the problem to use search? At least on the StackOverflow
Your issue is about that spring-integration-jdbc.jar isn't presented in the CLASSPATH
Cheers

Deploying Worklight on WebSphere

I've deployed Worklight 6 on WebSphere 8.5.5 trying to follow these instructions ( http://pic.dhe.ibm.com/infocenter/wrklight/v6r0m0/index.jsp ) with a derby database and I've encountered the following error when trying to hit my Worklight instance:
Error 500: javax.servlet.ServletException: Worklight Project not initialized
When I check the log, I can see that the worklight server has not been started due to this exception:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'brokerSessionFactory' defined in URL [jar:file:/C:/IBM/WebSphere/AppServer/lib/worklight-jee-library-6.0.0.jar!/conf/spring-server-core.xml]: Invocation of init method failed; nested exception is java.lang.AbstractMethodError: javax/persistence/spi/PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode;
...
Caused by: java.lang.AbstractMethodError: javax/persistence/spi/PersistenceUnitInfo.getValidationMode()Ljavax/persistence/ValidationMode
at org.apache.openjpa.persistence.PersistenceUnitInfoImpl.toOpenJPAProperties(PersistenceUnitInfoImpl.java:499)
at org.apache.openjpa.persistence.PersistenceProductDerivation.load(PersistenceProductDerivation.java:317)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:160)
at org.apache.openjpa.persistence.PersistenceProviderImpl.createContainerEntityManagerFactory(PersistenceProviderImpl.java:62)
I put the worklight jar directly in the WebSphere lib to solve another problem related to an Authentication class not being found if I recall correctly... Perhaps I need more jars in there, or did I solve my previous problem incorrectly? I put the javax.peristence.jar inside websphere as well, but that didn't help.
Are you using Ant scripts for deployment? This happens if you miss some steps while doing the manual application deployment.

Getting error with Spring batch

I am getting below error when I am executing my Java application :
Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: org.springframework.transaction.annotation.TransactionManagementConfigurationSelector was imported as a Configuration class but is not annotated with #Configuration nor does it declare any #Bean methods. Update the class to meet either of these requirements or do not attempt to import it.
Offending resource: class path resource [org/springframework/transaction/annotation/TransactionManagementConfigurationSelector.class]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.doLoadBeanDefinitionForConfigurationClassIfNecessary(ConfigurationClassBeanDefinitionReader.java:153)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:120)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:111)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:188)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:132)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:584)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:405)
at org.springframework.context.annotation.AnnotationConfigApplicationContext.<init>(AnnotationConfigApplicationContext.java:65)
at org.sbq.batch.mains.SchedulerRunner.<init>(SchedulerRunner.java:46)
at org.sbq.batch.mains.SchedulerRunner.main(SchedulerRunner.java:52)
I don't have any clue about this kind of exception. Please help.
I think you are mixing different versions of springbatch. Try downloading the latest version of all the jars and execute it.
Similar problem was posted by someone in the SpringSource Forum, in this link
Yes, using different versions of the spring and spring batch jars might produce 'offending resource' exception

Why doesn't Websphere like BIRT?

I am trying to start a deployment of a project to Websphere and I get the following error trail. (Shortened)
ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'birtView' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Cannot resolve reference to bean 'birtEngine' while setting bean property 'birtEngine'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'birtEngine': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Could not start the Birt engine!
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'birtEngine': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: Could not start the Birt engine!
Caused by: java.lang.RuntimeException: Could not start the Birt engine!
Caused by: org.eclipse.birt.core.exception.BirtException: error.CannotStartupOSGIPlatform
Caused by: org.eclipse.birt.core.framework.FrameworkException: Cant register the ExtensionRegistry classpath
Caused by: org.eclipse.core.runtime.CoreException: Extension registry provider is already set.
The solution to the 3rd from bottom error as I have found online was to delete the following line of code.
config.setEngineHome("C:/birt-runtime-3_7_0/ReportEngine");
However, this is not present and unnecessary for our setup.
It(the BIRT specific code used) is very similar to this example online:
http://www.springsource.org/BusinessIntelligenceWithSpringAndBIRT
The BirtView and BirtEngineFactory are the only relevant parts to my project.
I have gone to this Bug Page and forum entry and tried the code addition. It did not work. The project starts up and works on Tomcat 6x without any issue.
http://www.eclipse.org/forums/index.php/m/727929/
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351052
I have the class loader order in Web Sphere set to "Classes loaded with application class loader first." as in the example in the link below.
http://wiki.eclipse.org/BirtPOJO_Viewer_WebSphere_Deployment
I still get the same set of errors and I'm not sure what else I should be doing.
I know it is a bit hard to ask this without posting code, but would someone have an idea as to what I should look for?
Thanks.
I had exactly the same error as yours. I am using BIRT 3.7.2 and IBM WAS 8.5
With reference to the bug detailed below,
org.eclipse.core.runtime.CoreException when restarting the ReportEngine
and the actual reason of the bug, specified below,
ServiceLauncher.shutdown() doesn't release default RegistryProvider
I added the following line before the Platform.startup(..) call
RegistryProviderFactory.releaseDefault();
After this, BIRT reports are working fine.
But, I'm doubtful, as to whether this will break anything in WAS's runtime or not.
The reason for this is ...
As explained in the bug, this exception occurs when Platform start-up is attempted for a second time. Here, on Platform.shutdown(), the RegistryProvider is not released, and hence the exception.
Now, in my case, IBM Websphere 8.5 internally uses OSGi and hence starts OSGi Platform.
Hence, when our application attempts to start the Platform again (the second start), the exception occurs.
My concern here is, this should not break anything with WAS’s runtime (as it uses OSGi internally).
The Registry Provider is not null, as its set by BIRT runtime, so, the only problem here can be of Class Version mismatch i.e., WAS’s Registry Provider and BIRTs Registry Provider, if different, then version clashes.
I'm not sure of the solution i have used.
Experts, please guide.

Resources