WARNING: No mapping found for HTTP request with URI [/CustomerDetails/] in DispatcherServlet with name 'customerdispatcher' [duplicate] - spring

This question already has answers here:
Why does Spring MVC respond with a 404 and report "No mapping found for HTTP request with URI [...] in DispatcherServlet"?
(13 answers)
Closed 6 years ago.
I had a issue in spring3 frameowrk.org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/CustomerDetails/] in DispatcherServlet with name 'customerdispatcher'
Please see the following
Jun 01, 2014 11:16:27 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\PC Connectivity Solution\;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Files (x86)\AMD APP\bin\x86_64;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Sony\VAIO Improvement\;C:\Program Files (x86)\Sony\VAIO Startup Setting Tool;C:\Program Files\MySQL\MySQL Server 5.1\bin;;.
Jun 01, 2014 11:16:28 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:CustomerDetails' did not find a matching property.
Jun 01, 2014 11:16:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jun 01, 2014 11:16:28 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jun 01, 2014 11:16:28 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1635 ms
Jun 01, 2014 11:16:28 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jun 01, 2014 11:16:28 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.50
Jun 01, 2014 11:16:30 AM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\Users\Smileanbu\Documents\Spring_JDBC\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\CustomerDetails\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core_rt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/core is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/core is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt_rt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/fmt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/fmt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/functions is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/permittedTaglibs is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://jakarta.apache.org/taglibs/standard/scriptfree is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql_rt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/sql is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/sql is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml_rt is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jstl/xml is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.startup.TaglibUriRule body
INFO: TLD skipped. URI: http://java.sun.com/jsp/jstl/xml is already defined
Jun 01, 2014 11:16:33 AM org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
Jun 01, 2014 11:16:33 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'customerdispatcher'
Jun 01, 2014 11:16:33 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'customerdispatcher': initialization started
Jun 01, 2014 11:16:33 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing WebApplicationContext for namespace 'customerdispatcher-servlet': startup date [Sun Jun 01 11:16:33 IST 2014]; root of context hierarchy
Jun 01, 2014 11:16:34 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/customerdispatcher-servlet.xml]
Jun 01, 2014 11:16:34 AM org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider registerDefaultFilters
INFO: JSR-250 'javax.annotation.ManagedBean' found and supported for component scanning
Jun 01, 2014 11:16:35 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory#19705d39: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalPersistenceAnnotationProcessor,viewResolver,dataSource,sessionFactory,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.transaction.annotation.AnnotationTransactionAttributeSource#0,org.springframework.transaction.interceptor.TransactionInterceptor#0,org.springframework.transaction.config.internalTransactionAdvisor,transactionManager,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy
300 [localhost-startStop-1] INFO org.hibernate.annotations.common.Version - Hibernate Commons Annotations 3.2.0.Final
312 [localhost-startStop-1] INFO org.hibernate.cfg.Environment - Hibernate 3.6.10.Final
315 [localhost-startStop-1] INFO org.hibernate.cfg.Environment - hibernate.properties not found
321 [localhost-startStop-1] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
327 [localhost-startStop-1] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
479 [localhost-startStop-1] INFO org.hibernate.cfg.Configuration - configuring from url: file:/C:/Users/Smileanbu/Documents/Spring_JDBC/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/CustomerDetails/WEB-INF/classes/hibernate.cfg.xml
538 [localhost-startStop-1] WARN org.hibernate.util.DTDEntityResolver - recognized obsolete hibernate namespace http://hibernate.sourceforge.net/. Use namespace http://www.hibernate.org/dtd/ instead. Refer to Hibernate 3.6 Migration Guide!
594 [localhost-startStop-1] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
688 [localhost-startStop-1] INFO org.hibernate.cfg.AnnotationBinder - Binding entity from annotated class: com.springforbeginners.model.Customer
778 [localhost-startStop-1] INFO org.hibernate.cfg.annotations.EntityBinder - Bind entity com.springforbeginners.model.Customer on table CUSTOMER
900 [localhost-startStop-1] INFO org.hibernate.cfg.Configuration - Hibernate Validator not found: ignoring
Jun 01, 2014 11:16:36 AM org.springframework.orm.hibernate3.LocalSessionFactoryBean buildSessionFactory
INFO: Building new Hibernate SessionFactory
919 [localhost-startStop-1] INFO org.hibernate.cfg.search.HibernateSearchEventListenerRegister - Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
929 [localhost-startStop-1] INFO org.hibernate.connection.ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
1606 [localhost-startStop-1] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.MySQLDialect
1641 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Database ->
name : MySQL
version : 5.1.73-community
major : 5
minor : 1
1641 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Driver ->
name : MySQL-AB JDBC Driver
version : mysql-connector-java-5.1.14 ( Revision: ${bzr.revision-id} )
major : 5
minor : 1
1644 [localhost-startStop-1] INFO org.hibernate.transaction.TransactionFactoryFactory - Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
1648 [localhost-startStop-1] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
1648 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
1648 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
1649 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
1649 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
1651 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
1651 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
1651 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
1653 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Maximum outer join fetch depth: 2
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
1654 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
1661 [localhost-startStop-1] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
1661 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
1661 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
1663 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
1663 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
1663 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.NoCachingRegionFactory
1681 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
1681 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
1699 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
1701 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
1702 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
1702 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
1702 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
1702 [localhost-startStop-1] INFO org.hibernate.cfg.SettingsFactory - Check Nullability in Core (should be disabled when Bean Validation is on): enabled
1751 [localhost-startStop-1] INFO org.hibernate.impl.SessionFactoryImpl - building session factory
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [characters_clob] overrides previous : org.hibernate.type.PrimitiveCharacterArrayClobType#236f7565
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [clob] overrides previous : org.hibernate.type.ClobType#6a844c0f
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Clob] overrides previous : org.hibernate.type.ClobType#6a844c0f
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_characters_clob] overrides previous : org.hibernate.type.CharacterArrayClobType#139da36b
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_clob] overrides previous : org.hibernate.type.MaterializedClobType#5253cfdc
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [materialized_blob] overrides previous : org.hibernate.type.MaterializedBlobType#7c739ebd
1788 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [wrapper_materialized_blob] overrides previous : org.hibernate.type.WrappedMaterializedBlobType#abaca20
1789 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [blob] overrides previous : org.hibernate.type.BlobType#6d2c0060
1789 [localhost-startStop-1] INFO org.hibernate.type.BasicTypeRegistry - Type registration [java.sql.Blob] overrides previous : org.hibernate.type.BlobType#6d2c0060
2313 [localhost-startStop-1] INFO org.hibernate.impl.SessionFactoryObjectFactory - Not binding factory to JNDI, no JNDI name configured
Jun 01, 2014 11:16:38 AM org.springframework.orm.hibernate3.HibernateTransactionManager afterPropertiesSet
INFO: Using DataSource [org.apache.commons.dbcp.BasicDataSource#1c53ccd6] of Hibernate SessionFactory for HibernateTransactionManager
Jun 01, 2014 11:16:38 AM org.springframework.web.servlet.FrameworkServlet initServletBean
INFO: FrameworkServlet 'customerdispatcher': initialization completed in 4758 ms
Jun 01, 2014 11:16:38 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jun 01, 2014 11:16:38 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jun 01, 2014 11:16:38 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 10104 ms
Jun 01, 2014 11:16:40 AM org.springframework.web.servlet.DispatcherServlet noHandlerFound
WARNING: No mapping found for HTTP request with URI [/CustomerDetails/] in DispatcherServlet with name 'customerdispatcher'
customerdispatcher-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.1.xsd">
<context:annotation-config />
<context:component-scan base-package="com.springforbeginners.controller.CustomerController" />
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
<property name="prefix" value="/WEB-INF/jsp/" />
<property name="suffix" value=".jsp" />
</bean>
<bean id="dataSource" destroy-method="close" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/customerdb"/>
<property name="username" value="root"/>
<property name="password" value="123456"/>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
</bean>
<tx:annotation-driven />
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0">
<servlet>
<servlet-name>customerdispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>customerdispatcher</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/index</welcome-file>
</welcome-file-list>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
</web-app>
CustomerController class
package com.springforbeginners.controller;
import com.springforbeginners.model.Customer;
import com.springforbeginners.service.CustomerService;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
#Controller
public class CustomerController {
#Autowired
private CustomerService customerService;
#RequestMapping("/index")
public String listCustomers(Map<String, Object> map) {
map.put("customer", new Customer());
map.put("customerList", customerService.listCustomer());
return "customer";
}
#RequestMapping(value = "/add", method = RequestMethod.POST)
public String addCustomer(#ModelAttribute("customer") Customer customer, BindingResult result) {
customerService.addCustomer(customer);
return "redirect:/index";
}
#RequestMapping("/delete/{customerId}")
public String deleteCustomer(#PathVariable("customerId") Integer customerId) {
customerService.removeCustomer(customerId);
return "redirect:/index";
}
}
I am not able to get my customer.jsp page it is present in my WEB_INF/jsp/customer.jsp.Please help me from this error No matching Http request for URL
WARNING: No mapping found for HTTP request with URI [/CustomerDetails/] in DispatcherServlet with name 'customerdispatcher'

In your controller or your web.xml, there's nothing that maps yor URI to CustomerDetails. You should either change
<url-pattern>/</url-pattern> to <url-pattern>/CustomerDetails</url-pattern>
or add this in your controller
#Controller
#RequestMapping(value = "CustomerDetails")
public class CustomerController {
...
}
And then you can call the url by:
Context/CustomerDetails/index
And by the way, in your <welcome-file-list>, if you are trying to call the servlet on initializing, it won't work, the <welcome-file> has to be a "file".

Related

Update not happening with Spring Data JPA

I'm using programmatic configuration of Spring Data JPA which goes like this:
package com.bosch.bip.Utils;
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
import org.apache.commons.dbcp.BasicDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
#Configuration
#EnableTransactionManagement
#EnableJpaRepositories(basePackages="com.bosch.bip.Repositories",queryLookupStrategy=Key.CREATE_IF_NOT_FOUND)
public class PersistentContext {
#Bean
DataSource datasource()
{
BasicDataSource ds=new BasicDataSource();
ds.setUrl("jdbc:oracle:thin:#10.165.18.29:1521:ORCL");
ds.setDriverClassName("oracle.jdbc.driver.OracleDriver");
ds.setUsername("BIPUser");
ds.setPassword("BIP");
return ds;
}
#Bean
LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource ds)
{
LocalContainerEntityManagerFactoryBean emf= new LocalContainerEntityManagerFactoryBean();
emf.setDataSource(ds);
emf.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
emf.setPackagesToScan("com.bosch.bip.Entities");
Properties jpaProperties = new Properties();
jpaProperties.put("hibernate.dialect","org.hibernate.dialect.Oracle10gDialect");
jpaProperties.put("hibernate.hbm2ddl.auto", "update");
jpaProperties.put("hibernate.enable_lazy_load_no_trans", "true");
jpaProperties.put("hibernate.format_sql", "true");
jpaProperties.put("hibernate.show_sql", "true");
emf.setJpaProperties(jpaProperties);
return emf;
}
#Bean
JpaTransactionManager transactionManager(EntityManagerFactory emf)
{
JpaTransactionManager tm= new JpaTransactionManager();
tm.setEntityManagerFactory(emf);
return tm;
}
}
And I'm using a custom repository to update a row in my DB, the code of which goes like this:
package com.bosch.bip.Repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.transaction.annotation.Transactional;
import com.bosch.bip.Entities.AdapterVersion;
public interface AdapterVersion_REP extends JpaRepository<AdapterVersion, Long>{
#Modifying(clearAutomatically=true)
#Query(value ="update ADAPTER_VERSION av SET av.DESCRIPTION=:description WHERE av.ADAPTER_ID=:adapterId AND av.VERSION=:version",nativeQuery=true )
#Transactional
int updateSelectedAdapterDetails(#Param("description") String description,#Param("adapterId") int adapterId, #Param("version") String serverVersion );
}
When I try executing the query using a REST client, the console just goes blank without any action.
Please help as I'm unable to get through this.
Logs for the SQL:
May 11, 2016 1:31:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'antiJARLocking' to 'true' did not find a matching property.
May 11, 2016 1:31:32 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:activiti-explorer' did not find a matching property.
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version: Apache Tomcat/8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built: Dec 1 2015 22:30:46 UTC
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server number: 8.0.30.0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name: Windows 7
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version: 6.1
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture: amd64
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home: C:\Program Files\Java\jre8
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version: 1.8.0_71-b15
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor: Oracle Corporation
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE: C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME: C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -agentlib:jdwp=transport=dt_socket,suspend=y,address=localhost:5858
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=C:\Himangshu\WS\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Users\CHH7KOR\Desktop\apache-tomcat-8.0.30\endorsed
May 11, 2016 1:31:32 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
May 11, 2016 1:31:32 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre8\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/bin/server;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/bin;C:/Program Files/Java/jdk1.8.0_74/bin/../jre/lib/amd64;C:\Users\CHH7KOR\Documents\Maven\apache-maven-3.3.9\bin;C:\Program Files\Java\jdk1.8.0_74\bin;C:\Program Files (x86)\Maven\apache-maven-3.3.9\bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\7-Zip;C:\Program Files (x86)\Toolbase Client;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\;C:\Program Files (x86)\MySQL\MySQL Fabric 1.5 & MySQL Utilities 1.5\Doctrine extensions for PHP\;C:\Program Files (x86)\QuickTime\QTSystem;C:\Program Files (x86)\Ant\apache-ant-1.9.6-bin\apache-ant-1.9.6\bin;C:\Program Files (x86)\WebEx\Productivity Tools;C:\Users\CHH7KOR\Downloads\eclipse;;C:\Program Files\WinMagic\SecureDoc-NT\;.
May 11, 2016 1:31:32 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
May 11, 2016 1:31:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 11, 2016 1:31:33 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-nio-8009"]
May 11, 2016 1:31:33 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
INFO: Using a shared selector for servlet write/read
May 11, 2016 1:31:33 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1387 ms
May 11, 2016 1:31:33 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
May 11, 2016 1:31:33 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.30
May 11, 2016 1:31:33 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [151] milliseconds.
May 11, 2016 1:31:41 PM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
May 11, 2016 1:31:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Spring WebApplicationInitializers detected on classpath: [com.bosch.bip.RESTfulServices.RESTfulInitializer#1e936f98]
May 11, 2016 1:31:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
01:31:41,738 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
01:31:41,929 [localhost-startStop-1] INFO org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Wed May 11 13:31:41 IST 2016]; root of context hierarchy
01:31:42,067 [localhost-startStop-1] INFO org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Registering annotated classes: [class com.bosch.bip.RESTfulServices.RESTfulConfiguration]
01:31:43,187 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/update],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.http.ResponseEntity<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.createUser(org.springframework.util.MultiValueMap<java.lang.Object, java.lang.Object>)
01:31:43,187 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/allAdapterDetails],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.serviceForFetchingAllAdapterDetails() throws java.io.IOException
01:31:43,188 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping - Mapped "{[/adapters/selectedAdapterDetailsForUpdate/{adapterId}/{serverVersion}],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.util.List<java.lang.Object> com.bosch.bip.RESTfulServices.AdapterController_CRUD.serviceForFetchingSelectedAdapterDetails(java.util.Map<java.lang.Object, java.lang.Object>) throws java.io.IOException
01:31:43,875 [localhost-startStop-1] INFO org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter - Looking for #ControllerAdvice: Root WebApplicationContext: startup date [Wed May 11 13:31:41 IST 2016]; root of context hierarchy
01:31:44,072 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization completed in 2332 ms
01:31:44,083 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcher': initialization started
May 11, 2016 1:31:44 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'dispatcher'
01:31:44,148 [localhost-startStop-1] INFO org.springframework.web.servlet.DispatcherServlet - FrameworkServlet 'dispatcher': initialization completed in 65 ms
May 11, 2016 1:31:44 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
May 11, 2016 1:31:44 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
May 11, 2016 1:31:44 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 11078 ms
01:31:52,099 [http-nio-8080-exec-2] INFO org.springframework.context.annotation.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext#12b5782d: startup date [Wed May 11 13:31:52 IST 2016]; root of context hierarchy
01:31:56,158 [http-nio-8080-exec-2] INFO org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'default'
01:31:56,416 [http-nio-8080-exec-2] INFO org.hibernate.jpa.internal.util.LogHelper - HHH000204: Processing PersistenceUnitInfo [
name: default
...]
01:31:57,686 [http-nio-8080-exec-2] INFO org.hibernate.Version - HHH000412: Hibernate Core {4.3.11.Final}
01:31:57,725 [http-nio-8080-exec-2] INFO org.hibernate.cfg.Environment - HHH000206: hibernate.properties not found
01:31:57,738 [http-nio-8080-exec-2] INFO org.hibernate.cfg.Environment - HHH000021: Bytecode provider name : javassist
01:32:00,394 [http-nio-8080-exec-2] INFO org.hibernate.annotations.common.Version - HCANN000001: Hibernate Commons Annotations {4.0.5.Final}
01:32:02,658 [http-nio-8080-exec-2] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.Oracle10gDialect
01:32:02,790 [http-nio-8080-exec-2] INFO org.hibernate.engine.jdbc.internal.LobCreatorBuilder - HHH000424: Disabling contextual LOB creation as createClob() method threw error : java.lang.reflect.InvocationTargetException
01:32:04,883 [http-nio-8080-exec-2] INFO org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory - HHH000397: Using ASTQueryTranslatorFactory
01:32:09,570 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000228: Running hbm2ddl schema update
01:32:09,571 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000102: Fetching database metadata
01:32:09,860 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000396: Updating schema
01:32:10,679 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER
01:32:10,679 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [name, id, is_client, classification]
01:32:10,680 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,681 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [adapter_pk]
01:32:10,746 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER_SERVER_MAP
01:32:10,747 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [adapter_version_id, server_id]
01:32:10,748 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [adapter_server_map_server_fk, adapter_server_map_adapver_fk]
01:32:10,748 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: []
01:32:10,817 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.ADAPTER_VERSION
01:32:10,817 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [num_recon_attempt, polling_freq, tooltip, jar_path, description, adapter_id, id, category, type, version, status]
01:32:10,818 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [adapter_version_configval_fkv1, adapter_version_adapter_fk]
01:32:10,819 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [adapter_version_pk]
01:32:10,868 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.CONFIG_TYPE
01:32:10,868 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [id, type, value]
01:32:10,869 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,870 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [configuration_pk]
01:32:10,911 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.CONFIG_VALUE
01:32:10,911 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [config_value, id, config_type]
01:32:10,912 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [config_value_config_type_fk]
01:32:10,913 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [config_value_pk]
01:32:10,956 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.FEATURE
01:32:10,956 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [feature, id]
01:32:10,957 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:10,957 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [feature_pk]
01:32:11,003 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.SERVER
01:32:11,003 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [server, id, server_version]
01:32:11,004 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [server_adapter_fk]
01:32:11,004 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [server_pk]
01:32:11,049 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.SERVICE_ORCHESTRATION
01:32:11,049 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [orchestration_value, orchestration_name, id]
01:32:11,050 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:11,051 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [service_orchestration_pk]
01:32:11,092 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.TEMPLATE
01:32:11,092 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [feature_id, template, id, language_id]
01:32:11,093 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: [template_language_fk, template_feature_fk]
01:32:11,094 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [template_pk]
01:32:11,201 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000261: Table found: BIPUSER.LANGUAGE
01:32:11,201 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000037: Columns: [language, id]
01:32:11,202 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000108: Foreign keys: []
01:32:11,203 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.TableMetadata - HHH000126: Indexes: [language_pk]
01:32:11,216 [http-nio-8080-exec-2] INFO org.hibernate.tool.hbm2ddl.SchemaUpdate - HHH000232: Schema update complete
hadfaj3
Hibernate:
update
ADAPTER_VERSION av
SET
av.DESCRIPTION=?
WHERE
av.ADAPTER_ID=?
AND av.VERSION=?
Can you please change it to the below and try:
#Modifying(clearAutomatically=true)
#Query(value ="update ADAPTER_VERSION av SET av.DESCRIPTION=:description WHERE av.ADAPTER_ID=:adapterId AND av.VERSION=:version",nativeQuery=true )
void updateSelectedAdapterDetails(#Param("description") String description,#Param("adapterId") int adapterId, #Param("version") String serverVersion );
Move the transactional to the service/component making a call to the update function.

web app startup warning:No MyBatis mapper was found in ... ,Please check your configuration

My configuration is:
spring-4.2.3
mybatis-3.3.0
mybatis-spring-1.2.3
mapper looks like:
package com.vsi.idp.map.server.mapper;
//imports...
public interface SeniorMapper extends BaseMapper<Long, Senior>
{
#Results({...})
#Select(...)
public List<Senior> query(...);
}
ServiceImpl looks like:
package com.vsi.idp.map.server;
//imports...
#Service("querySenior")
public class SeniorQueryServiceImpl extends RemoteServiceServlet implements SeniorQueryService
{
#Autowired
SeniorMapper mapper;
#Override
public List<Senior> query(Address address, String careType){...}
}
applicationContext.xml looks like:
<beans ... default-lazy-init="true">
<!-- MyBatis Mapper Interfaces -->
<mybatis:scan base-package="com.vsi.idp.map.server.mapper" />
//other configurations
</beans>
Spock unit test looks like below,and runs as expected
#ContextConfiguration(locations = "file:war/WEB-INF/applicationContext.xml")
public class SeniorQueryServiceImplTest extends Specification{
#Autowired
SeniorQueryServiceImpl service
def "query by full address"(){
//blabla
}
}
But when start web application,I got this warning:
WARNING: No MyBatis mapper was found in '[com.vsi.idp.map.server.mapper]' package. Please check your configuration.
So,how to solve this problem?
UPDATEit is a gwt web application,full error stack is:
INFO: Root WebApplicationContext: initialization started Nov 23, 2015 7:12:29 PM org.springframework.web.context.support.XmlWebApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Mon Nov 23 19:12:29 CST 2015]; root of context hierarchy Nov 23, 2015 7:12:29 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml] Nov 23, 2015 7:12:29 PM org.mybatis.spring.mapper.ClassPathMapperScanner doScan
WARNING: No MyBatis mapper was found in '[com.vsi.idp.map.server.mapper]' package. Please check your configuration.Nov 23, 2015 7:12:30 PM org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init>
INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
Module setup completed in 1698 ms
Nov 23, 2015 7:12:30 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 1557 ms
#MapperScan(basePackages = "com.vsi.idp.map.server.mapper")
you can try add it!
Have you defined MapperScannerConfigurer in applicationContext.xml? If so, please delete it.
I have the following config in my applicationContext.xml, and when I deleted it, the warning has gone.
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.james.reg.mapper" />
<property name="sqlSessionFactory" ref="sqlSessionFactory" />
</bean>

Eclipse console maven output not showing after app is ran

Usually when you run a maven build in eclipse, it will show the results of each phase in the console in eclipse, and end with a big FAILURE or SUCCESS output.
But when I run an application in one of the build phases as part of my maven build, I see the maven output up until the application is running and then I see the application is starting up but no maven output after that.
Is it in a different console?
I want to start an application, and then in my integration-testphase, run the integration tests that use the running app.
here is the output I am seeing:
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building UserRegistrationServices 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # rest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # rest ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\pmandayam\git\UserRegistrationServices\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # rest ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.17:test (default-test) # rest ---
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (my-execution) # rest ---
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.2.5.RELEASE)
Aug 04, 2015 3:45:38 PM org.springframework.boot.StartupInfoLogger logStarting
INFO: Starting Application on CNU43390VX with PID 21300 (C:\Users\pmandayam\git\UserRegistrationServices\target\classes started by pmandayam in C:\Users\pmandayam\git\UserRegistrationServices)
Aug 04, 2015 3:45:38 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e500635: startup date [Tue Aug 04 15:45:38 EDT 2015]; root of context hierarchy
Aug 04, 2015 3:45:39 PM org.springframework.beans.factory.support.DefaultListableBeanFactory registerBeanDefinition
INFO: Overriding bean definition for bean 'beanNameViewResolver': replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [class org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$f7e4d7] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'objectPostProcessor' of type [class org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler#6539808b' of type [class org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration' of type [class org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration$$EnhancerBySpringCGLIB$$b3d61949] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'methodSecurityMetadataSource' of type [class org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.context.support.PostProcessorRegistrationDelegate$BeanPostProcessorChecker postProcessAfterInitialization
INFO: Bean 'metaDataSourceAdvisor' of type [class org.springframework.security.access.intercept.aopalliance.MethodSecurityMetadataSourceAdvisor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
Aug 04, 2015 3:45:40 PM org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer initialize
INFO: Tomcat initialized with port(s): 8080 (http)
Aug 04, 2015 3:45:41 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Aug 04, 2015 3:45:41 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.23
Aug 04, 2015 3:45:41 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
Aug 04, 2015 3:45:41 PM org.springframework.boot.context.embedded.EmbeddedWebApplicationContext prepareEmbeddedWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 2808 ms
Aug 04, 2015 3:45:43 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher#1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#2bfb02e5, org.springframework.security.web.context.SecurityContextPersistenceFilter#b88096f, org.springframework.security.web.header.HeaderWriterFilter#213e002f, org.springframework.security.web.authentication.logout.LogoutFilter#67a54cef, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#4e56549f, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#750fdc80, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#7d01d0d, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#533cd22b, org.springframework.security.web.session.SessionManagementFilter#6d1025ca, org.springframework.security.web.access.ExceptionTranslationFilter#684e40c9, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#3140fe28]
Aug 04, 2015 3:45:43 PM org.springframework.boot.context.embedded.ServletRegistrationBean onStartup
INFO: Mapping servlet: 'dispatcherServlet' to [/]
Aug 04, 2015 3:45:43 PM org.springframework.boot.context.embedded.FilterRegistrationBean configure
INFO: Mapping filter: 'characterEncodingFilter' to: [/*]
Aug 04, 2015 3:45:43 PM org.springframework.boot.context.embedded.FilterRegistrationBean configure
INFO: Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
Aug 04, 2015 3:45:43 PM org.springframework.boot.context.embedded.FilterRegistrationBean configure
INFO: Mapping filter: 'springSecurityFilterChain' to: [/*]
Aug 04, 2015 3:45:43 PM org.springframework.boot.autoconfigure.security.AuthenticationManagerConfiguration$DefaultInMemoryUserDetailsManagerConfigurer configure
INFO:
Using default security password: bf87906c-265c-4f62-baae-cdc80c66fc46
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter initControllerAdviceCache
INFO: Looking for #ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext#2e500635: startup date [Tue Aug 04 15:45:38 EDT 2015]; root of context hierarchy
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/register],methods=[POST]}" onto public main.User main.UserRestController.register(main.User)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/update],methods=[PUT]}" onto public main.User main.UserRestController.update(java.lang.String,main.User)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByAddress],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByAddress(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/getBasicUser],methods=[GET]}" onto public main.User main.UserRestController.getBasicUser(java.lang.String,java.lang.String) throws java.io.IOException
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/AllUsers],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getAllUsers()
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByFullName],methods=[GET]}" onto public main.ReturnedUser main.UserRestController.getByFullName(java.lang.String,java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByUsername],methods=[GET]}" onto public main.ReturnedUser main.UserRestController.getByUsername(java.lang.String,java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByEmail],methods=[GET]}" onto public main.ReturnedUser main.UserRestController.getByEmail(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByPhoneNumber],methods=[GET]}" onto public main.ReturnedUser main.UserRestController.getByPhoneNumber(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByFirstname],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByFirstname(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByLastname],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByLastname(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByZipCode],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByZipCode(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByCity],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByCity(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/get/ByState],methods=[GET]}" onto public java.util.List<main.ReturnedUser> main.UserRestController.getByState(java.lang.String)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/login],methods=[POST]}" onto public main.RoleInfo main.UserRestController.login(main.Credentials)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/users/delete],methods=[DELETE]}" onto public void main.UserRestController.deleteUser(java.util.List<java.lang.String>)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractHandlerMethodMapping registerHandlerMethod
INFO: Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest)
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
Aug 04, 2015 3:45:43 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
Aug 04, 2015 3:45:44 PM org.springframework.web.servlet.handler.AbstractUrlHandlerMapping registerHandler
INFO: Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
Aug 04, 2015 3:45:44 PM org.springframework.jmx.export.MBeanExporter afterSingletonsInstantiated
INFO: Registering beans for JMX exposure on startup
Aug 04, 2015 3:45:44 PM org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer start
INFO: Tomcat started on port(s): 8080 (http)
Aug 04, 2015 3:45:44 PM org.springframework.boot.StartupInfoLogger logStarted
INFO: Started Application in 6.041 seconds (JVM running for 11.541)
EDIT: As per Nicoll's comment below, my maven build cannot find the start or stop goals and it is giving me an error that says it can't find it.
spring-boot:run is actually holding the build thread while the app is running. If we didn't do that, the process would just die once your application has started.
If you want to configure your build for a typical integration test scenario, we've added that as of Spring 1.3, check the updated documentation for more details (see Working with integration tests)

Issues with Oracle JDBC with Hibernate... Sometimes

I'm having a bit of a unique issue.
I'm able to successfully connect and manage entities when running JUnit tests, but once I start my actual application, I get "Specified JDBC Driver oracle.jdbc.OracleDriver class not found."
What confuses me is that it is there. It works when running my JUnit Tests.
Any insights are appreciated!
hibernate.cfg.xml
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory name="db">
<property name="hibernate.connection.driver_class">oracle.jdbc.OracleDriver</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:#host:port/db</property>
<property name="hibernate.connection.username">username</property>
<property name="hibernate.connection.password">password</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.default_schema">db</property>
<property name="show_sql">true</property>
<mapping resource="org/entity/RunResultEntity.hbm.xml"/>
<mapping resource="org/entity/TransactionResultEntity.hbm.xml"/>
<mapping resource="org/entity/FailureResultEntity.hbm.xml"/>
</session-factory>
</hibernate-configuration>
HibernateUtil.java
package org.util;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.*;
public class HibernateUtil {
private static SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory() {
try {
// Create the SessionFactory from hibernate.cfg.xml
Configuration configuration = new Configuration();
configuration.configure();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(
configuration.getProperties()
).buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
return sessionFactory;
} catch (Throwable ex) {
// Exception thrown here!
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
public static void shutdown() {
// Close caches and connection pools
getSessionFactory().close();
}
}
pom.xml (dependency added to local repository)
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3.0</version>
<scope>provided</scope>
</dependency>
log
Oct 09, 2014 3:02:58 PM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Oct 09, 2014 3:02:58 PM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.0.1.Final}
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Configuration configure
INFO: HHH000043: Configuring from resource: /hibernate.cfg.xml
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Configuration getConfigurationInputStream
INFO: HHH000040: Configuration resource: /hibernate.cfg.xml
Oct 09, 2014 3:02:58 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/entity/RunResultEntity.hbm.xml
Oct 09, 2014 3:02:59 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/entity/TransactionResultEntity.hbm.xml
Oct 09, 2014 3:02:59 PM org.hibernate.cfg.Configuration addResource
INFO: HHH000221: Reading mappings from resource: org/entity/FailureResultEntity.hbm.xml
Oct 09, 2014 3:02:59 PM org.hibernate.cfg.Configuration doConfigure
INFO: HHH000041: Configured SessionFactory: db
Oct 09, 2014 3:02:59 PM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure
INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)
Initial SessionFactory creation failed.org.hibernate.HibernateException: Specified JDBC Driver oracle.jdbc.OracleDriver class not found
Exception in thread "main" java.lang.ExceptionInInitializerError
I found my problem. Lower in my pom.xml I had this little snippet
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.1.Final</version>
<classifier>tests</classifier>
</dependency>
The classifier was only giving access to my test suite. Removing the classifier fixed the issue.
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.1.Final</version>
</dependency>

How to configure Hazelcast for session caching using spring while limiting it to a set of nodes?

I need to set up Hazelcast session caching using Spring. Using the configuration from the hazelcast docs is simple. However, its insufficient. I need to use a different configuration file for each one of my environments (DEV, QA, PROD). Alternatively (Ideally), I would like to use several properties from a spring bean that would be set during the initialization of the spring container. According to the hazelcast documentation, all I need to do set a group for each of my environments. like so:
<hazelcast>
<group>
<name>dev</name>
<password>dev-pass</password>
</group>
...
</hazelcast>
As a bonus, I would like the cache to be a single cache used for both sessions and application level objects (Maps, Queues, etc).
Could anyone share an example on how they would do this? Thank you for your help.
Thank you for the suggested answer. However, I think I've solved this using the following configuration. I would appreciate any feedback from anyone about this configuration.
My approach:
1) Establish the instance with a spring configuration.
2) Enhance the instance with a minimally configured hazelcast.xml file with the Web filter configuration. Note that mulitcast and tcp-ip joiners are false.
web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<!-- The definition of the Root Spring Container shared by all Servlets and Filters -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/spring/servlet-context.xml,
/WEB-INF/spring/root-context.xml,
....
/WEB-INF/spring/hazelcastContext.xml
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
....
<filter>
<filter-name>hazelcast-filter</filter-name>
<filter-class>com.hazelcast.web.WebFilter</filter-class>
<!--
Name of the distributed map storing
your web session objects
-->
<init-param>
<param-name>map-name</param-name>
<param-value>my-sessions</param-value>
</init-param>
<!--
How is your load-balancer configured?
stick-session means all requests of a session
is routed to the node where the session is first created.
This is excellent for performance.
If sticky-session is set to false, when a session is updated
on a node, entry for this session on all other nodes is invalidated.
You have to know how your load-balancer is configured before
setting this parameter. Default is true.
-->
<init-param>
<param-name>sticky-session</param-name>
<param-value>true</param-value>
</init-param>
<!--
Name of session id cookie
-->
<init-param>
<param-name>cookie-name</param-name>
<param-value>hazelcast.sessionId</param-value>
</init-param>
<!--
Domain of session id cookie. Default is based on incoming request.
-->
<init-param>
<param-name>cookie-domain</param-name>
<param-value>.mycompany.com</param-value>
</init-param>
<!--
Should cookie only be sent using a secure protocol? Default is false.
-->
<init-param>
<param-name>cookie-secure</param-name>
<param-value>false</param-value>
</init-param>
<!--
Should HttpOnly attribute be set on cookie ? Default is false.
-->
<init-param>
<param-name>cookie-http-only</param-name>
<param-value>false</param-value>
</init-param>
<!--
Are you debugging? Default is false.
-->
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
<!--
Configuration xml location;
* as servlet resource OR
* as classpath resource OR
* as URL
Default is one of hazelcast-default.xml
or hazelcast.xml in classpath.
-->
<init-param>
<param-name>config-location</param-name>
<param-value>/WEB-INF/classes/hazelcast.xml</param-value>
</init-param>
<!--
Do you want to use an existing HazelcastInstance?
Default is null.
-->`enter code here`
<init-param>
<param-name>instance-name</param-name>
<param-value>myapp</param-value>
</init-param>
<!--
Do you want to connect as a client to an existing cluster?
Default is false.
-->
<init-param>
<param-name>use-client</param-name>
<param-value>false</param-value>
</init-param>
<!--
Client configuration location;
* as servlet resource OR
* as classpath resource OR
* as URL
Default is null.
-->
<init-param>
<param-name>client-config-location</param-name>
<param-value>/WEB-INF/classes/hazelcast-client.properties</param-value>
</init-param>
<!--
Do you want to shutdown HazelcastInstance during
web application undeploy process?
Default is true.
-->
<init-param>
<param-name>shutdown-on-destroy</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>hazelcast-filter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>FORWARD</dispatcher>
<dispatcher>INCLUDE</dispatcher>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
...
</web-app>
hazelcast.xml (copied from hazelcast.xml inside jar file)...
<hazelcast xsi:schemaLocation="http://www.hazelcast.com/schema/config hazelcast-config-2.4.xsd"
xmlns="http://www.hazelcast.com/schema/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
<network>
<port auto-increment="true">5701</port>
<outbound-ports>
<!--
Allowed port range when connecting to other nodes.
0 or * means use system provided port.
-->
<ports>0</ports>
</outbound-ports>
<join>
<multicast enabled="false">
<multicast-group>224.2.2.3</multicast-group>
<multicast-port>54327</multicast-port>
</multicast>
<tcp-ip enabled="false">
<interface>127.0.0.1</interface>
</tcp-ip>
...
</join>
...
</network>
...
</hazelcast>
Spring config....
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:hz="http://www.hazelcast.com/schema/spring"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.hazelcast.com/schema/spring
http://www.hazelcast.com/schema/spring/hazelcast-spring-2.4.xsd">
<bean id="hazelcast" class="com.hazelcast.core.Hazelcast" />
<!-- Hazelcast Instance configuration -->
<hz:hazelcast id="myapp">
<hz:config>
<!-- Hazelcast Instance Name -->
<hz:instance-name>${hz.instance.name}</hz:instance-name>
<!-- Hazelcast Group Name and Password -->
<hz:group name="${hz.group.name}" password="${hz.group.password}" />
<!-- Hazelcast Management Center URL -->
<hz:management-center enabled="${hz.management.center.enabled}" url="${hz.management.center.url}" />
<!-- Hazelcast Tcp based network configuration -->
<hz:network port="${hz.network.port}" port-auto-increment="${hz.network.port.auto.increment}">
<hz:join>
<hz:multicast enabled="${hz.multicast.enabled}" multicast-group="224.2.2.3" multicast-port="54327" />
<hz:tcp-ip enabled="${hz.tcp.ip.enabled}">
<hz:members>${hz.members}</hz:members>
</hz:tcp-ip>
</hz:join>
</hz:network>
<!-- Hazelcast Distributed Map configuration -->
<hz:map name="map" backup-count="${hz.map.backup.count}" max-size="${hz.map.max.size}" eviction-percentage="${hz.map.eviction.percentage}"
read-backup-data="${hz.map.read.backup.data}" eviction-policy="${hz.map.eviction.policy}" merge-policy="${hz.map.merge.policy}" />
</hz:config>
</hz:hazelcast>
Property file....
#-- Hazelcast properties.
hz.instance.name = myapp
hz.group.name = CERT
hz.group.password = cert
hz.management.center.enabled = true
hz.management.center.url = http://127.0.0.1:8080/mancenter
hz.network.port = 5701
hz.network.port.auto.increment = true
hz.multicast.enabled = true
hz.tcp.ip.enabled = false
hz.members = 127.0.0.1
hz.executor.service.core.pool.size = 2
hz.executor.service.max.pool.size = 30
hz.executor.service.keep.alive.seconds = 30
hz.map.backup.count=2
hz.map.max.size=0
hz.map.eviction.percentage=30
hz.map.read.backup.data=true
hz.map.cache.value=true
hz.map.eviction.policy=NONE
hz.map.merge.policy=hz.ADD_NEW_ENTRY
Root Context.xml
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:hz="http://www.hazelcast.com/schema/spring"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.hazelcast.com/schema/spring
http://www.hazelcast.com/schema/spring/hazelcast-spring-2.4.xsd">
...
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<jee:jndi-lookup jndi-name="java:comp/env/config_file" />
</list>
</property>
</bean>
...
</beans>
Tomcat Config...
<Host appBase="webapps" autoDeploy="true" name="localhost" unpackWARs="true">
...
<Context docBase="myapp" path="/myapp" reloadable="true" source="org.eclipse.jst.j2ee.server:pwc-ws">
<Environment description="" name="config_file" override="false" type="java.lang.String" value="file:c:/path/to/config/myapp.properties" />
</Context>
...
</Host>
Tomcat output (Note: This is a restart scenario of a two node hazelcast group. In this scenario, Node 1 is restarted. The output of Node 2 shows the drop of node 1 from the group and then its return to the group).
Node 1 of Group CERT
Nov 19, 2013 4:27:56 PM com.hazelcast.impl.AddressPicker
INFO: Prefer IPv4 stack is true.
Nov 19, 2013 4:27:56 PM com.hazelcast.impl.AddressPicker
INFO: Picked Address[10.23.43.13]:5701, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=5701], bind any local is true
Nov 19, 2013 4:27:57 PM com.hazelcast.system
INFO: [10.23.43.13]:5701 [CERT] Hazelcast Community Edition 2.4 (20121017) starting at Address[10.23.43.13]:5701
Nov 19, 2013 4:27:57 PM com.hazelcast.system
INFO: [10.23.43.13]:5701 [CERT] Copyright (C) 2008-2012 Hazelcast.com
Nov 19, 2013 4:27:57 PM com.hazelcast.impl.LifecycleServiceImpl
INFO: [10.23.43.13]:5701 [CERT] Address[10.23.43.13]:5701 is STARTING
Nov 19, 2013 4:27:57 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:27:57 PM com.hazelcast.impl.MulticastJoiner
INFO: [10.23.43.13]:5701 [CERT] Connecting to master node: Address[10.23.43.14]:5701
Nov 19, 2013 4:27:57 PM com.hazelcast.nio.ConnectionManager
INFO: [10.23.43.13]:5701 [CERT] 54106 accepted socket connection from /10.23.43.14:5701
Nov 19, 2013 4:27:57 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:27:57 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:27:58 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:27:58 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:27:59 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:27:59 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:28:00 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:28:00 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:28:01 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:28:01 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:28:02 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:28:02 PM com.hazelcast.impl.Node
INFO: [10.23.43.13]:5701 [CERT] ** setting master address to Address[10.23.43.14]:5701
Nov 19, 2013 4:28:02 PM com.hazelcast.cluster.ClusterManager
INFO: [10.23.43.13]:5701 [CERT]
Members [2] {
Member [10.23.43.14]:5701
Member [10.23.43.13]:5701 this
}
Nov 19, 2013 4:28:04 PM com.hazelcast.impl.LifecycleServiceImpl
INFO: [10.23.43.13]:5701 [CERT] Address[10.23.43.13]:5701 is STARTED
Nov 19, 2013 4:28:04 PM com.hazelcast.impl.management.ManagementCenterService
INFO: [10.23.43.13]:5701 [CERT] Hazelcast will connect to Management Center on address: http://localhost:8080/mancenter/
Nov 19, 2013 4:28:04 PM com.hazelcast.config.UrlXmlConfig
INFO: Configuring Hazelcast from 'jndi:/localhost/pwc-ui/WEB-INF/classes/hazelcast.xml'.
Nov 19, 2013 4:28:04 PM com.hazelcast.web.WebFilter
INFO: sticky:true, debug: true, shutdown-on-destroy: true, map-name: my-sessions
Nov 19, 2013 4:28:05 PM org.apache.catalina.startup.HostConfig deployDescriptor
Node 2 of Group CERT (note the drop and re-add)
Nov 19, 2013 4:27:11 PM com.hazelcast.nio.Connection
INFO: [10.23.43.14]:5701 [CERT] Connection [Address[10.23.43.13]:5701] lost. Reason: java.io.IOException[Connection reset by peer]
Nov 19, 2013 4:27:11 PM com.hazelcast.nio.ReadHandler
WARNING: [10.23.43.14]:5701 [CERT] hz.pwc.IO.thread-1 Closing socket to endpoint Address[10.23.43.13]:5701, Cause:java.io.IOException: Connection reset by peer
Nov 19, 2013 4:27:12 PM com.hazelcast.nio.SocketConnector
INFO: [10.23.43.14]:5701 [CERT] Could not connect to: /10.23.43.13:5701. Reason: ConnectException[Connection refused]
Nov 19, 2013 4:27:13 PM com.hazelcast.nio.SocketConnector
INFO: [10.23.43.14]:5701 [CERT] Could not connect to: /10.23.43.13:5701. Reason: ConnectException[Connection refused]
Nov 19, 2013 4:27:14 PM com.hazelcast.nio.SocketConnector
INFO: [10.23.43.14]:5701 [CERT] Could not connect to: /10.23.43.13:5701. Reason: ConnectException[Connection refused]
Nov 19, 2013 4:27:14 PM com.hazelcast.nio.ConnectionMonitor
WARNING: [10.23.43.14]:5701 [CERT] Removing connection to endpoint Address[10.23.43.13]:5701 Cause => java.net.ConnectException {Connection refused}, Error-Count: 5
Nov 19, 2013 4:27:14 PM com.hazelcast.cluster.ClusterManager
INFO: [10.23.43.14]:5701 [CERT] Removing Address Address[10.23.43.13]:5701
Nov 19, 2013 4:27:14 PM com.hazelcast.impl.PartitionManager
INFO: [10.23.43.14]:5701 [CERT] Starting to send partition replica diffs...true
Nov 19, 2013 4:27:14 PM com.hazelcast.cluster.ClusterManager
INFO: [10.23.43.14]:5701 [CERT]
Members [1] {
Member [10.23.43.14]:5701 this
}
Nov 19, 2013 4:27:18 PM com.hazelcast.impl.PartitionManager
INFO: [10.23.43.14]:5701 [CERT] Total 0 partition replica diffs have been processed.
Nov 19, 2013 4:27:18 PM com.hazelcast.impl.PartitionManager
INFO: [10.23.43.14]:5701 [CERT] Re-partitioning cluster data... Immediate-Tasks: 0, Scheduled-Tasks: 0
Nov 19, 2013 4:27:57 PM com.hazelcast.nio.SocketAcceptor
INFO: [10.23.43.14]:5701 [CERT] 5701 is accepting socket connection from /10.23.43.13:54106
Nov 19, 2013 4:27:57 PM com.hazelcast.nio.ConnectionManager
INFO: [10.23.43.14]:5701 [CERT] 5701 accepted socket connection from /10.23.43.13:54106
Nov 19, 2013 4:27:57 PM com.hazelcast.web.WebFilter
INFO: Created new session with id: HZ650FDF62693F45A99AC0C30BBD8840B0
Nov 19, 2013 4:27:57 PM com.hazelcast.web.WebFilter
INFO: 195 is sessions.size and originalSessions.size: 195
Nov 19, 2013 4:27:57 PM com.hazelcast.web.WebFilter
INFO: PUTTING SESSION HZ650FDF62693F45A99AC0C30BBD8840B0
Nov 19, 2013 4:28:02 PM com.hazelcast.cluster.ClusterManager
INFO: [10.23.43.14]:5701 [CERT]
Members [2] {
Member [10.23.43.14]:5701 this
Member [10.23.43.13]:5701
}
Nov 19, 2013 4:28:02 PM com.hazelcast.impl.PartitionManager
INFO: [10.23.43.14]:5701 [CERT] Re-partitioning cluster data... Immediate-Tasks: 271, Scheduled-Tasks: 0
Nov 19, 2013 4:28:24 PM com.hazelcast.web.WebFilter
INFO: Created new session with id: HZAD50E5F483CC448C9FA7CB66D65848BB
Nov 19, 2013 4:28:24 PM com.hazelcast.web.WebFilter
INFO: 196 is sessions.size and originalSessions.size: 196
Nov 19, 2013 4:28:24 PM com.hazelcast.web.WebFilter
INFO: PUTTING SESSION HZAD50E5F483CC448C9FA7CB66D65848BB
Nov 19, 2013 4:28:24 PM com.hazelcast.web.WebFilter
INFO: Request is instance of RequestWrapper! Continue...
Nov 19, 2013 4:28:24 PM com.hazelcast.web.WebFilter
INFO: Request is instance of RequestWrapper! Continue...
Nov 19, 2013 4:28:24 PM com.hazelcast.web.WebFilter
INFO: Request is instance of RequestWrapper! Continue...
Nov 19, 2013 4:28:24 PM com.hazelcast.web.WebFilter
INFO: Request is instance of RequestWrapper! Continue...
Nov 19, 2013 4:28:50 PM com.hazelcast.web.WebFilter
INFO: Created new session with id: HZC9553A4C330044CA8A0C20549EE23BF0
Nov 19, 2013 4:28:50 PM com.hazelcast.web.WebFilter
INFO: 197 is sessions.size and originalSessions.size: 197
Nov 19, 2013 4:28:50 PM com.hazelcast.web.WebFilter
INFO: PUTTING SESSION HZC9553A4C330044CA8A0C20549EE23BF0
Nov 19, 2013 4:28:50 PM com.hazelcast.web.WebFilter
INFO: Request is instance of RequestWrapper! Continue...
Nov 19, 2013 4:28:50 PM com.hazelcast.web.WebFilter
INFO: Request is instance of RequestWrapper! Continue...
Nov 19, 2013 4:28:50 PM com.hazelcast.web.WebFilter
INFO: Request is instance of RequestWrapper! Continue...
Nov 19, 2013 4:28:50 PM com.hazelcast.web.WebFilter
INFO: Request is instance of RequestWrapper! Continue...
10069.275: [GC [PSYoungGen: 693173K->3458K(695488K)] 877908K->188718K(2093632K), 0.0224650 secs] [Times: user=0.04 sys=0.00, real=0.02 secs]
Nov 19, 2013 4:29:18 PM com.hazelcast.web.WebFilter
INFO: Created new session with id: HZE46365454C2C45F98A7947AC40E404BB
Nov 19, 2013 4:29:18 PM com.hazelcast.web.WebFilter
INFO: 198 is sessions.size and originalSessions.size: 198
Nov 19, 2013 4:29:18 PM com.hazelcast.web.WebFilter
INFO: PUTTING SESSION HZE46365454C2C45F98A7947AC40E404BB
The following only works with Hazelcast 3.2-SNAPSHOT.
Lets start with the single HazelcastInstance that is shared between session replication and the application. You can do it like this:
public class HazelcastInstanceLoader {
private final static ILogger logger = Logger.getLogger(HazelcastInstanceLoader.class);
public static HazelcastInstance load(String instanceName) throws Exception {
String configName = System.getProperty("hazelcast.config");
if (configName == null) {
configName = "hazelcast.xml";
}
Config config;
if (configName.startsWith("file:")) {
String filename = configName.substring("file:".length());
logger.info("Using hazelcast configuration file: " + filename);
config = new FileSystemXmlConfig(filename);
} else {
logger.info("Using hazelcast classpath resource: " + configName);
config = new ClasspathXmlConfig(configName);
}
config.setInstanceName(instanceName);
return Hazelcast.getOrCreateHazelcastInstance(config);
}
}
And now the Spring configuration:
<bean id="hazelcastInstance"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="com.hazelcast.webmonitor.HazelcastInstanceLoader.load"/>
<property name="arguments">
<list>
<value>default</value>
</list>
</property>
</bean>
So when this is loaded, we have a named HazelcastInstance 'default'.
When I configure the session replication like this:
<filter>
<filter-name>hazelcast-filter</filter-name>
<filter-class>com.hazelcast.web.WebFilter</filter-class>
<init-param>
<param-name>instance-name</param-name>
<param-value>default</param-value>
</init-param>
</filter>
Then the session filter will try to load the hazelcastinstance with that name. Since the 'default' HazelcastInstance already is created because the Spring applicationcontext is loaded, the session filter will use that instance and not create a new one.
If you need to have fully seperate configuration files, just specify a file using the 'hazelcast.conf' system property (see the code of the HazelcastInstanceLoader). Instead of relying on a system property, you could also modify the HazelcastInstanceLoader.load method to accept a 'path' property, which you can inject from Spring.
Setting different groups for different environments is a useful way to make sure that machines in these environments, don't form a group. But if you want to share configuration, and only on the details there are differences (e.g. groupnames), then you can also make use of variables in the xml:
<hazelcast>
<group>
<name>${groupname}</name>
<password>${password}</password>
</group>
...
</hazelcast>
Does this answer your question?
Why dont you jat put in src/main/resources a file per environement.
So that you have: dev.properties,qa.properties,prod.properties
use an environement variable such as ENV. which in my situation i have put ENV=dev
and then inside my spring-servlet.xml i have:
<property name="locations">
<list>
<value>classpath:/${SERVER_ENV}.hazelcast.properties</value>
</list>
</property>
and then in the same file i use properties this way:
<hz:hazelcast id="myapp">
<hz:config>
<!-- Hazelcast Instance Name -->
<hz:instance-name>${hz.instance.name}</hz:instance-name>
<!-- Hazelcast Group Name and Password -->
<hz:group name="${hz.group.name}" password="${hz.group.password}" />
<!-- Hazelcast Management Center URL -->
<hz:management-center enabled="${hz.management.center.enabled}" url="${hz.management.center.url}"
/>
<!-- Hazelcast Tcp based network configuration -->
<hz:network port="${hz.network.port}" port-auto-increment="${hz.network.port.auto.increment}">
<hz:join>
<hz:multicast enabled="${hz.multicast.enabled}" multicast-group="224.2.2.3" multicast-port="54327"
/>
<hz:tcp-ip enabled="${hz.tcp.ip.enabled}">
<hz:members>${hz.members}</hz:members>
</hz:tcp-ip>
</hz:join>
</hz:network>
<!-- Hazelcast Distributed Map configuration -->
<hz:map name="map" backup-count="${hz.map.backup.count}" max-size="${hz.map.max.size}"
eviction-percentage="${hz.map.eviction.percentage}" read-backup-data="${hz.map.read.backup.data}"
eviction-policy="${hz.map.eviction.policy}" merge-policy="${hz.map.merge.policy}"
/>
</hz:config>
</hz:hazelcast>

Resources