Db4O - DatabaseFileLockedException when restarting server - db4o

I am developing VAADIN using Db4O for storage. Normally, I love the fact that I can change the source code, save it, and voi-lá: the server gets automatically restarted and I can see the changes in the browser.
But always when I restart the tomcat server I get a DatabaseFileLockedException. My workaround is to stop the server, and start it again. But doing this manually every 1 minute is annoying.
INFO:
I am using the client server configuration, but the VAADIN application itself is the DB4O server (other applications get connected to it):
ServerConfiguration serverConfig = Db4oClientServer.newServerConfiguration();
//Configure server...
ObjectServer server = Db4oClientServer.openServer(serverConfig, DBFILE, PORT);
server.grantAccess(...); //GRANT ACCESS TO OTHER APPLICATIONS
//LOCAL USE ONLY:
private ObjectContainer client = server.openClient();
//PS.: I never close the client locally. Can that be a problem?
Does someone know how to get rid of this?
Thanks in advance.

Hmm, do you even close the server. Otherwise the db4o server will keep running and produce this exception.
Is there some 'shutdown'-callback in VAADIN? Thats usually the place to close the db4o server. When you close the server all local and remote client connections will be shut down aswell or will throw an exception when accessing them the next time.

Related

importScripts in service worker

I am trying to use IndexedDB through Jakes Archibald's promise-based IDB lib by importScripts but as soon as I select "offline" through Chrome Dev Tools I am getting An unknown error occurred when fetching the script. A funny thing that's happening is that even if shut down my localhost server my app works fine (I have the browser cache disabled through Chrome Dev Tools) on my service worker installed browser but on another, of course, it doesn't.
I've looked into these https://www.w3.org/TR/service-workers/#importscripts, https://github.com/w3c/ServiceWorker/issues/106 resources but I didn't find an fix to my problem.
Any help/explanation would be greatly appreciated.
The problem is likely to be that you've not cached the idb.js file so that the service worker can access it when your app is offline.
Try adding it using cache.add (or cache.addAll if you are caching multiple files) inside your install callback.
Here is a library that i created. It makes using IndexedDB a whole lot easier! completely client-side, no dependencies!
https://github.com/ryanwaite28/promise-db

TFS Stops working

We face daily issue related to TFS. TFS stops working all of a sudden and it just keeps loading (No error message) and It works well after we reset the IIS. I've checked the Event Logs but no idea how to resolve the Issue.
If anyone can suggest something it would be of great help.
If you can rest IIS to fix this issue. It may related to Microsoft-Team Foundation Server Application Pool. You can find it in Internet Information Services (IIS) Manager→Application Pools→Microsoft-Team Foundation Server Application Pool
Check the Application Logs and System Logs in Event Viewer→WindowsLogs, whether there are some related information. And also check C:\Windows\System32\LogFiles\HTTPERR\httperr#.log which related to IIS.
If its cause by Microsoft-Team Foundation Server Application Pool, there is a walkaroud for your situation : right click this pool select recycling settings, check specific time(s), specify a value like 23:00. It will daily recycle when 23:00.

Trying to call svn.exe from batch file called by .NET webpage - odd results

The situation: I have a mvc.net web page which, when called, runs a batch file on my server using System.Diagnostics.Process.Start and cmd.exe. The batch file contains a line that runs "svn.exe update myfilepath" and should therefore update the files on the server.
What's happening?
- the batch file is running, but the call to svn.exe does nothing, nor produces any error messages.
- if I run the batch file by double clicking, the svn command DOES run successfully.
I guess this is a security issue, but I'm no expert on this and I cannot make any headway.
The site is hosted on Windows Server 2008 R2 and the app pool is using the ApplicationPoolIdentity system. I have tried running the app pool as Network Service and also adding Network Service as a user that can Read/Execute to svn.exe.
Please help!
This could be proxy related. It's possible that you access the Internet via a proxy, but that the user profile for the app pool identity isn't configured like this. You may need to use a domain account that you can log on as in order to create a suitable user profile. You will also need to make sure IIS is loading the profile by ticking the appropriate option.
(Another possibility is that the working directory for the process you are starting is not set correctly to the root of your Subversion working copy. We've established this wasn't the problem in your case.)

Service Not Responding - Error 1053

The program starts correctly if I double-click it or if I debug it from VS2010, but it doesn't respond when I try running it from Services.msc. It used to work just fine, but I tried to un-register and then re-register the service to fix a different bug and now I get the following error:
Could not start the PFAdapterMng service on Local Computer.
Error 1053: The service did not respond to the start or control request in a timely fashion.
I tried putting logs at the beginning of main(), and I found out that the service stops responding before it even gets there.
I've tried using Procmon to figure out if there's some registry key missing, but I couldn't find any problems through Procmon.
I've also tried re-registering the service to try to fix it, since re-registering the service was what caused the error in the first place. It doesn't seem to fix anything either.
I've stepped through the program with the parameters -UnregServer and -Service to ensure that the program was being unregistered and registered successfully, and it looks like it's being registered as a service correctly.
Is this because of some error in the registry? I don't see how or why my program stops responding before it even gets to main().
What else could I try to do to debug this problem?
UPDATE:
So, I tried un-registering the service after trying to run it, and it seemed to work fine. I look in services.msc, and I still see that the application is a service. In the past, before I got error 1053, it would just disappear after the first time. I tried un-registering it again, and I got a message box:
Service could not be deleted
So I decided to run the application with the parameter -UnregServer inside of Visual Studio 2010 to figure out what the error is. The function DeleteService() is failing with the error:
ERROR_SERVICE_MARKED_FOR_DELETE
The service is not removed until all open handles to the service have been closed. I stepped through the calls to the CloseServiceHandle() function and it seems like the handles were closed successfully. The service is also not removed if the service is running. I checked Process Manager, and the service was not running. Is the service not being removed because the service stopped responding earlier?
I tried restarting my computer and it was gone. Still, I don't understand why I have to restart my computer when the service used to un-register without the need of a restart before I was getting error 1053. Unless of course I can't un-register the service because the service was not stopped because it stopped responding.
I'll keep trying some more things, but I'm running out of ideas.
UPDATE2:
I tried rebuilding the original application, which I know worked as a service. This means the problem is not related to any of my code. Something is messed up with the Services Control Manager. I don't understand why I only get this error with this application. I have another application which communicates with this application which also needs to be registered as a service. I have no problems with that application. It works perfectly.
But for some reason, this application just stopped responding all of a sudden. I don't know what I changed or broke to cause the service to hang before it even gets to my main() function. The only thing I can think of now to fix the problem is to reformat the server, which is not an option.
Thanks,
Krzys
I feel stupid.
I've been using Remote Desktop Connection to connect to this server. Well, the service is starting and erroring out. The reason I didn't see any errors or message boxes was because they were appearing on the console session. I was not connected to the console session. I connected to the server using:
mstsc.exe /admin
And now I can see where the program stops responding.
Feels great to waste 10 hours though.

A storage mechanism has already been configured for this application

I am getting this error whenever my S#arp Architecture attempts to start and this is an problem with SQL Server (for example: SQL Server is not runing), after I start SQL Server and hit refresh, I get this error:
A storage mechanism has already been configured for this application
NHibernateSession.Init() or InitStorage() is being called more than once. You're probably calling it every request, it's supposed to be called only once at startup.
In an old application I have to maintain, this happened when the application start had issues. So I just had to recycle the application pool in IIS.
Try to add this line before calling NHibernateSession.Init() to clear any previous initiation.
try{ NHibernateSession.Reset(); } catch { }

Resources