java compile and runtime library - jar

I am new in java, I have spent hours for this problem. I will be really thankful for anyone who can help me.
Here is the problem.
My project, say ProjectA, need a
bunch of libraries to compile, but I
don't think I need a library called
LibraryB.jar. So the project
compiled correctly without LibraryB
in the class path.
At runtime, the program exited
without any error message. I didn't
know the reason until I put
LibraryB.jar in classpath when I run
my project
Could anyone tell me why this is happening? As I know, in java, If I referenced LibraryB.jar, it would be needed at compile and link time. Maybe I am wrong.

Lacking concrete examples, I can only give you a high-level overview:
If your project uses LibraryA that depends on LibraryB but does not actually expose any of LibraryB's classes in its interfaces (i.e. it only uses it internally), then you can easily come into a situation where you only need LibraryA to compile, but need LibraryB to actually run your code.
If your application exits without an error message, then it's your own fault, more often than not. Especially for people new to Java, a common cause for this is empty catch-blocks (don't do this!):
try {
someCodeThatCanThrowAndException();
} catch (Exception e) 7
// nothing
}

Related

app.config in other directory

A web service client (WCF) is compiled as a DLL, then comes the dll into the folder "c:\windows\assembly" ... just like I can now say that my DLL in C:\client\client.dll.config is expected?
It would perhaps also the possibility that the program store directly, the problem is that it starts from a SharePoint workflow that is surely not quite that simple.
It may sound silly, but the problem sounds so simple ... Unfortunately I have found so far after a while no concrete solution to Find.
EDIT:
No idea? It is the despair, I am running out of time and I have so much work to implement all this, and such a ridiculous number of hours to keep me?
I've found a lot in terms of editing files, but I will not change it I will change only the access to another directory where the file is ...
In the proxy classes, we refer only so eager ...
[System.ServiceModel.ServiceContractAttribute
(Name = "_-ASD_-CAS01D0005P0000013203",
Namespace = "urn:sap-com:document:sap:soap:functions:mc-style",
ConfigurationName = "_ASD_CAS01D0005P000001320")
]
There must theoretically be possible to simply change the ...
I'm just trying to throw it somewhere in the folder of SharePoint, there is the program being started. The file is from "C:\Windows\system32\inetsrv" started, but on this directory, the dll probably does not have access, because I still get the same error as if there was no config file there.
The file is from "C:\Windows\system32\inetsrv" started, but on this directory, the dll probably does not have access, because I still get the same error as if there was no config file there.
Finally solved by
AppDomain.CurrentDomain.GetData ("APP_CONFIG_FILE");
I can not find it an addictive client.dll.config, but instead the web.config in SharePoint virtual directory "c:\inetpub\wwwroot\wss\Virtual Directories\80\" searches. I added the information there and it works fine!

Runtime error but project compiles fine - Imports/using missing

I am very confused right now. I have VS2008 at my job right now and I have a weird behavior that I have been searching for a while now.
When I compile the project, it works fine, but in runtime I have an error saying object not defined or something like that. The problem is that the imports/using is missing in my class but why does it compile?
In fact, I want to be able to see that error when compiling not when running the webapp.
REEDITED: Here is an example. Lets say i want to use a typed list, I am declaring my object list(of int) for example without having added my imports (system.collection.generic) in the class. then I compile, it works and then I run it, it fails because of the imports missing. is this normal behavior or not?
REREEDITED: I just noticed that the DLL of all my references were not copied in my bin folders even though all of them are set to "Copy local = true". Is it possible that it has to do with our shared directory (all external dlls) being on a network drive (\server\shared). I am really out of ideas on this issue....
problem was because we were having the classes in the app_data folder
The answer to the current question - why you are getting this error - is that ASP.NET does not show many errors at compile-time. You will need to manually go through the application to verify that all pages work correctly. This is very common with ASP.NET development, due to the nature of the environment.
If you post the real errors (probably should be as another SO question), we can perhaps help you with them.
Remove all the dll, etc from bin...
rebuild the whole solution then run
It should run fine...

flex3 autoupdater error

Dear all, I am working on flex3 and want to update my application by flex3 autoupdate. When my installed application runs, my checkUpdate function calls the autoUpdater code. It starts but when it reaches to 100%, it shows this error: "There was an error downloading the update. Error# 16824"
My mxml code is here http://tinypaste.com/92138b and server xml code is here http://tinypaste.com/e3792
Please guide me.
Many Thanks
Google is your friend for this one; it looks like you forgot to update the application descriptor version number in the updated version on the interweb.
http://dezeloper.wordpress.com/2010/01/21/adobe-air-updater-error-16824/
I was unable to see your code as our work router blocks tinypaste. That said, however, I can tell you that air updates done via the ApplicationUpdater class are all based upon the updater xml file that you create/copy-out-there, and the xml file used for the compiler that sets the filename, version, application ID, etc. (most of which is used for the exe-compiler/exe-wrapper that facilitates the "bridge" between the OS and your compiled actionscript code). This link, might help: dezeloper.wordpress.com.
All-in-all keep debugging. The ApplicationUpdater class is one that was relatively well-written and is pretty self-explainable... once you get past this bug, there are a couple more that might be a sync-the-xml-text pain-in-the-butt. For example... I can tell you that in AIR 1.0 (and this may still be true in recent releases) if you made a change to your application xml file, and you're compiling from eclipse/flexBuilder/flashBuilder, you had to "project > clean" for those xml options to get picked up.
Best of luck,
Jeremy

Using nAnt to build projects containing EDMX

I've been working on training myself in the ways of using nAnt over the past few days, and have stumbled across an issue. During the development process, I've been using the new tools, like Entity Data Model, for database access.
When you go to try to build a library/executable that contains the Edmx product, you cannot embed the required files from visual studio. Now, I realize that I can do an exec task inside of nAnt and call msbuild for the particular project file, but I am trying to keep this to be completely nAnt build for now, so I'm in a heavy struggle to get things to work.
I did some searching to find a way ot handle this, and came across this Inline C# class that is supposed to do the trick. My problem is that I do not see how you call this in the target stack in order to get it to do its job. Can anyone shed some light on this? It would be of some great help.
Ok... so I'm a bit further along with this. I have since found that the code the gentleman has posted needs to be under the task for which it is meant to be run for. I'm even getting the *.ssdl, *.csdl, and *.msl files rendering into the directory... cool beans.
nwo i'm getting something interesting coming through... I've got reference via a "references" tag to System.Data.Entity, but I keep getting the following compile error:
error CS0234: The type or namespace name 'Objects' does not exist in the namespace 'System.Data' (are you missing an assembly reference?)
Any suggestions?
OK!!!
Got it! I had to edit the NAnt.exe.config file and add the System.Data.Entity.dll file into the Framework element for the .net framework 3.5!!!
I may wind up building a 3.5 SP1 entry, and if someone can give me a good area to post it, I'd be good to go.

ASP.Net MissingMethodException - "ctor" method not found

We are getting intermittent problems on a production server that we cannot recreate.
There are two very strange things about the issue. Firstly it's a method not found error on the constructor (ctor) for an exception handling helper class and secondly we have custom errors switched on for remote users and this property is being ignored.
The detail of the error is:
Server Error in '/MyWebsite' Application.
Method not found: 'Void MyExceptionHelperClass..ctor (System.Exception)'.
...
Exception Details: System.MissingMethodException: Method not found: 'Void MyExceptionHelperClass..ctor (System.Exception)'.
...
The stack trace is pretty unhelpful.
My thoughts are that there may be an out-of-memory error or something like that that is killing the page. When the exception handling code kicks in it tries to create an exception object which fails for the same reason giving this error.
However this is wild speculation. We are waiting for the event logs to see whether anything is amiss with the server but in the meantime does anyone have any thoughts or suggestions?
UPDATE:
It has proven difficult to get information out of the team responsible for the production servers but I have managed to find out that as far as load balancing is concerned, this site is currently only running on one server (this can be made to switch over onto another if necessary). Given that this is an intermittent problem and there is only one server involved, then I find it difficult to believe that this could be an assembly issue. Surely if it was then the problem would occur every time?
If you see this error happening on a site that has custom errors turned on, then the error is happening in the custom error handling routine itself.
From the look of the .NET error message it appears that your routine is expecting a constructor that accepts an exception by reference - your comment above shows a constructor that accepts by value.
Check carefully that there isn't a stale version of an assembly in your system somewhere. These can lurk in the Temporary ASP.NET Files folder; you'll need to do an "iisreset /stop" before you can clear them out.
In that regard it's always a good idea to make sure that AssemblyInfo.cs is set up to automatically stamp version numbers in some way. We have our version numbers tied to our source code repository system and CI build box so we can tell exactly what was in what assembly really easily.
I would use elmah: http://code.google.com/p/elmah/ to hopefully give you a bit more insight into the issue. It is free and can be used on an existing site without any recompilation. Try it - and post back if the issue is still happening.
As others have also mentioned, I would suspect that your site is somehow using an out of date version of an assembly. Something you could try doing is a full Precompile of your site before deploying to your production server. This ensures that ASP .Net doesn't dynamically compile the site on the fly, and therefore should mean that it's using completely up to date code throughout.
Do you have a no parameter public constructor defined for MyExceptionHelperClass in your code? Or is the class meant to only have static methods, in which case it should be a static class.
public class MyExceptionHelperClass()
{
public MyExceptionHelperClass() { }
}
Unfortunately, this may be one of those cases where the error message is of little to no value. In my experience, this general class of exception may be the result of either a configuration issue or bad logic aroung threading/app domains. For example, I have seen similar issues upon attempting to load the same assembly into an app domain more than once.
You mention that this is difficult to reproduce. If it's only happening on one server in the production farm it's more likely to be a config issue (with that machine). If it's happening on more than one server than it could be either config or threading.
It might be worth spending some time looking at the larger code base around the areas mentioned above. The root cause may not be in this class. Good luck!
I think it's a Framework issue with keeping compiled versions consistency. It's common to see same sort of errors while updating site sources repeatedly. Just try something like
net stop iisadmin /y && del /q /f /s "%systemroot%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\*.*" && iisreset
I encountered this exception today on a webforms page. I found a solution, but I'm not sure why it worked.
Nest the code behind in a 'Namespace [YourNamespace]' tag.
Add the namespace to the html Page tag's Inherits property in the aspx page 'Inherits="PathStart.YourNameSpace.ClassName"'.
Rebuild
Navigate to the page again and you should not encounter the exception.
After following the steps above I reverted the changes and did not re-encounter the exception.

Resources