Question title may be same, but I tried to solve this error by looking at previous answers, but nothing happen. I'm getting following error while insert data into the database. Tables are created, but there is an error while inserting data into the database.
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'InitDbService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.app.flight.repo.RoleRepository com.app.flight.service.InitDbService.roleRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'roleRepository': Cannot create inner bean '(inner bean)#397030fe' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#397030fe': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'entityManagerFactory' is defined
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
This is my Role.java entity class
#Entity
public class Role {
#Id
#GeneratedValue
private Integer id;
private String name;
(getters and setters)
This is RoleRepository.java interface
package com.app.flight.repo;
import org.springframework.data.jpa.repository.JpaRepository;
import com.app.flight.entity.Role;
public interface RoleRepository extends JpaRepository<Role, Integer> {
}
This is service class InitDbService.java
package com.app.flight.service;
import javax.annotation.PostConstruct;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.app.flight.entity.Role;
import com.app.flight.repo.RoleRepository;
#Transactional
#Service
public class InitDbService {
#Autowired
private RoleRepository roleRepository;
#PostConstruct
public void init(){
Role roleUser = new Role();
roleUser.setName("ROLE_USER");
roleRepository.save(roleUser);
Role roleAdmin= new Role();
roleAdmin.setName("ROLE_ADMIN");
roleRepository.save(roleAdmin);
}
}
This is applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:repository="http://www.springframework.org/schema/data/repository"
xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.1.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.8.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository-1.7.xsd">
<context:component-scan base-package="com.app.flight">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<jdbc:embedded-database type="HSQL" id="dataSource"/>
<bean class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" id="emf">
<property name="packagesToScan" value="com.app.flight.entity"/>
<property name="dataSource" ref="dataSource"/>
<property name="jpaProperties">
<props>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">create</prop>
</props>
</property>
<property name="persistenceProvider">
<bean class="org.hibernate.jpa.HibernatePersistenceProvider"/>
</property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<bean class="org.springframework.orm.jpa.JpaTransactionManager" id="transactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<jpa:repositories base-package="com.app.flight.repo"/>
</beans>
It expects that the EntityManagerFactory has a specific name in that case "entityManagerFactory". You defined a custom name "emf". I assume the problem is resolved if you adapt the entry in the xml file.
Related
I'm getting this exception and I can't figure out why. CheckoutItem and the interface CheckoutItemDAO are in a separate jar and are simple javabeans without any annotations. CheckoutItemDAOHibernate implements CheckoutItemDAO
16:26:31,135 ERROR [ContextLoader:227] Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'checkoutService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.newscom.dao.CheckoutItemDAO com.liferay.webform.business.CheckoutService.checkoutItemDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'checkoutItemDAO' defined in ServletContext resource [/WEB-INF/context/applicationContext.xml]: Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/context/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Implementing class
CheckoutService.java
package com.liferay.webform.business;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.newscom.dao.CheckoutItemDAO;
import com.newscom.model.CheckoutItem;
#Service
#Transactional
#Controller
public class CheckoutService {
#Autowired private CheckoutItemDAO checkoutItemDAO;
public CheckoutItem getCheckoutItemById(Integer checkoutItemId) {
List<CheckoutItem> items = checkoutItemDAO.retrieveRecordByID(checkoutItemId);
if (items != null && items.size() > 0) {
return items.get(0);
}
else {
return null;
}
}
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">
<context:component-scan base-package="com.liferay.webform.business" />
<tx:annotation-driven/>
<util:properties id="applicationProperties" location="classpath:application.properties"/>
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/ncdb"></property>
</bean>
<!-- Hibernate SessionFactory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>com.newscom.model.CheckoutItem</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</prop>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">false</prop>
<prop key="hibernate.cglib.use_reflection_optimizer">false</prop>
<prop key="hibernate.bytecode.use_reflection_optimizer">false</prop>
<prop key="hibernate.connection.release_mode">auto</prop>
<prop key="hibernate.query.substitutions">true 1, false 0</prop>
</props>
</property>
</bean>
<bean id="daoTemplate" abstract="true">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean parent="daoTemplate" id="checkoutItemDAO" class="com.newscom.dao.hibernate.CheckoutItemDAOHibernate" />
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
I'm trying to inject a DAO using #Autowire. Setting the log level to debug, I can see that the bean was created and wired to the service class, but, when I try to use the injected object, a nullpointerexecption is thrown.
English is not my primary language, but looking into the log bellow, it seems that the DAO was created and properly wired to the service:
DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'ticketServiceImpl'
DefaultListableBeanFactory:450 - Creating instance of bean 'ticketServiceImpl'
InjectionMetadata:72 - Registered injected element on class [br.com.xpto.sys.business.impl.TicketServiceImpl]: AutowiredFieldElement for private br.com.xpto.sys.dao.api.TicketDAO br.com.xpto.sys.business.impl.TicketServiceImpl.dao
DefaultListableBeanFactory:523 - Eagerly caching bean 'ticketServiceImpl' to allow for resolving potential circular references
InjectionMetadata:86 - Processing injected element of bean 'ticketServiceImpl': AutowiredFieldElement for private br.com.xpto.sys.dao.api.TicketDAO br.com.xpto.sys.business.impl.TicketServiceImpl.dao
DefaultListableBeanFactory:221 - Creating shared instance of singleton bean 'ticketDAOImpl'
DefaultListableBeanFactory:450 - Creating instance of bean 'ticketDAOImpl'
AnnotationTransactionAttributeSource:108 - Adding transactional method 'TicketDAOImpl.findByTicketNumber' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly; ''
InfrastructureAdvisorAutoProxyCreator:538 - Creating implicit proxy for bean 'ticketDAOImpl' with 0 common interceptors and 1 specific interceptors
JdkDynamicAopProxy:115 - Creating JDK dynamic proxy: target source is SingletonTargetSource for target object [br.com.xpto.sys.dao.impl.TicketDAOImpl#2242b3b8]
DefaultListableBeanFactory:478 - Finished creating instance of bean 'ticketDAOImpl'
AutowiredAnnotationBeanPostProcessor:480 - Autowiring by type from bean name 'ticketServiceImpl' to bean named 'ticketDAOImpl'
DefaultListableBeanFactory:478 - Finished creating instance of bean 'ticketServiceImpl'
The NPE ocurrs into the dao.findByTicketId(ticketId) call. Since dao is null, it throws the exception.
I tried to do minor changes after that I read this and this posts, but with no lucky.
Below I posted the main parts of the code. Any advice is welcome.
UPDATE
As requested, I'm also posting how do I instantiate the TicketServiceImpl class and the stack trace.
The class is instantiated inside an ItemProcessor bean (spring batch)
public class TicketItemProcessor implements ItemProcessor<Ticket, TicketLog> {
#Override
public TicketLog process(Ticket item) throws Exception {
TicketServiceImpl srv = new TicketServiceImpl();
Ticket t = srv.findByTicketId(item.getIdTicket());
return new TicketLog();
}
}
TicketServiceImpl
#Service
public class TicketServiceImpl implements TicketService {
#Autowired
private TicketDAO dao;
#Override
public Ticket findByTicketId(int ticketId) {
return dao.findByTicketId(ticketId);
}
}
TicketDAOImpl
#Repository
public class TicketDAOImpl extends implements TicketDAO {
#Override
public Ticket findByTicketId(int ticketId) {
String jpql = "SELECT t FROM Ticket t WHERE t.id = :ticketId";
Query query = getSession().createQuery(jpql);
query.setParameter("ticketId", ticketId);
query.setMaxResults(1);
Object obj = query.uniqueResult();
return (Ticket) obj;
}
}
TicketDAO
public interface TicketDAO extends DAO<Ticket> {
Ticket findByTicketId(int ticketId);
}
DAO
public interface DAO<E> extends Serializable {
List<E> listAll();
}
context.xml
<?xml version="1.0"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:batch="http://www.springframework.org/schema/batch" xmlns:util="http://www.springframework.org/schema/util" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/jdbc
http://www.springframework.org/schema/jdbc/spring-jdbc-4.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/batch
http://www.springframework.org/schema/batch/spring-batch-2.2.xsd">
<context:annotation-config />
<context:component-scan base-package="br.com.xpto.sys" />
<bean id="dbDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://server;databaseName=db" />
<property name="username" value="usr" />
<property name="password" value="pwd" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dbDataSource" />
<property name="packagesToScan" value="br.com.xpto.sys.model.entities" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">br.com.xpto.sys.dao.utils.SQLServerDialectOverrider</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.use_sql_comments">false</prop>
<prop key="hibernate.connection.release_mode">after_transaction</prop>
</props>
</property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" mode="proxy"/>
<bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />
</beans>
Stack Trace
AbstractStep:222 - Encountered an error executing step step1 in job job-ProcessTickets
java.lang.NullPointerException
at br.com.xpto.sys.business.impl.TicketServiceImpl.findByTicketId(TicketServiceImpl.java:83)
at br.com.xpto.sys.jobs.spring.TicketItemProcessor.process(TicketItemProcessor.java:24)
at br.com.xpto.sys.jobs.spring.TicketItemProcessor.process(TicketItemProcessor.java:1)
at org.springframework.batch.core.step.item.SimpleChunkProcessor.doProcess(SimpleChunkProcessor.java:126)
at org.springframework.batch.core.step.item.SimpleChunkProcessor.transform(SimpleChunkProcessor.java:293)
at org.springframework.batch.core.step.item.SimpleChunkProcessor.process(SimpleChunkProcessor.java:192)
at org.springframework.batch.core.step.item.ChunkOrientedTasklet.execute(ChunkOrientedTasklet.java:75)
at org.springframework.batch.core.step.tasklet.TaskletStep$ChunkTransactionCallback.doInTransaction(TaskletStep.java:395)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133)
at org.springframework.batch.core.step.tasklet.TaskletStep$2.doInChunkContext(TaskletStep.java:267)
at org.springframework.batch.core.scope.context.StepContextRepeatCallback.doInIteration(StepContextRepeatCallback.java:77)
at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:368)
at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:215)
at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:144)
at org.springframework.batch.core.step.tasklet.TaskletStep.doExecute(TaskletStep.java:253)
at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:195)
at org.springframework.batch.core.job.SimpleStepHandler.handleStep(SimpleStepHandler.java:141)
at org.springframework.batch.core.job.flow.JobFlowExecutor.executeStep(JobFlowExecutor.java:64)
at org.springframework.batch.core.job.flow.support.state.StepState.handle(StepState.java:60)
at org.springframework.batch.core.job.flow.support.SimpleFlow.resume(SimpleFlow.java:151)
at org.springframework.batch.core.job.flow.support.SimpleFlow.start(SimpleFlow.java:130)
at org.springframework.batch.core.job.flow.FlowJob.doExecute(FlowJob.java:135)
at org.springframework.batch.core.job.AbstractJob.execute(AbstractJob.java:301)
at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:134)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:127)
at br.com.xpto.sys.jobs.AppStandalone.run(AppStandalone.java:111)
at br.com.xpto.sys.jobs.AppStandalone.main(AppStandalone.java:75)
I have sample test program to test Spring Data JPA, but it seems like the repository doesn't get generated.
My config:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/jee
http://www.springframework.org/schema/jee/spring-jee.xsd">
<import resource="securityConfig.xml" />
<context:annotation-config />
<context:component-scan base-package="com.test">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<jee:jndi-lookup id="myDataSource" jndi-name="java:comp/env/jdbc/test"/>
<bean id="myEmf" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="myDataSource" />
<property name="packagesToScan" value="com.test.security" />
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.hbm2ddl.auto">create-drop</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="myEmf" />
</bean>
</beans>
User entity:
package com.test.security;
import org.springframework.security.core.CredentialsContainer;
import org.springframework.security.core.userdetails.UserDetails;
#Entity
#Table
public class UserPrincipal implements UserDetails, CredentialsContainer, Cloneable {
private static final long serialVersionUID = 1L;
private long id;
....
}
UserRespository:
package com.test.security;
import org.springframework.data.repository.CrudRepository;
public interface UserRepository extends CrudRepository<UserPrincipal, Long>
{
UserPrincipal getByUsername(String username);
}
UserService:
package com.test.security;
#Service
public class UserService implements UserDetailsService {
#Inject
UserRepository userRepository;
#Override
#Transactional
public UserPrincipal loadUserByUsername(String username) {
UserPrincipal principal = userRepository.getByUsername(username);
// make sure the authorities and password are loaded
principal.getAuthorities().size();
principal.getPassword();
return principal;
}
}
I get this error:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'org.springframework.security.filterChains':
Cannot resolve reference to bean
'org.springframework.security.web.DefaultSecurityFilterChain#0' while
setting bean property 'sourceList' with key [0]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.security.web.DefaultSecurityFilterChain#0':
Cannot resolve reference to bean
'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0'
while setting constructor argument with key [3]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0':
Cannot resolve reference to bean
'org.springframework.security.authentication.ProviderManager#0' while
setting bean property 'authenticationManager'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.security.authentication.ProviderManager#0':
Cannot resolve reference to bean
'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0'
while setting constructor argument; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0':
FactoryBean threw exception on object creation; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.security.authenticationManager': Cannot resolve
reference to bean
'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0'
while setting constructor argument with key [0]; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'org.springframework.security.authentication.dao.DaoAuthenticationProvider#0':
Cannot resolve reference to bean 'userService' while setting bean
property 'userDetailsService'; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'userService': Injection of autowired
dependencies failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Could not
autowire field: com.test.security.UserRepository
com.test.security.UserService.userRepository; nested exception is
org.springframework.beans.factory.NoSuchBeanDefinitionException: No
qualifying bean of type [com.test.security.UserRepository] found for
dependency: expected at least 1 bean which qualifies as autowire
candidate for this dependency. Dependency annotations:
{#javax.inject.Inject()}
No qualifying bean of type [com.test.security.UserRepository] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {#javax.inject.Inject()}
Grab the spring data jpa namespace (from spring-data-jpa jar)
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xsi:schemaLocation=
http://www.springframework.org/schema/data/jpa
http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
And use the <repositories> element of the jpa namespace to scan for repositories
<jpa:repositories base-package="com.test.security"
entity-manager-factory-ref="myEmf"
transaction-manager-ref="transactionManager"/>
See more at Creating Repository Instances
Here's a snippet stated about the <repositories> tag:
Spring is instructed to scan [com.test.security] and all its subpackages for interfaces extending Repository or one of its subinterfaces. For each interface found, the infrastructure registers the persistence technology-specific FactoryBean to create the appropriate proxies that handle invocations of the query methods
Here's the link for the namespace info
For Java config, you could achieve the same thing with the #EnableJpaRepositories annotation. You can read more about that in the same link as above
When getting Session with .getCurrentSession() getting the following error.
Error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'miniVLEController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: miniVLE.service.StudentService miniVLE.controller.miniVLEController.studentService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: miniVLE.dao.MiniVLEDAOImplementation miniVLE.service.StudentService.dao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'miniVLEDAOImplementation' defined in file [C:\Users\1\Documents\NetBeansProjects\com3014_mini_VLE\build\web\WEB-INF\classes\miniVLE\dao\MiniVLEDAOImplementation.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [miniVLE.dao.MiniVLEDAOImplementation]: Constructor threw exception; nested exception is java.lang.NullPointerException
DAO Implementation:
import java.util.ArrayList;
import java.util.List;
import miniVLE.beans.Course;
import miniVLE.beans.Department;
import miniVLE.beans.Module;
import miniVLE.beans.Student;
import miniVLE.beans.TimeSlot;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
#Repository
public class MiniVLEDAOImplementation implements MiniVLEDAO{
// Used for communicating with the database
#Autowired
private SessionFactory sessionFactory;
/**
* DAO constructor filled with dummy data
*/
public MiniVLEDAOImplementation() {
System.out.println("*** MiniVLEDAOImplementation instantiated");
Student s1 = new Student("123456","Bob","123");
Department d1 = new Department("COM","Computing");
Course c1 = new Course("COM3014","Web");
c1.setDepartment(d1);
s1.setCourse(c1);
s1.setDept(d1);
// Add new student to the database
addStudentToDB(s1);
}
/**
* Gets the current session and adds new student row into the database
* #param student
*/
#Override
public void addStudentToDB(Student student) {
sessionFactory.getCurrentSession(); // here i got rid of full implementation as it fails on getting the current session
} ...
Dispatcher-Servlet:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:aop="http://www.springframework.org/schema/aop"
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.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd">
<context:annotation-config />
<context:component-scan base-package="miniVLE.controller" />
<context:component-scan base-package="miniVLE.service" />
<context:component-scan base-package="miniVLE.beans" />
<context:component-scan base-package="miniVLE.dao" />
<!-- Declare a view resolver-->
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />
<!-- Connects to the database based on the jdbc properties information-->
<bean id="dataSource" class ="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name ="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name ="url" value="jdbc:derby://localhost:1527/minivledb"/>
<property name ="username" value="root"/>
<property name ="password" value="123" />
</bean>
<!-- Declares hibernate object -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect"> ${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
<!-- A list of all the annotated bean files, which are mapped with database tables-->
<property name="annotatedClasses">
<list>
<value> miniVLE.beans.Course </value>
<value> miniVLE.beans.Student </value>
<value> miniVLE.beans.Department </value>
<value> miniVLE.beans.Module </value>
<value> miniVLE.beans.TimeSlot </value>
</list>
</property>
</bean>
</beans>
To create your beans, Spring first uses your class' no-argument constructor to create an instance and then uses reflection to autowire #Autowired fields.
But your constructor
public MiniVLEDAOImplementation() {
...
// Add new student to the database
addStudentToDB(s1);
}
calls a method that uses the SessionFactory before it has been initialized. It is therefore null and you get a NullPointerException when trying to call a method on it.
You cannot add the student to the database from that point. If you want to test out your class, try unit testing.
I am getting the following error:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor': Cannot create inner bean '(inner bean)' while setting bean property 'transactionInterceptor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'txManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in class path resource [persistenceLayer.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [persistenceLayer.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No persistence unit with name 'CounterpartContacts' found
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'txManager' while setting bean property 'transactionManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in class path resource [persistenceLayer.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [persistenceLayer.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No persistence unit with name 'CounterpartContacts' found
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'txManager' defined in class path resource [persistenceLayer.xml]: Cannot resolve reference to bean 'entityManagerFactory' while setting bean property 'entityManagerFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [persistenceLayer.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No persistence unit with name 'CounterpartContacts' found
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [persistenceLayer.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: No persistence unit with name 'CounterpartContacts' found
Caused by: java.lang.IllegalArgumentException: No persistence unit with name 'CounterpartContacts' found
at org.springframework.orm.jpa.persistenceunit.DefaultPersistenceUnitManager.obtainPersistenceUnitInfo(DefaultPersistenceUnitManager.java:337)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.determinePersistenceUnitInfo(LocalContainerEntityManagerFactoryBean.java:219)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:185)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:237)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1062)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1029)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:246)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueResolver.java:198)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:116)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:955)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:729)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:416)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findCandidateAdvisors(AbstractAdvisorAutoProxyCreator.java:102)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:68)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:54)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:247)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:311)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1038)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:420)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:141)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:290)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:348)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:92)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:77)
at com.apollo.counterpartcontacts.service.PersistenceManagerTest.beforeClass(PersistenceManagerTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:537)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:206)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:132)
at org.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:173)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:105)
at org.testng.TestRunner.runWorkers(TestRunner.java:1182)
at org.testng.TestRunner.privateRun(TestRunner.java:761)
at org.testng.TestRunner.run(TestRunner.java:612)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:335)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:330)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:292)
at org.testng.SuiteRunner.run(SuiteRunner.java:241)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1169)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1094)
at org.testng.TestNG.run(TestNG.java:1006)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:107)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:199)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:170)
Here is my persistence.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="CounterpartContacts">
<jta-data-source>java:/comp/env/jdbc/CounterpartContact</jta-data-source>
<class>com.counterpartcontacts.entity.AgentContact</class>
<class>com.counterpartcontacts.entity.SecurityContact</class>
<class>com.counterpartcontacts.entity.Bank</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.SQLServerDialect"/>
</properties>
</persistence-unit>
</persistence>
Here is my persistenceLayer.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
<bean id="persistenceManager" class="com.apollo.counterpartcontacts.service.PersistenceManager">
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
<!-- <context:annotation-config /> -->
<bean id="txManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="CounterpartContactDataSource" />
<property name="persistenceUnitName" value="CounterpartContacts" />
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
</property>
</bean>
</beans>
The persistence.xml is located in src/META-INF, which is in the build path, so it should be found properly. Anyone have any ideas?
Well I usually place the persistence.xml in a resources folder /src/main/resouces/META-INF/persistence.xml because I do remember problems in the build not copying the resources to the output-directory.
I just had a look at our configuration and it looks a little different:
<!--
- Drives transactions using local JPA APIs
-->
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<tx:annotation-driven mode="aspectj" proxy-target-class="true" />
<!--
Custom PersistenceUnitManager, that reads all persistence.xml files in the
classpath and merges them to one single virtual persistence.xml.
In order to operate properly, all persistence.xml have to define the same
persistence unit name.
-->
<bean id="persistenceUnitManager" class="de.cware.cweb.jpa.MergingPersistenceUnitManager">
<property name="persistenceXmlLocations">
<list>
<value>classpath*:META-INF/persistence.xml</value>
</list>
</property>
<property name="defaultDataSource" ref="dataSource"/>
</bean>
<bean id="jpaTemplate" class="org.springframework.orm.jpa.JpaTemplate">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<!--
Creates a EntityManagerFactory for use with the Hibernate JPA provider and a simple
in-memory data source populated with test data
-->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="loadTimeWeaver">
<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>
</property>
<property name="jpaDialect">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
</property>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="showSql" value="false"/>
<property name="generateDdl" value="true"/>
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">${cweb.database.dialect}</prop>
<prop key="hibernate.hbm2ddl.auto">${cweb.database.generate}</prop>
<prop key="hibernate.search.default.indexBase">${cwb.home}/indexes</prop>
<prop key="hibernate.ejb.naming_strategy">de.cware.cweb.jpa.QuotingNamingStrategy</prop>
</props>
</property>
<property name="dataSource" ref="dataSource"/>
<property name="persistenceUnitManager" ref="persistenceUnitManager"/>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.ManagedBasicDataSource">
<property name="driverClassName" value="${cweb.database.driver}"/>
<property name="url" value="${cweb.database.url}"/>
<property name="username" value="${cweb.database.user}"/>
<property name="password" value="${cweb.database.password}"/>
<property name="initialSize" value="${cweb.database.initial-pool-size}"/>
<property name="maxIdle" value="${cweb.database.min-pool-size}"/>
<property name="maxActive" value="${cweb.database.max-pool-size}"/>
<property name="validationQuery" value="#{'${cweb.database.validationQuery}}'.length()==0?'':'${cweb.database.validationQuery}'}"/>
<property name="testOnBorrow" value="#{'${cweb.database.validationQuery}}'.length()==0?false:true}"/>
<property name="testWhileIdle" value="#{'${cweb.database.validationQuery}}'.length()==0?false:true}"/>
<property name="timeBetweenEvictionRunsMillis" value="#{'${cweb.database.validationQuery}}'.length()==0?-1:10000}"/>
<property name="minEvictableIdleTimeMillis" value="#{'${cweb.database.validationQuery}}'.length()==0?-1:60000}"/>
<property name="defaultTransactionIsolation" value="#{ T(java.sql.Connection).TRANSACTION_READ_COMMITTED}"/>
</bean>
Hope this helps :-)
Chris
keep your persistence.xml in WEB-INF/classes/META-INF/persistence.xml
remove hibernate conflicting libraries....
remove hibernate - 3.2.0 jar if hibernate core is there
place the persistence.xml in a resources folder /src/main/resouces/META-INF/persistence.xml for me it's work this solution
This error can happen if you have a hibernate mapped class with relations with another non-mapped class, a solution is to check the relation item as #transient (hibernate will ignore it, use this just to check if this is the error, and later map the related class). Example:
#Entity
public class City {
#Id
#GeneratedValue(strategy=GenerationType.AUTO)
private int id;
private String name;
#Transient
private State state;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public State getState() {
return state;
}
public void setState(State state) {
this.state = state;
}
}
And this is the non-mapped class which may give the error:
public class State {
private String name;
}