I want to enable Hive in my Spring Hadoop project. I understand that we can't use JavaConfiguration so I am using XML. I have an error regarding the Spring Namespace.
Error starting ApplicationContext. To display the auto-configuration
report re-run your application with 'debug' enabled. [2017-10-03
10:26:51.292] - 44342 SEVERE [main] ---
org.springframework.boot.SpringApplication: Application startup failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace [http://www.springframework.org/schema/hadoop]
Offending resource: class path resource [hiveContext.xml]
My pom has the following dependency.
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-hadoop-boot</artifactId>
<version>2.5.0.RELEASE</version>
</dependency>
I know some other posts talks about SpringSecurity, but I don't have access to a spring-hadoop-config dependency.
Related
I have a webapp that runs fine in JBoss EAP 6.4. I want to add some functionality to my webapp so that it can process Parquet files that reside in AzureBlob storage. I add a single dependency to my pom.xml:
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-azure</artifactId>
<version>3.1.0</version>
</dependency>
If I now try to start my webapp, it fails at start up:
09:29:43,703 ERROR [org.jboss.msc.service.fail] (MSC service thread
1-10) MSC000001: Failed to start service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
JBAS018733: Failed to process phase POST_MODULE of deployment
"myApp-0.0.1-SNAPSHOT.war" at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] at
org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980)
[jboss-msc-1.1.5.Final-redhat-1.jar:1.1.5.Final-redhat-1]
... Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011232: Only one JAX-RS Application Class allowed.
com.sun.jersey.api.core.ResourceConfig
com.sun.jersey.api.core.DefaultResourceConfig
com.sun.jersey.api.core.PackagesResourceConfig
com.mycompany.myapp.rest.RestApplication
com.sun.jersey.api.core.ClassNamesResourceConfig
com.sun.jersey.api.core.ScanningResourceConfig
com.sun.jersey.api.core.servlet.WebAppResourceConfig
com.sun.jersey.api.core.ApplicationAdapter
com.sun.jersey.server.impl.application.DeferredResourceConfig
com.sun.jersey.api.core.ClasspathResourceConfig at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.scan(JaxrsScanningProcessor.java:206)
at
org.jboss.as.jaxrs.deployment.JaxrsScanningProcessor.deploy(JaxrsScanningProcessor.java:104)
at
org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159)
[jboss-as-server-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21] ...
5 more
09:29:43,709 ERROR [org.jboss.as.controller.management-operation]
(Controller Boot Thread) JBAS014612: Operation ("deploy") failed -
address: ([("deployment" => "myApp-0.0.1-SNAPSHOT.war")]) - failure
description: {"JBAS014671: Failed services" =>
{"jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE" =>
"org.jboss.msc.service.StartException in service
jboss.deployment.unit."myApp-0.0.1-SNAPSHOT.war".POST_MODULE:
JBAS018733: Failed to process phase POST_MODULE of deployment
"myApp-0.0.1-SNAPSHOT.war"
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException:
JBAS011232: Only one JAX-RS Application Class allowed.
com.sun.jersey.api.core.ResourceConfig
com.sun.jersey.api.core.DefaultResourceConfig
com.sun.jersey.api.core.PackagesResourceConfig
com.mycompany.myapp.rest.RestApplication
com.sun.jersey.api.core.ClassNamesResourceConfig
com.sun.jersey.api.core.ScanningResourceConfig
com.sun.jersey.api.core.servlet.WebAppResourceConfig
com.sun.jersey.api.core.ApplicationAdapter
com.sun.jersey.server.impl.application.DeferredResourceConfig
com.sun.jersey.api.core.ClasspathResourceConfig"}}
The message "JBAS011232: Only one JAX-RS Application Class allowed" seems to be caused by my webapp trying to use both RestEasy and Jersey. JBoss uses RestEasy by default. Apparently, hadoop-azure must have a Jersey application class. How can I eliminate this problem by indicating that I don't want to use the Jersey-based application class?
hadoop-azure pulls in hadoop-common, which pulls in Jersey. In the version of hadoop-azure you're using, hadoop-common is in compile <scope>. In new version, it is in provided scope. So you can just upgrade the hadoop-azure dependency to the latest one. If you need hadoop-common to compile, then you can redeclare hadoop-common and put it in provided scope.
During a round of SOUP upgrades in a Spring Boot application, I bumped Apache Derby from 10.14.1.0 to 10.15.1.3. Now the tests fail with this beauty (snipped, full stacktrace here):
Failed to load ApplicationContext
java.lang.IllegalStateException: Failed to load ApplicationContext
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException:
Error creating bean with name 'org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaConfiguration':
Unsatisfied dependency expressed through constructor parameter 0
Caused by: org.springframework.beans.factory.BeanCreationException:
Error creating bean with name 'dataSource':
Invocation of init method failed
Caused by: java.lang.IllegalStateException:
Failed to replace DataSource with an embedded database for tests.
If you want an embedded database please put a supported one on the
classpath or tune the replace attribute of #AutoConfigureTestDatabase.
What is going here? Do I need to change any configuration?
Apache Derby requires Java 9 from 10.15.x on which Spring Boot does currently not support.
See also spring-boot#16433.
I just want to answer with what it took me to get Derby 15.2.0 to work with Spring Boot 2.4.4 with derby in embedded mode, on top of Java 11. Spring Boot 2.4.4 works out of the box with Derby 14, although you will get some warning as spring boot starts. Upgrading apache derby to 15.2.0 fixed that for me.
In pom, both derby and derbytools dependencies defined:
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.15.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbytools</artifactId>
<version>10.15.2.0</version>
</dependency>
Then in your apps properties file:
spring.datasource.driver-class-name=org.apache.derby.iapi.jdbc.AutoloadedDriver
Instead of:
spring.datasource.driver-class-name=org.apache.derby.jdbc.EmbeddedDriver
After that, I now get a good startup of Spring Boot with no warnings or anything that raises concerns.
When I try to run the spring boot application I am getting the below error
starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2018-05-03 10:50:09.457 ERROR 4909 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
*************************** APPLICATION FAILED TO START
***************************
Description:
Failed to auto-configure a DataSource: 'spring.datasource.url' is not specified and no embedded datasource could be auto-configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. If you have database settings to be loaded from a particular profile you may need to activate it (no profiles are currently active).
The above answers are correct in case you want to use a non-embedded data source. In case you want to use an embedded data source, you will only need to add the following dependency to your pom.xml:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
If you want to use the embedded data source in your tests, then change the scope to test instead of runtime.
If you want auto-configuration of datasource, then place the configuration details in application.properties file. Something like this(configuration for MySQL)
spring.datasource.url=jdbc:mysql://localhost/test
spring.datasource.username=dbuser
spring.datasource.password=dbpass
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
Configuring Spring Batch with Maven. JDK used: 1.6, Spring Batch version 2.1.8.RELEASE; Spring version 3.0.5.RELEASE. Getting run time exception as below:
D:\SpringProject\SpringTry\target>java -jar SpringTry-1.0-SNAPSHOT.jar jobs/helloWorld.xml helloWorldJob
2012-09-02 00:23:51,650 INFO [org.springframework.context.support.ClassPathXmlApplicationContext] - <Refreshing org.springframework.context.
support.ClassPathXmlApplicationContext#b29c9d: startup date [Sun Sep 02 00:23:51 IST 2012]; root of context hierarchy>
2012-09-02 00:23:51,769 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from class path
resource [jobs/helloWorld.xml]>
2012-09-02 00:23:53,854 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - <Loading XML bean definitions from class path
resource [launch-context.xml]>
2012-09-02 00:23:53,929 ERROR [org.springframework.batch.core.launch.support.CommandLineJobRunner] - <Job Terminated in error: Configuration
problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/batch]
Offending resource: class path resource [jobs/helloWorld.xml]
>
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler fo
r XML schema namespace [http://www.springframework.org/schema/batch]
Offending resource: class path resource [jobs/helloWorld.xml]
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
Any suggestion on how to resolve this. Also noticed that Spring 2.5.6 is getting downloaded everytime, along with version mentioned 3.0.5
My manifest looks like:
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven
Build-Jdk: 1.6.0
Main-Class: org.springframework.batch.core.launch.support.CommandLineJobRunner
Class-Path: lib/spring-batch-core-2.1.9.RELEASE.jar lib/xstream-1.3.jar lib/xpp3_min-1.1.4c.jar lib/jettison-1.1.jar lib/spring-aop-2.5.6.jar lib/aopalliance-1.0.jar lib/spring-tx-2.5.6.jar lib/spring-batch-infrastructure-2.1.9.RELEASE.jar lib/spring-beans-3.0.5.RELEASE.jar lib/spring-context-3.0.5.RELEASE.jar lib/spring-expression-3.0.5.RELEASE.jar lib/spring-asm-3.0.5.RELEASE.jar lib/spring-core-3.0.5.RELEASE.jar lib/commons-logging-1.1.1.jar lib/spring-jdbc-3.0.5.RELEASE.jar lib/log4j-1.2.16.jar lib/maven-resources-plugin-2.4.3.jar lib/maven-plugin-api-2.0.6.jar lib/maven-project-2.0.6.jar lib/maven-profile-2.0.6.jar lib/maven-artifact-manager-2.0.6.jar lib/maven-plugin-registry-2.0.6.jar lib/maven-core-2.0.6.jar lib/wagon-file-1.0-beta-2.jar lib/maven-plugin-parameter-documenter-2.0.6.jar lib/wagon-http-lightweight-1.0-beta-2.jar lib/wagon-http-shared-1.0-beta-2.jar lib/jtidy-4aug2000r7-dev.jar lib/xml-apis-1.0.b2.jar lib/maven-reporting-api-2.0.6.jar lib/doxia-sink-api-1.0-alpha-7.jar lib/wagon-provider-api-1.0-beta-2.jar lib/maven-repository-metadata-2.0.6.jar lib/maven-error-diagnostics-2.0.6.jar lib/commons-cli-1.0.jar lib/wagon-ssh-external-1.0-beta-2.jar lib/wagon-ssh-common-1.0-beta-2.jar lib/maven-plugin-descriptor-2.0.6.jar lib/plexus-interactivity-api-1.0-alpha-4.jar lib/wagon-ssh-1.0-beta-2.jar lib/jsch-0.1.27.jar lib/classworlds-1.1.jar lib/maven-artifact-2.0.6.jar lib/maven-settings-2.0.6.jar lib/maven-model-2.0.6.jar lib/maven-monitor-2.0.6.jar lib/plexus-container-default-1.0-alpha-9-stable-1.jar lib/junit-3.8.1.jar lib/plexus-utils-2.0.5.jar lib/maven-filtering-1.0-beta-4.jar lib/plexus-build-api-0.0.4.jar lib/plexus-interpolation-1.13.jar
Most probably you are either:
simply using a version of spring-batch-core jar (Maven dependency) which has version below 2.0. Schema naming works for version 2.0 and above. If it's the case, update your dependency
or
You have the correct (higher than 2.0) version of spring-batch-core in your project's pom.xml, but you also have a transitive dependency which brings into your project an earlier version of spring-batch-core. If that's the case, try the following:
mvn dependency:tree -Dverbose -Dincludes=org.springframework.batch
this will list all the dependencies that bring in their own version of spring-batch dependencies. Add an exclude entry on spring-batch-core for those dependencies, something like this:
<dependency>
<groupId>whatever.group</groupId>
<artifactId>whateverArtifact</artifactId>
<version>1.0</version>
<exclusions>
<exclusion>
<groupId>org.springframework.batch</groupId>
<artifactId>spring-batch-core</artifactId>
</exclusion>
</exclusions>
</dependency>
My issue was resolved by adding maven-shade-plugin as detailed in the:
https://stackoverflow.com/a/8574629/1419116
i am facing this error:-
ERROR: org.springframework.web.context.ContextLoader - Context
initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
Configuration problem: Unable to locate Spring NamespaceHandler for
XML schema namespace [http://www.springmodules.org/schema/ehcache]
Offending resource: ServletContext resource
[/WEB-INF/spring/application-context.xml]
If any solution for this give me suggestion.
This seems to be a library issue . Check if you have the ehcache jar in your classpath . Else download it from here .