Thursday, September 30, 2010

java.io.FileNotFoundException : /home/tomcat/builds/Project/src/Documents /library/pic.txt


Kind Of Exception :

java.io.FileNotFoundException: /home/tomcat/builds/Project/src/Documents /library/GurlzGroup09_140895895.jpg (No such file or directory)      at java.io.FileInputStream.open(Native Method)  at java.io.FileInputStream.<init>(FileInputStream.java:106)     at java.io.FileInputStream.<init>(FileInputStream.java:66)      at com.appnetix.app.components.librarymgr.manager.librarydao.LibraryDocumentsDAO.getBytesInFile(LibraryDocumentsDAO.java:170)   at com.appnetix.app.portal.intranet.library.DownloadFileAction.execute(DownloadFileActi org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java: org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)      at com.appnetix.app.control.web.AppnetixControllerServlet.doGet(AppnetixControllerServlet.java:484)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet. java.io.FileNotFoundException (HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173 java.io.FileNotFoundException)    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)        at java.io.FileNotFoundException java.io.FileNotFoundException org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)  at org.apache.jk.server. java.io.FileNotFoundException.invoke(JkCoyoteHandler.java:306)  at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)  at org.apache.jk. java.io.FileNotFoundException (ChannelSocket.java:745)    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675) at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:868)  at org.apache. java.io.FileNotFoundException $ControlRunnable.run(ThreadPool.java:684)   at java.lang.Thread.run(Thread.java:595)


Reason Of Exception :

This kind of exception mainly occurs when you are trying to access a file for doing some input / output operations but the file is not present in a folder you are looking or might get deleted.


Solution Of Exception :

1)      The first solution for the problem is to check if you are looking for the file in correct folder i.e you have given the correct file path.
2)      The second solution for the problem is to create a file you are trying to access if it is deleted.





org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter

Kind Of Exception :

org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter of com.java.portal.payment.pojo.Payment.paymentID
at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:85)
ate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3571)       
at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:129)
at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:854)
org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:96)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1573)
org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$.processConnection(Http11Protocol.java:705)
org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type setter

Reason Of Exception :

This kind of exception mainly occurs when you are using Hibernate and the property in your POJO is of primitive type i.e int etc. and “null” is coming in it while setting.

Solution Of Exception :

1) The first solution for the above problem is to change the value of the column of the table from which “null” is coming to a not null value and set the column to NOT NULL.

2) The second solution is to not use primitive data types for properties of POJO instead use types like java.lang.Integer.

_targ is undefined

Kind Of Exception :

_targ is undefined is a common java script error one encounters while using AJAX technology and when the javascript code is not able to find the specified target.

Reason Of The Exception :

This type of javascript error “_targ is undefined” occurs while you are trying to retrieve data at run time using AJAX technology . The problem occurs when the return value i.e the java script code is undefined , i.e your java code that is fetching the data and creating the javascript code is not able to find the return page properly.

Solution Of The Exception :

The solution for resolving the issue “_targ is undefined” is to check if you are writing a proper javascript code in java class that would run at run time so that it will able to fing the proper target where it has to show the result.

Sunday, September 26, 2010

java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list'

java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list'  at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2847)   at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1531)        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1622)     at com.mysql.jdbc.Connection.execSQL(Connection.java:2376)      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)    at
java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:691)        at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)        at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)       at at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)      at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at
java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)   at
java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)   at java.lang.Thread.run(Thread.java:595)

Reason Of  The Exception :

This kind of exception i.e " java.sql.SQLException: Unknown column 'LAST_INSERT_ID' in 'field list' " occurs because you are using a column name in your sql query for a particular table that you might have not created.
For Example :
Let have SELECT a query : -
SELECT  NAME , BRANCH FROM STUDENT
NAME and BRANCH are two column in select query . This king of exception will occur if you are trying to use a column name that does not consist in table.

Solution Of Exception :

1)      Remove the column name from your sql query.
2)      Create the column with that name in the table name used in the query.