JRun Error – Exception parsing the TLD null : The tag function on line 14 is not a valid TLD element
Problem – Last week we had hard time with this problem. Our Web App was running all fine on Tomcat 5. But when we deployed our application on JRun we got
Exception parsing the TLD null : The tag function on line 14 is not a valid TLD element
Solution: – Carefully look into the Jars you are using in the classpath. In the most probability some of the Jars have some tlds which are incompatible with the JRun expects. Try removing all the Jars and carefully add only the required Jars checking the compatibility of the Jars one by one. See the explanation section below for the more details.
Explanation:- The error itself says that there is some TLD parsing error. The tag which JRun is trying to parse is having a different TLD than Jrun expects. If you look into Jrun.jar you will find a file called JSP.tld. It says tld version as 1.2. In our case we were having standard-1.1.2.jar in our classpath. That was the root cause of the problem. In fact this jar was not required at all. It was just sitting there in one of the common Jar repository. This solved our problem. You can think of looking into the struts.jar, servelet-api jars and Spring jars to check the compatibility with your JRun jars
Hibernate Error – Identifier of an instance altered from 1 to 1
Problem:-Getting the error ” identifier of an instance of com.sample.db.Sample altered from 1 to 1″
Solution:- Check whether the java type of the identifier field in the Data Object, the type of the field in the hibernate xml file and the type of the column in the database are compatible types or not.
Explanation:- I had faced this strange problem today. I am using struts, hibernate and spring.
I found out that the problem roots from
public void
checkId(Object object, EntityPersister persister, Serializable id, EntityMode entityMode) method of DefaultFlushEntityEventListener class.
I solved this problem by changing the type of the id field in the class and the hbm.xml file.
We made some mistakes in declaring getter and setter methods and id field for this object. (therefore it is advisable to use Hibernate tools or other reverse engineer tools to generate your data object and hbm files)
The sample class was as follows
class Sample{
integer sampleId;
String sampleName;
public int getSampleId(){
….
}
public void setSampleId(int i){
…..
}
}
And this was the hbm file declaration
<id
name=”sampleId”
type=”integer”
column=”sample_id”
unsaved-value=”0″>
<generator class=”identity” />
</id>
<property
name=”sampleName”
type=”string”
column=”sample_name”
length=”50″
not-null=”true”
unique=”true”
/>
The problem was that in the database the type of the field was smallint which corresponds to the short data type in Java. Therefore somewhere in the org.hibernate.type.Type class hierarchy the
public boolean isEqual(Object x, Object y, EntityMode entityMode) method was failing.
What I did is I modified the Data Object and the hbm file like this
class Sample{
integer sampleId;
String sampleName;
public int getSampleId(){
public short getSampleId(){
….
}
public void setSampleId(int i){
public void setSampleId(short s){
…..
}
}
<id
name=”sampleId”
type=”integer”
type=”short”
column=”sample_id”
unsaved-value=”0″>
<generator class=”identity” />
</id>
-
Archives
- October 2009 (2)
- September 2009 (3)
- August 2009 (2)
- July 2009 (1)
- June 2009 (2)
- May 2009 (3)
- April 2009 (8)
- February 2009 (2)
- December 2008 (1)
- November 2008 (3)
- October 2008 (1)
- January 2008 (8)
-
Categories
-
RSS
Entries RSS
Comments RSS
