Spring Data Custom Method Error : org.springframework.data.mapping.PropertyReferenceException: No property xxx found for type

I’m trying to create base repository class to add new custom methods, but getting errors. @NoRepositoryBean public interface XRepository<T, ID extends Serializable> extends JpaRepository<T, ID> { Optional<T> xxx(ID id); } public class XRepositoryImpl<T, ID extends Serializable> extends SimpleJpaRepository<T, ID> implements XRepository<T, ID> { private final EntityManager entityManager; public XRepositoryImpl(JpaEntityInformation entityInformation, EntityManager entityManager) { super(entityInformation, entityManager); … Continue reading “Spring Data Custom Method Error : org.springframework.data.mapping.PropertyReferenceException: No property xxx found for type”

Tomcat 7 error with start the server

it’s my first post in this site, I hope that i don’t spam you. I do this tutotial: https://www.youtube.com/watch?v=RnTTbu_6WH8&list=PLHqN89yRGMyAcwWcSWk59_S_-BQVn3Rrb&index=10 And i have problem when I run Tomcat server: 19:22:33,365 ERROR ContextLoader:308 – Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in ServletContext resource [/WEB-INF/datasource-config.xml]: Cannot create inner bean ‘org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter#3f00e287’ of type [org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter] … Continue reading “Tomcat 7 error with start the server”

Spring MVC, updating Model Map on form post still shows old info

Please bear with my limited knowledge of spring mvc. I’m trying to refresh a view with updated model info after a POST request. The new info appears on the view, as well as the old version, which completely messes up the view. Here is my controller code. If you see something that isn’t correct please … Continue reading “Spring MVC, updating Model Map on form post still shows old info”

@Autowired Component inside Quartz Job in Spring Boot

I am facing a problem with Quartz and Spring implementation. When I autowire a component inside a Quartz Job I got this error: org.quartz.SchedulerException: Job instantiation failed at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:45) ~[spring-context-support-4.3.3.RELEASE.jar:4.3.3.RELEASE] at org.quartz.core.JobRunShell.initialize(JobRunShell.java:127) ~[quartz-2.2.3.jar:na] at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:375) [quartz-2.2.3.jar:na]Caused by: java.lang.InstantiationException: com.kaloudia.api.quartz.jobs.ArticlePublicationJob at java.lang.Class.newInstance(Class.java:427) ~[na:1.8.0_131] at org.springframework.scheduling.quartz.AdaptableJobFactory.createJobInstance(AdaptableJobFactory.java:58) ~[spring-context-support-4.3.3.RELEASE.jar:4.3.3.RELEASE] at org.springframework.scheduling.quartz.AdaptableJobFactory.newJob(AdaptableJobFactory.java:41) ~[spring-context-support-4.3.3.RELEASE.jar:4.3.3.RELEASE] … 2 common frames omittedCaused by: java.lang.NoSuchMethodException: … Continue reading “@Autowired Component inside Quartz Job in Spring Boot”

Spring save record and send message rollbacks

I have a class: @Service @Transactional class MyService{ @Autowired MyTableRepository repository; @Autowired FacebookMessageSender sender; public void updateTableAndSendMessage(MyTable m){ m.setProcessed(1); repository.save(m); sender.sendMessageToFacebook(m); } } Somewhere in the code: List<MyTable> list=repository.findByProcessed(0); for(MyTable m:list){ myService.process(m); } So, I have the following: In the quartz job I retrieve all records with processed flag set to 0. Then I pass … Continue reading “Spring save record and send message rollbacks”

RemoteSolrException: ERROR: [doc=2] unknown field 'firstName'

I wrote a Spring project that uses SolrInputDocument to add data from tables. I have used doc.addField() method doc.addField(“actorId”,a.getId()); doc.addField(“firstName”,a.getFirstName()); (posting only few of them) for adding data that I have retrieved from MySql. When I am trying to add these values to SOLR index, I am getting the following error. Exception in thread “main” … Continue reading “RemoteSolrException: ERROR: [doc=2] unknown field 'firstName'”

@JsonIgnore Behaviour

While working on a project, I made the mistake of putting a @JsonIgnore on the setter rather than the getter property as below private Set<Book> books; public Set<Book> getBooks() { return books; } @JsonIgnore public void setBooks(Set<Book> books) { this.books = books; } This should have resulted in my getbooks api call working fine (calling … Continue reading “@JsonIgnore Behaviour”

No tables created in the MySQL database in Spring Boot application

Here is my Application.java: @Configuration @EnableAutoConfiguration(exclude = {JpaRepositoriesAutoConfiguration.class}) @ComponentScan @SpringBootApplication public class UserFrontApplication { public static void main(String[] args) { SpringApplication.run(UserFrontApplication.class, args); } } Contents of application.properties: spring.datasource.driverClassName=org.gjt.mm.mysql.Driver spring.datasource.url=jdbc:mysql://localhost:3306/mydb spring.datasource.username=root spring.datasource.password=password spring.jpa.database-platform=org.hibernate.dialect.PostgreSQLDialect spring.jpa.show-sql=false spring.jpa.hibernate.ddl-auto=create pom.xml: http://maven.apache.org/xsd/maven-4.0.0.xsd”> 4.0.0 <groupId>com.userFront</groupId> <artifactId>userfront</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>jar</packaging> <name>UserFront</name> <description>User frontend for online banking</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.3.RELEASE</version> <relativePath/> <!– lookup parent … Continue reading “No tables created in the MySQL database in Spring Boot application”

Sending encrypted JSON with RSA from Spring to Android by REST

Firstly sorry for my english ;] I have to encrypt a JSON object with RSA encryption in WebService Spring, and send it by REST to android and decrypt it. The problem is that after I’ve received in android an encrypted String, it is not the same like this which was sent from WebService. Sent encrypted … Continue reading “Sending encrypted JSON with RSA from Spring to Android by REST”