Saturday, 25 July 2020

Spring boot Jpa Entity not managed.

The Spring boot app is not able to read Entity.
provide the @EntityScan("com.example.dmo.entity") package in Application class.

Thursday, 30 January 2020

Spring Boot STS - Error: cannot find main class

The ERROR due to the Classpath is too long for your Application.

Go to the Properties of your project in Eclipse or STS

1) Properties> Java Compiler> Annotation Processing> Factory Path

Un-Tick the Project Specific Settings. Below is the screenshot for your reference.

2) Make sure remove the Test path from the Java Build Path.


 3) Run the Spring Boot Configuration As shown below.



Tuesday, 20 August 2019

spring boot refresh static content in eclipse

There are 2 steps need to implement. 1) If it is Moven project then add the Devtools in Dependency in pom.xml.
org.springframework.boot spring-boot-devtools true 2) Add below lines to the Application.properties. # Path to project project.base-dir=file:///D:/CRM_CSS/crm/crm # Templates reloading during development spring.thymeleaf.prefix=${project.base-dir}/src/main/resources/templates/ spring.thymeleaf.cache=false # Static resources reloading during development spring.resources.static-locations=${project.base-dir}/src/main/resources/static/ spring.main.banner-mode=off spring.main.logStartupInfo=false

Tuesday, 9 July 2019

ORA-12705: Cannot access NLS data files or invalid environment specified

To resolve this issue, need to add below piece of code to your java code.

  Locale.setDefault(Locale.ENGLISH);

Locale.English is the Parameter is get from you pc set up.

Thursday, 4 July 2019

Linux command to make nullable size of existing file.

Below is the command to delete the content of the existing file and make zero size of the file. Please make sure make backup of the file.

cat /dev/null > nohup.out

Sunday, 13 January 2019

Windows Scheduler Last run Result 0x1

Here we are discussing about How to set Task Scheduler for a java file.
Step by steps:
1) Hope you know to go to Task scheduler in Windows: Windows 10, Just search with task scheduler and you can find the Task scheduler.
 and create the Task scheduler.

The setting is: 
Program/script: "C:\Program Files\Java\jre7\bin\javaw.exe" 
Arguments: -jar C:\Users\admin\Desktop\TestTask.jar 
Start in (optional): C:\Users\admin\Desktop ---- added 

If will solve the Last run Result 0x1 Error.

Tuesday, 13 September 2016

get HTML from Jquery

To get the HTML for name with jQuery is  $("form").attr("name");

Monday, 13 May 2013

Hibernate No of Primery keys


org.hibernate.MappingException: Foreign key (FK42C5E54499629E97:ADPT_GUARANTORTMP [ADPREFNO])) must have same number of columns as the referenced primary key (ADPT_GUARANTORTMP [ADPREFNO,SEQNO])
at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:113)
at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:96)
at org.hibernate.cfg.Configuration.secondPassCompileForeignKeys(Configuration.java:1310)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1217)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1333)
at com.maybank.auto.dp.utils.HibernateUtil.<clinit>(HibernateUtil.java:10)
at com.maybank.auto.dp.daos.ApplicationDao.addGuarantor(ApplicationDao.java:278)
at com.maybank.auto.dp.actions.GuarantorAction.execute(GuarantorAction.java:69)
at org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
at org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1002)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)

Sunday, 12 May 2013

HIbernate ID assign



org.hibernate.id.IdentifierGenerationException: ids for this class must be manually assigned before calling save():
at org.hibernate.id.Assigned.generate(Assigned.java:56)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:122)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195)
at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117)

Tuesday, 7 May 2013

Hibernate - java.lang.ExceptionInInitializerError


root cause
java.lang.ExceptionInInitializerError
 com.maybank.auto.dp.utils.HibernateUtil.<clinit>(HibernateUtil.java:14)
 com.maybank.auto.dp.daos.LoginDao.getUserByUserid(LoginDao.java:61)
 com.maybank.auto.dp.actions.LoginAction.execute(LoginAction.java:56)
 org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
 org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
 org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
 org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
 org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
 org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
root cause
java.lang.NumberFormatException: For input string: ""
 java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
 java.lang.Integer.parseInt(Integer.java:470)
 java.lang.Integer.parseInt(Integer.java:499)
 org.hibernate.cfg.HbmBinder.bindColumn(HbmBinder.java:1676)
 org.hibernate.cfg.HbmBinder.bindColumns(HbmBinder.java:1044)
 org.hibernate.cfg.HbmBinder.bindColumnsOrFormula(HbmBinder.java:1547)
 org.hibernate.cfg.HbmBinder.bindSimpleValue(HbmBinder.java:1143)
 org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2102)
 org.hibernate.cfg.HbmBinder.createClassProperties(HbmBinder.java:2060)
 org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:381)
 org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:295)
 org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:166)
 org.hibernate.cfg.Configuration.add(Configuration.java:716)
 org.hibernate.cfg.Configuration.addInputStream(Configuration.java:551)
 org.hibernate.cfg.Configuration.addResource(Configuration.java:613)
 org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1635)
 org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1603)
 org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1582)
 org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1556)
 org.hibernate.cfg.Configuration.configure(Configuration.java:1476)
 org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
 com.maybank.auto.dp.utils.HibernateUtil.<clinit>(HibernateUtil.java:9)
 com.maybank.auto.dp.daos.LoginDao.getUserByUserid(LoginDao.java:61)
 com.maybank.auto.dp.actions.LoginAction.execute(LoginAction.java:56)
 org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction.java:58)
 org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecuteAction.java:67)
 org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
 org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
 org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
 org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
 org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
 org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

Sunday, 5 May 2013


[ERROR] Method invocation failed.
java.lang.IllegalArgumentException: argument type mismatch
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.apache.commons.beanutils.PropertyUtilsBean.invokeMethod(PropertyUtilsBean.java:1773)
at org.apache.commons.beanutils.PropertyUtilsBean.setSimpleProperty(PropertyUtilsBean.java:1759)
at org.apache.commons.beanutils.PropertyUtilsBean.setNestedProperty(PropertyUtilsBean.java:1648)
at org.apache.commons.beanutils.PropertyUtilsBean.setProperty(PropertyUtilsBean.java:1677)
at org.apache.commons.beanutils.BeanUtilsBean.setProperty(BeanUtilsBean.java:1022)
at org.apache.commons.beanutils.BeanUtilsBean.populate(BeanUtilsBean.java:811)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:298)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:467)
at org.apache.struts.chain.commands.servlet.PopulateActionForm.populate(PopulateActionForm.java:50)
at org.apache.struts.chain.commands.AbstractPopulateActionForm.execute(AbstractPopulateActionForm.java:60)
at org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase.java:51)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:304)
at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190)
at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)

Exceptions in java

Definition

An exception is an event, which occurs during the execution of a program, that disrupts the normal flow of the program's instructions.
ex :-

Exception in thread "main" java.io.IOException: Cannot run program "ls": java.io.IOException: error=12, Cannot allocate memory
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:474)
        at java.lang.Runtime.exec(Runtime.java:610)
        at java.lang.Runtime.exec(Runtime.java:448)
        at java.lang.Runtime.exec(Runtime.java:345)
        at prova.main(prova.java:6)
Caused by: java.io.IOException: java.io.IOException: error=12, Cannot allocate memory
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:164)
        at java.lang.ProcessImpl.start(ProcessImpl.java:81)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:467
... 4 more

Exception in thread "main" is mention there is an exception after this java.io.IOException: is type of the exception( class) and Cannot run program "ls":  is the root cause of the exception


An exception can occur for many different reasons, including the following:
  • A user has entered invalid data.
  • A file that needs to be opened cannot be found.
  • A network connection has been lost in the middle of communications, or the JVM has run out of memory.
Some of these exceptions are caused by user error, others by programmer error, and others by physical resources that have failed in some manner.



To understand how exception handling works in Java, you need to understand the three categories of exceptions:
  • Checked exceptions: A checked exception is an exception that is typically a user error or a problem that cannot be foreseen by the programmer. For example, if a file is to be opened, but the file cannot be found, an exception occurs. These exceptions cannot simply be ignored at the time of compilation.
  • Runtime exceptions: A runtime exception is an exception that occurs that probably could have been avoided by the programmer. As opposed to checked exceptions, runtime exceptions are ignored at the time of compliation.

    exception 



MyEclipse-Struts-config.xml Could not open the editor: An unexpected exception was thrown.


java.lang.NullPointerException
at com.genuitec.eclipse.struts.editor.modeler.model.StrutsConfigDiagram.processAction(StrutsConfigDiagram.java:574)


This error causes to the MyEclipse plugin have some problem to open Struts configuration file. Please restart your IDE.

Saturday, 4 May 2013

Could not synchronize database state with session

To overcome this error, you should add this session.flush(); method  at last to your code.


Wednesday, 14 November 2012

The jsp will convert into a servlet using httpbaseservlet is a HttpServlet.