cleardb (mySQL) connection problem witth Heroku (spring) - mysql

I am creating a springboot application which has data stored in a mysql database. I have used cleardb as an add-on and have deployed the app to Heroku. When I run the app (i.e heroku open), the main page (index.html) displays successfully as it does not require access to the mySQL database. However, all of the pages that do require access to the mySQL database do not display and return the error below:
There was an unexpected error (type=Internal Server Error, status=500).
Failed to obtain JDBC Connection; nested exception is com.mysql.cj.jdbc.exceptions.CommunicationsException: Communications link failure The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Here is some of my code:
Databaseconfig
#Configuration
public class DatabaseConfig {
#Bean
public NamedParameterJdbcTemplate namedParameterJdbcTemplate(DataSource dataSource) {
return new NamedParameterJdbcTemplate(dataSource);
}
#Bean
public DataSource dataSource() {
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost/NBA");
dataSource.setUsername("root");
dataSource.setPassword("root");
return dataSource;
}
}
pom.xml plugins
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
database_url (heroku config)
CLEARDB_DATABASE_URL: mysql://b---------9:9--------#us-cdbr-iron-east-05.cleardb.net/heroku_f61b74207636b77?reconnect=true
DATABASE_URL: 'mysql://b---------9:9--------#us-cdbr-iron-east-05.cleardb.net/heroku_f61b74207636b77?reconnect=true'
Some things to take note of:
My application.properties file is currently empty.
The application runs perfectly when I run it on localhost:8080.
Any and all help would be greatly appreciated.

For your case your must change the dataSource configuration according your database_url(heroku config):
dataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://us-cdbr-iron-east-05.cleardb.net/heroku_f61b74207636b77?reconnect=true");
dataSource.setUsername("b05ee51c5eec59");
dataSource.setPassword("94a4e9eb");
I also suggest you to use following in your application.properties instead of using datasource bean:
spring.datasource.username=
spring.datasource.password=
spring.datasource.url=
Also very important: change your database password in the heroku and dont write it on the internet

Related

Cannot connect to database with flyway through Maven

I am trying to setup flyway for a project with maven and i am unable to make it work. I have the correct configuration (db url, username, password) and i tried connecting to the DB with MySQL Workbench, PhPMyAdmin and also used the flyway command line tool and everything works except maven.
This is the error i am getting:
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:8.5.5:migrate (default-cli) on project flyway-fitinpulse: org.flywaydb.core.api.FlywayException: No database found to handle jdbc:mariadb://placeholderip:3306/db_name -> [Help 1]
And my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.fitinpulse</groupId>
<artifactId>flyway-fitinpulse</artifactId>
<version>1.0.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<configuration>
<url>jdbc:mariadb://placeholderip:3306/db_name</url>
<user>user</user>
<password>password</password>
</configuration>
</plugin>
</plugins>
</build>
Does anyone has any insight?
Have you tried adding <driver> </driver>
inside <configuration>?
Because otherwise the driver is auto-detected based on the url and this might lead to a connection problem I guess.
I finally found the problem. In newer version of the flyway for mysql you need to provide another flyway dependency along with the connection driver:
<dependencies>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
<version>8.5.5</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.0.4</version>
</dependency>
</dependencies>

Error Could not get JDBC Connection when java web tries connect to mariadb galera cluster

I have a java webapp with spring mvc, mybatis, jndi and tomcat
Additionally, On Tomcat context.xml, I defined:
<Resource auth="Container"
driverClassName="com.mysql.jdbc.Driver"
maxIdle="100" maxTotal="100"
name="jdbc/dbExample"
password="dbpass"
type="javax.sql.DataSource"
url="jdbc:mariadb:sequential://192.1.1.12,192.1.1.13,192.1.1.14:3306/dbExample"
username="dbuser"/>
Also, in pom file I have the following dependency:
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>1.7.6</version>
</dependency>
The database is mariadb galera cluster multimaster.
Then when I test the web app I got the following error:
Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot load JDBC driver class 'com.mysql.jdbc.Driver'] with root cause java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
What can I do?

How to connect Spring Boot Application with MySQL database?

I am new at spring framework, I want to connect my MySQL database which located in localhost with spring boot application.
I'm listing out the minimal configuration:
In pom.xml
<!-- JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- Use MySQL Connector-J -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
In application.properties
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=jdbc:mysql://localhost:3306/db_example
spring.datasource.username=springuser
spring.datasource.password=ThePassword
You can get such examples everywhere. Prefer to read https://spring.io/guides/gs/accessing-data-mysql/
Source : https://spring.io
Checkout other questions too :
How to use Spring Boot with MySQL database and JPA?
Spring Boot MYSQL connection
Spring boot - MySQL settings are not working
You need to add database configuration properties for Mysql in your application.properties:
spring.jpa.hibernate.ddl-auto=create
spring.datasource.url=jdbc:mysql://localhost:3306/db_example
spring.datasource.username=mysql
spring.datasource.password=mysql
spring.jpa.hibernate.ddl-auto=create this configuration will create tables based on your entities which were created by you.
spring.datasource.url=jdbc:mysql://localhost:3306/db_example this configuration connects through jdbc to your database called db_example. You need to create that database.
spring.datasource.username=mysql this configuration you need to put your user who will connect via jdbc to your mysql database.
spring.datasource.password=mysql this configuration you need to provide your password which is represented by your user in order to connect through jdbc to your mysql database.
In addition tou you need to add dependencies for Mysql and JPA.
If you are using maven, add the dependencies in your pom.xml:
<dependencies>
<!-- JPA Data (We are going to use Repositories, Entities, Hibernate, etc...) -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<!-- Use MySQL Connector-J -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
If you are using gradle, add the dependencies in build.gradle:
dependencies {
// JPA Data (We are going to use Repositories, Entities, Hibernate, etc...)
compile 'org.springframework.boot:spring-boot-starter-data-jpa'
// Use MySQL Connector-J
compile 'mysql:mysql-connector-java'
}
Add below dependencies in pom.xml.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
Add below database properties in application.properties.
spring.datasource.url=jdbc:mysql://localhost:3306/dbname
spring.datasource.username=root
spring.datasource.password=root
For more details please refer this link
To connect with mysql need some dependencies as below
Dependencies (maven -> pom.xml).
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
in application.properties need some extra configuration setting which must like like
application.properties (src/main/resources/application.properties)
# DataSource settings: set here your own configurations for the database
# connection. In this example we have "netgloo_blog" as database name and
# "root" as username and password.
spring.datasource.url = jdbc:mysql://localhost:8889/database_name
spring.datasource.username = mysql-userId
spring.datasource.password = mysql-pwd
# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1
# Show or not log for each sql query
spring.jpa.show-sql = true
# Hibernate ddl auto (create, create-drop, update)
spring.jpa.hibernate.ddl-auto = update
# Naming strategy (Not necessary to add but you can use this too)
spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy
# Use spring.jpa.properties.* for Hibernate native properties (the prefix is
# stripped before adding them to the entity manager)
# The SQL dialect makes Hibernate generate better SQL for the chosen database
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
Now your EntityManager Object will be constructed when you starts your spring boot Configuration.
Above defined configuration is enough to connect your local my-sql database but here is some more configuration that you need to make your code more readable.
Enable JPARepositories such that CRUD Repositories must defined in a defined package.
Add #EnableJPARepositories("basepackage.*") to your SpringBootMainApplicationClass like this..
#SpringBootApplication
#EnableJPARepositories("com.demo.application.*.repositories")
#ComponentScan("com.demo.application.*")
public class SpringBootMainApplicationClass {
public static void main(String[] args) {
SpringApplication.run(SpringBootMainApplicationClass.class, args);
}
}
by adding #EnableJPARepositories Annotation in MainClass enables user to make your code more readable and EntityManager Object only restricted to only defined package.
application.properties
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://localhost:3306/jpa
spring.datasource.username = root
spring.datasource.password =
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
build.gradle
implementation 'mysql:mysql-connector-java:8.0.15'

Arquillian can't inject a local or remote EJB on Glassfish embedded container

I use Arquillian to test an EJB that has an explicit local and remote interface. But in the test Arquillian does not "inject" anything in a field that has the type of the local interface, or the remote interface.
I use the Glassfish embedded as server for test and I use junit4.
I used :
#EJB ,
#Inject ,
#EJB(lookup="java:global/costa-services-depa/GreeterImpl!es.costa.GreeterLocal") ,
#EJB(lookup="java:global/costa-services-depa/GreeterImpl!es.costa.GreeterRemote")
With (2) even for GreeterImpl, or GreeterLocal or GreeterRemote it gives me the error Could not inject members.
With (1,3,4) I get a java.lang.NullPointerException which means that the EJB is not injected.
This is a part of my code:
#RunWith(Arquillian.class)
public class greeterTest {
#Deployment
public static Archive<?> createDeployment() {
JavaArchive jar = ShrinkWrap.create(JavaArchive.class,"costa-services-depa")
.addClasses(
GreeterRemote.class,
GreeterLocal.class,
Greeter.class)
.addAsManifestResource("test-persistence.xml", "persistence.xml")
.addAsManifestResource("jbossas-ds.xml")
.addAsManifestResource("META-INF/beans.xml",
ArchivePaths.create("beans.xml"));
return jar;
}
#Inject
GreeterImpl greeter;
#Test
public void testTestServiceLocal(){
System.out.println(greeter.getMessage());
}
}
Here is the glassfish-resources.xml:
...
<resources>
<jdbc-resource pool-name="ArquillianEmbeddedH2Pool"
jndi-name="jdbc/arquillian"/>
<jdbc-connection-pool name="ArquillianEmbeddedH2Pool"
res-type="javax.sql.DataSource"
datasource-classname="org.h2.jdbcx.JdbcDataSource">
<property name="user" value="sa"/>
<property name="password" value=""/>
<property name="url" value="jdbc:h2:file:target/databases/h2/db"/>
</jdbc-connection-pool>
</resources>
Here is the test-persistence.xml:
...
<persistence-unit name="test">
<jta-data-source>jdbc/arquillian</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.logging.level.sql" value="FINE"/>
<property name="eclipselink.logging.parameters" value="true"/>
</properties>
</persistence-unit>
This is the arquillian.xml:
...
<container qualifier="glassfish-embedded" default="true">
<configuration>
<property name="resourcesXml">
ejbModule/src/test/resources-glassfish-embedded/glassfish-resources.xml
</property>
</configuration>
</container>
...
This is jbossas-ds.xml:
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.jboss.org/ironjacamar/schema
http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<datasource enabled="true"
jndi-name="jdbc/arquillian"
pool-name="ArquillianEmbeddedH2Pool">
<connection-url>jdbc:h2:mem:arquillian;DB_CLOSE_DELAY=-1</connection-url>
<driver>h2</driver>
</datasource>
</datasources>
About dependencies for Glassfish embedded and Arquillian and Junit:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.0.3.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<profiles>
<profile>
<id>arquillian-glassfish-embedded</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-glassfish-embedded-3.1</artifactId>
<version>1.0.0.CR3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.main.extras</groupId>
<artifactId>glassfish-embedded-all</artifactId>
<version>3.1.2.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.3.166</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>ejbModule/src/test/resources</directory>
</testResource>
<testResource>
<directory>ejbModule/src/test/resources-glassfish-embedded</directory>
</testResource>
</testResources>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<systemPropertyVariables>
<arquillian.launch>glassfish-embedded</arquillian.launch>
<java.util.logging.config.file>
${project.build.testOutputDirectory}/logging.properties
</java.util.logging.config.file>
<derby.stream.error.file>
${project.build.directory}/derby.log
</derby.stream.error.file>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
In the console I noticed:
Infos: Network listener https-listener on port 0 disabled per domain.xml
Infos: Grizzly Framework 1.9.50 started in: 32ms - bound to [0.0.0.0:8181]
Infos: GlassFish Server Open Source Edition 3.1.2.2 (java_re) startup time :
Embedded (525ms), startup services(384ms), total(909ms)
Infos: command add-resources result:
PlainTextActionReporterSUCCESSDescription: add-resources AdminCommandnull
JDBC connection pool ArquillianEmbeddedH2Pool created successfully.
JDBC resource jdbc/arquillian created successfully.
Infos: SEC1002: Security Manager is OFF.
Infos: SEC1010: Entering Security Startup Service
Infos: SEC1143: Loading policy provider
com.sun.enterprise.security.jacc.provider.SimplePolicyProvider.
Infos: SEC1115: Realm [admin-realm] of classtype
[com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
[com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Infos: SEC1115: Realm [file] of classtype
[com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created.
Infos: SEC1115: Realm [certificate] of classtype
[com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created.
Infos: SEC1011: Security Service(s) Started Successfully
Infos: WEB0169: Created HTTP listener [http-listener] on host/port [0.0.0.0:8181]
Infos: WEB0171: Created virtual server [server]
Infos: WEB0172: Virtual server [server] loaded default web module []
Infos: WELD-000900 SNAPSHOT
Infos: WEB0671: Loading application [**test**] at [**/test**]
Infos: test was successfully deployed in 1 822 milliseconds.
PlainTextActionReporterSUCCESSNo monitoring data to report.
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.308 sec
Infos: Shutdown procedure finished
Infos: [Thread[GlassFish Kernel Main Thread,5,main]] exiting
NB : By default that deploys as test application or not as what I made "costa-services-depa"?
To know that in the path of call of EJB I put test instead of costa-service-depa but always it gives me the same problem (NullPointerException).
I'm having the same problem trying to somehow inject a context bean in an Arquillian test against GlassFish 4.1.
This issue seems related to a GlassFish (major and open) bug:
https://java.net/jira/browse/GLASSFISH-21167
They say injections in GlassFish won't work deploying a war with certain conditions:
The application uses an empty <absoluteOrdering> tag in web.xml
The classes of the application are all packed as jar archives in the [war]\WEB-INF\lib\ directory, instead of included them unpacked in the [war]\WEB-INF\classes\ directory
What happens to me is that my #Singleton bean is created and injected but for every #EJB reference in the app, not just created once.
I checked my Arquillian deployment on GF (glassfish-4.1\glassfish\domains\domain1\applications\test) and I can see the test.jar deployed in [war]\WEB-INF\lib\. I don't have a web.xml in my app and I don't see it in my GlassFish deployment. I guess the web.xml is provided somehow automatically.
Deploying the same app with Arquillian on Wildfly works fine and my #Singleton bean is injected correctly as expected.

MiniDFSCluster gives ioexception

I am trying to test in hadoop. have the code as:
System.setProperty("test.build.data","/folder");
config = new Configuration();
cluster = new MiniDFSCluster(config,1,true,null);
but in new MiniDFSCluster(config,1,true,null), it throws exception:
java.io.IOException: Cannot run program "du": CreateProcess error=2, The system cannot find the file specified.
at java.lang.ProcessBuilder.start(ProcessBuilder.java:470)
at org.apache.hadoop.util.Shell.runCommand(Shell.java:149)
at org.apache.hadoop.util.Shell.run(Shell.java:134)
at org.apache.hadoop.fs.DU.<init>(DU.java:53)
at org.apache.hadoop.fs.DU.<init>(DU.java:63)
at org.apache.hadoop.hdfs.server.datanode.FSDataset$FSVolume.<init>(FSDataset.java:333)
at org.apache.hadoop.hdfs.server.datanode.FSDataset.<init>(FSDataset.java:689)
at org.apache.hadoop.hdfs.server.datanode.DataNode.startDataNode(DataNode.java:302)
at org.apache.hadoop.hdfs.server.datanode.DataNode.<init>(DataNode.java:216)
at org.apache.hadoop.hdfs.server.datanode.DataNode.makeInstance(DataNode.java:1283)
at org.apache.hadoop.hdfs.server.datanode.DataNode.instantiateDataNode(DataNode.java:1238)
at org.apache.hadoop.hdfs.MiniDFSCluster.startDataNodes(MiniDFSCluster.java:417)
at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:280)
at org.apache.hadoop.hdfs.MiniDFSCluster.<init>(MiniDFSCluster.java:124)
at ebay.Crawler.TestAll.testinit(TestAll.java:53)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:599)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:81)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified.
at java.lang.ProcessImpl.<init>(ProcessImpl.java:92)
at java.lang.ProcessImpl.start(ProcessImpl.java:41)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:463)
... 33 more
Could someone please give me some hint how to solve this?
Thank you very much.
Looks like the du command is not there on the system or is not in the PATH. If using Hadoop on Windows then Cygwin has to be installed. Anyway, which du will give the location of du binary.
I suspect you're using a Cloudera distribution of Hadoop. Version 1.0.0 of 'vanilla' Hadoop does work on Windows - at least create and writing to a file does.
If you need to run unit tests in a local Windows environment, try using Maven profile properties to set a version of 1.0.0 in you local Maven config, and in the POM specify the 'remote' config. The global setting will override the POM-specific one.
settings.xml
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>windows</id>
<properties>
<hadoop.version>1.0.0</hadoop.version>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>windows</activeProfile>
</activeProfiles>
</settings>
pom.xml
<properties>
<hadoop.version>0.20.2-cdh3u2</hadoop.version>
</properties>
<dependency>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-core</artifactId>
<version>${hadoop.version}</version>
</dependency>