Showing posts with label bug. Show all posts
Showing posts with label bug. Show all posts

Thursday, 5 April 2012

ADT17 bug: "java.lang.NoClassDefFoundError"

After successful build of Android application it crashes with error:

java.lang.NoClassDefFoundError: com.google.android.apps.analytics.GoogleAnalyticsTracker

Or some other class. Probably you have installed new ADT17 update. ;)

Resolution: Move \lib to \libs folder.

Tuesday, 18 October 2011

RAISERROR raises error - not expected behavior on SQL 2005

Description:
We all expect that RAISERROR raises error, but not like this one:

Script:
RAISERROR ('Error', 16, 255 );

Output:
Invalid value 255 for state. Valid range is from 0 to 127

Value for state can be from 0 to 255, according to BOL:
"state
Is an integer from 0 through 255. Negative values or values larger than 255 generate an error.
If the same user-defined error is raised at multiple locations, using a unique state number for each location can help find which section of code is raising the errors."

Solution:
- check SQL Server version (@@VERSION) and if it's 9.0.1399 (Microsoft Sql Server 2005 RTM) it's really time to apply some service pack. SQL 2005 RTM was released on November 7, 2005! ;)

Links:
- http://sqlserverbuilds.blogspot.com/ (list of SQL Server builds)
- http://www.microsoft.com/download/en/details.aspx?id=7218 (Download Microsoft SQL Server 2005 Service Pack 4 RTM)
- http://support.microsoft.com/kb/2507769/ (Cumulative update package 3 for SQL Server 2005 Service Pack 4)

Appendix:
- error in German language version:"Der Wert 255 für den Status ist ungültig. Der gültige Bereich liegt zwischen 1 und 127."

Thursday, 22 September 2011

SQL @@SERVERNAME can return NULL, but it should not

Probably we are all using "@@SERVERNAME" variable for geting SQL Server name and usually it does what we expect.

Today some custom maintenance procedures stoped working. After investigation I've noticed that SELECT @@SERVERNAME returns "NULL".

Background: @@SERVERNAME gets value (at SQL Server boot) from table sys.servers where server_id is equal to 0.

SELECT [name] FROM sys.servers WHERE server_id = 0

in this system table there are also linked servers and "my server" was there with server_id different than zero.

Solution:
EXEC master.dbo.sp_dropserver @server=N'serverName', @droplogins='droplogins'
EXEC sp_addserver 'serverName', LOCAL

and restart server.

Good workaround (probably best practice) is to use function ServerProperty('serverName').

More info at: http://randyjean.blogspot.com/2005/11/sql-servername-can-sometimes-return.html

PS Server is SQL Server 2005 Standard