error C2724: ‘ClassName::FunctionName’ : ‘static’ should not be used on member functions defined at file scope

July 30, 2007 · Posted in C++, Visual Studio · Comment 

Full error message: error C2724: ‘ClassName::FunctionName’ : ‘static’ should not be used on member functions defined at file scope

Error occurred in Visual Studio 2003 while declaring a static function.

Header file:

class MyClass {
public:
static void FunctionName();
};

Source file:

static void MyClass::FunctionName() {
return 0;
}

The error occurs because i used the ‘static’ modifier in the source file as well as the header file.

The fix is: Remove the ‘static’ modifier from the source file

So the code in the source file will become:

void MyClass::FunctionName() {
return 0;
}

java.sql.SQLException: Cannot convert value ’0000-00-00 00:00:00′ from column 9 to TIMESTAMP

July 26, 2007 · Posted in Hibernate, Java, MySQL · 2 Comments 

Full error message:

Exception in thread "main" org.hibernate.exception.GenericJDBCException: could not execute query
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:2223)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
at org.hibernate.loader.Loader.list(Loader.java:2099)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
at admin.MembersTableModel.<init>(MembersTableModel.java:43)
at admin.AdminOptionsForm.initComponents(AdminOptionsForm.java:98)
at admin.AdminOptionsForm.<init>(AdminOptionsForm.java:32)
at managemembers.Main.main(Main.java:45)
Caused by: java.sql.SQLException: Cannot convert value '0000-00-00 00:00:00' from column 9 to TIMESTAMP.
at com.mysql.jdbc.ResultSet.getTimestampFromBytes(ResultSet.java:6864)
at com.mysql.jdbc.ResultSet.getTimestampInternal(ResultSet.java:6899)
at com.mysql.jdbc.ResultSet.getTimestamp(ResultSet.java:6218)
at com.mysql.jdbc.ResultSet.getTimestamp(ResultSet.java:6256)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.getTimestamp(NewProxyResultSet.java:3394)
at org.hibernate.type.TimestampType.get(TimestampType.java:30)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2220)
... 11 more

My example:

// the Java class

public class Member  {
// some private member attributes
private Date addedDate;
// proper getter and setter methods
}

<!– the Hibernate mapping–>

<hibernate-mapping>
<class name="managemembers.Member" table="member">
<!-- some mappings here-->
<property name="addedDate" type="timestamp" column="added_date"/>
</class>
</hibernate-mapping>

# The MySQL table

CREATE TABLE `member` (
# some fields here
`added_date` DATETIME,
) ;

So I was mapping a java.util.Date field in the POJO to a MySQL DATETIME field.

The error occured while I was trying to retrieve the data from the member database table.

The problem was that I had DATETIME values in the database with all-zero components (0000-00-00 …), so the solution was to set all the added_date field values with all-zero components to NULL and to be careful to set a valid DATETIME value or NULL into the added_date field each time I inserted a new row.

Conclusion: You have 2 choices: either set the date field in the table to a NULL value either set it to a valid date.

error LNK2001: unresolved external symbol private: static …

July 19, 2007 · Posted in C++, Visual Studio · 17 Comments 

Full error message: error LNK2001: unresolved external symbol “private: static <type> * <Class>::<memberVariable>” (?<memberVariable>@<C@@0PADA)

Error occured on Visual Studio 2003 when compiling a C++ project.

The error occurred because memberVariable was a static variable and it wasn’t initialized.

Example:

class A {
static char * filename;
static void F(void);
} ;

Fix:

char * A::filename = NULL;

The fix in my case is the following code added to the implementation of the <Class>:
<type> <Class>::<memberVariable> = <initValue>;

An XSLT stylesheet does not have an XML mimetype:

June 8, 2007 · Posted in Apache Web Server, XML, XSLT · 4 Comments 

Full error message: Error loading stylesheet: An XSLT stylesheet does not have an XML mimetype:

Error occured on Firefox 2.0 when working with XML, XSLT.

xml file:

<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="product-list.xslt"?>
<f>PRODUCT DETAILS</f>

xslt file

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<stylesheet version="1.0" xmlns="http://www.w3.org/1999/XSL/Transform">
<template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>aaa</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="alert('x');">
<value-of select="f"/>
</body>
</html>
</template>
</stylesheet>

The error occurs because the web server (in my case Apache) had this entry in the mime.types file:

text/xml            xml xsl

The fix in my case is:
Change extenstion from xslt to xls on the stylesheet file or add xslt to the text/xml entry in mime.types file in Apache.

Hello world!

June 7, 2007 · Posted in Uncategorized · Comment 

Hi, welcome!

We here at TheErrorMessage.com are planning to build a website with many error messages and their fixes and solutions. This will be a lengthly process so we are on our way.

If you can’t find your error and the fix here but you found it elsewhere and you want to help us please contact us and we will create an account for you so you can publish articles here or we will publish the fix on your behalf whichever you prefer.

Thank you.

« Previous Page