March 31, 2009

Tracking Down RTE: 35601 Element Not Found

Filed under: Database,Error,Solutions — Tags: , — Kevmar @ 6:43 am

We recently turned on some new features of a product we were using and would get this RTE on a few records within the application. The number of problem records were small, the total number of records worked with in a day made them a regular occurrence.

I went over to our test environment. It was up to current patch levels, but the data was a few months old. Almost all of my broken records in live were broken in test. That gave me hope that its an existing data issue and not something actively breaking records.

The nice thing about our test environment is that I am usually the only person using it. That makes it easy to toss the SQL Profiler on with out having to filter it to just my traffic. I started the profiler at the point just before clicking the button that generated the RTE and paused it just after the message came up. I closed the app and repeated this process a few times for both working and broken records.

Looking at the queries that each ran, the broken records all stopped at the same point after the same query was run. That tells me that the application is processing the queries as it runs them and the last one before it stopped is my suspect query. If both the broken and the working records had the same full list of queries I would have had to check them all. That would have indicated to me that it pre-loads most of the data before processing it. I was in luck.

The query was a large one but the only difference between all records was the record ID. So it is the same query running for both working and non-working records. Running the query for all of them gave me different sized record sets. Some had more a lot of records and some had very few. One thing did jump out at me as I looked at the raw data.

A few null values jumped out to me in a column that looked like it should have a value. With my experience with the data I knew it should have had a value. I saw one column that had data in it directly related to reference I expected instead of that null value. Because this looked like a complicated query, my first guess was a bad join.

That column was not the only one with nulls in it but every time it had a null the 3 columns to the right also had nulls. That’s what I expect a bad join to look like. So I started reformatting the query with proper indents and white space. It did contain a few union calls. The first query in the union practically returned the same results. It looked the same except for a few less rows. My null values were still mixed into the good data.

I focused on the table columns that were null and the one column that contained directly related information. The joins between them looked correct. Exactly how I would have written them. After rewriting the query as simple 2 table join that used the same logic, I ended up with the same results. It was a join that I expected to be valid every time but in this case there are times where its not.

It turned out to be a flaw in the application logic where it allowed some changes to one set of tables that should have enforced changes in another. But they were enforcing them at the application level instead. Other parts of the system enforced it correctly, this one point in the application did not. It overlooked the fact that it needed to enforce it and I almost expect the developer to make the same assumption I made.

I know this is a little different from my usual problem/solution posts but this was mostly an internal product and I wanted to document the process I took to solve it.

March 11, 2009

New transaction cannot enlist in the specified transaction coordinator

Filed under: Database,Error,Servers,Solutions — Tags: , — Kevmar @ 4:29 pm

I was tying to set up a special feature in the software I work with that involved linked servers. This was test setup so I configured some SQL servers I already had set up and ran into this error.

[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a].
Msg 7391, Level 16, State 1, Line 2
The operation could not be performed because the OLE DB provider ‘SQLOLEDB’ was unable to begin a distributed transaction.

The only message the application gave me was the first line but I uncovered a sql command that let me test it without the overhead of running my application. Here is that command:

BEGIN DISTRIBUTED TRANSACTION
select * from linkname.databasename.dbo.tablename
COMMIT TRAN

I was able to get the inner command to run on its own. As a distributed transaction, it would fail every time.

I eventualy found this KB from microsoft to get me in the right direction. http://support.microsoft.com/kb/839279

You may receive a 7391 error message in SQL Server 2000 when you run a distributed transaction against a linked server after you install Windows Server 2003 or Windows XP Service Pack 2

It turned out to be a settings issue with the Microsoft Distributed Transation Cordinator (MS DTC). I had no idea what that realy was. It turns out MS DTC should be enabled when SQL is installed but by default its locked down (or is with 2003/xp sp2).

I used dcomcnfg to get to the component services. Console Root -> Component Services -> Computers -> My computer -> Properties . On the Default properties enable distributed COM on the computer. Under MSDTC -> Security Configuration check the option for Network DTC Access.

I did make those changes on both servers, I don’t know if that was needed or not. I did the linked server last and it worked as soon as I applied the changes. I know those were the exact changes I made on the 2nd server. The first one prabably has every thing checked or opened up trying to figure it out.

Other thing you may try if having issues it to make sure the Distributed Transaction Coordinator is running as network service and not local system. Reinstalling it as a service and rebooting were a few other tips I read while trouble shooting this problem.

April 13, 2008

Windows cannot install required files. Make sure all files required for installation are available, and restart the installation. Error code: 0×800703

Filed under: Error,Solutions,Vista — Tags: — Kevmar @ 4:05 pm

I just built a new computer and ran into some issues installing Microsoft Windows Vista. I was getting this message: “Windows cannot install required files. Make sure all files required for installation are available, and restart the installation. Error code: 0x800703E6”. I would get past all the install windows and even copy all the files. It was the expanding files part that would fail.

My first guess was to remove a stick of ram. I have heard that before and I was at 4G with the 2 sticks. That did not help this time. I ran the memory tests and everything was ok. I left that second stick out while doing the rest of my tests.

I looked for the error code and I found a KB article (KB930984) that described my exact problem. It indicated that my firmware on my DVD drive was causing the issue. Either update the firmware or copy the files to the disk. I copied all the files to my C: and rebooted. I let it boot from the hard drive and ran into the same issue. I saw another site suggest that the DVD drive needed to be the slave on the IDE cable. Changing the jumper didn’t fix that either. I disconnected the DVD drive and the installer required that I had one.

I thought that was odd. I had an old DVD drive that windows would see but could not see any disk inserted. I set it up and started the install over. It still complained about the DVD drive. After placing a copy of all the files and the main disk and booting from it, the install would still look for the install files on the DVD. I still had the install disk in the drive during some of my tests. That would explain me still getting the error when I thought I had ruled the DVD drive out.

After some more searching, I found the solution. Installing Vista from Hard Disk, USB Disk or Memory Stick. I selected the repair option instead of install after reading that. Ignored the drive selection and started the command prompt. I ran the fallowing commands:


c:
cd /boot
del bcd
bcdedit /createstore
cd ../sources
setup

The install went smooth after that. After the install finished, I reformated and installed Vista 64 bit. I was using my 32 bit disk because its a known good one. I was having issues so I wanted to eliminate variables as much as I could.

I copied all the CD files to the C: again but it failed to boot. I booted to the DVD but droped to a command line and ran the install off the hard disk. I did not have any other issues with the rest of the install. I even did that last install with both sticks of ram.

December 24, 2007

No accessible ‘Main’ method with an appropriate signature was found

Filed under: .NET,Error,Solutions — Tags: , — Kevmar @ 7:18 am

I was working in a project that was a windows application, but I decided to change it to a console application instead. I changed the type to console and selected Sub Main as my startup object. When I compiled it I got the fallowing error: Error 54 No accessible ‘Main’ method with an appropriate signature was found.

I expected problems because I knew I did not have the Sub Main defined in my project. I added a class file and entered the fallowing code:

Public Class Main

  Public Shared Sub Main()

     Application.Run(New Form1)

  End Sub

End Class

Several examples I saw had main defined with (ByVal args() As String) as the parameter. One thread on the subject indicated that you can add a module instead of a class. Here is the syntax for that.

Module Main

   Public Sub Main(ByVal args() As String)

      Application.Run(New Form1)

   End Sub

End Module

You will notice that the shared keyword is left off inside the module.

December 14, 2007

NullReferenceException raising an event in C#

Filed under: .NET,Error,Solutions — Tags: , — Kevmar @ 6:56 am

I was working with events in C# and ran into this exception. System.NullReferenceException was unhandled Message=”Object reference not set to an instance of an object.” This exception was at the exact point in my code where I attempted to raise the event. It turns out that if there are not event handlers attached to your event, an attempt to raise it will give you this exception. To solve it, you have to check to see if its null before raising it.

public class TestEvent{    public event EventHandler MyEvent;    public void RaiseMyEvent(){          if(MyEvent != null){         MyEvent(this, null);       }   }}

All the samples I was looking at did not check for a null value, so neither did I. Now that I had the problem, I see why I need to check.

December 7, 2007

Raising an event in C#

Filed under: .NET,Error,Solutions — Tags: , — Kevmar @ 7:37 pm

Here is the simplest way to raise an event.

public class TestEvent{   public event EventHandler MyEvent;   public void RaiseMyEvent(){      MyEvent(this, null);   }}

This uses the default EventHandler that returns a object source and a EventArgs ex. If you want to pass back different parameters, you will need to create your own delegate. The delegate we just used looks like this:

public delegate void EventHandler (object source, EventArgs ex);

We dont have to define it because .NET already defined it for us. Here is a second example where we built a custom delegate and raise it.

public delegate void MyCustomEventHandler (string message);

public class TestEvent2{public event MyCustomEventHandler MyEvent2;public void RaiseMyEvent(){MyEvent2("Message sent with event");}}

Now that I explained how to raise events, there is a bug in that code. I’m saving that for my next post: NullReferenceException raising an event in C#

October 19, 2007

mscorlib: Request for the permission of type Version Culture PublicKeyToken failed.

Filed under: .NET,Error,Solutions — Tags: , — Kevmar @ 8:44 am

I wrote a little database access code in vb.net that I wanted to use in another script. I was getting this error though. C:\Test.vbs(6, 1) mscorlib: Request for the permission of type ‘System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089′ failed.

My dev machine worked fine. And the other box looked like it had the data access and .NET components I needed. Looking closer, it was talking about permissions. The connection string was the same and it contained the password. I decided it was a security zone messing me up.

When I ran regasm, the dll was located on a network share. That was about the only difference. So I unregistered it, moved it locally, and ran regasm again. The problem went away.

mscorlib: Request for the permission of type Version Culture PublicKeyToken failed.

October 18, 2007

The system cannot find the file specified. CreateObject

Filed under: .NET,Error,Script,Solutions — Tags: , — Kevmar @ 1:48 pm

I was attempting to use some vb.net code in a vbs file and was getting “The system cannot find the file specified.” on the CreateObject line. I tracked it down to the way I registered the DLL.

One sugestion told me to unregister and re register it with regsvr32. Because I was using .NET, I knew that was not it. It turned out to be my use of regasm to register my DLL. I left out the /CODEBASE option.

Once I registered it with that option, the error went away.

June 25, 2007

Invalid postback or callback argument.

Filed under: .NET,ASP,Error,Solutions — Tags: , — Kevmar @ 11:47 am

I was tring to move some web apps to a demo server and ran into this error message on one of them.

Invalid postback or callback argument. Event validation is enabled using in configuration or <%@ Page EnableEventValidation="true" %>in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.

what made this move interesting is that the page is a aspx page that was converted from a asp page some time ago and that it was still configured as a dot net 1.1 app in iis. When I moved it, i saw the aspx ending and set it us as a dot net 2.0 app. Changing it back fixed my issus.

I did find this link to a related issue and would have tried those steps if my trick did not work.
http://www.netnewsgroups.net/group/microsoft.public.dotnet.framework.aspnet/topic637.aspx

April 20, 2007

BACKUP LOG cannot be performed because there is no current database backup

Filed under: Database,Error,Solutions — Tags: , — Kevmar @ 2:19 pm

I was getting this message when trying to use a script to back up my database: “BACKUP LOG cannot be performed because there is no current database backup”. My searching lead me to this link:http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=243166&SiteID=1. where someone else was having the same issue.

The problem happens when you change the database to simple to truncate the log, then back to full recovery. You have to do a manual full backup before you can do a log back up again.

I had gone to simple recovery in an attempt to shrink a log file that was not being maintained.

Older Posts »

Powered by WordPress