Mvc cant access repository classes from static functions in controller(mvc net c# Entity Frame work)

I working on .net MVC Entity Framework (Code First).
I am not able to get Datacontext in repository classes functions when i call these functions from a static function in controller . I am getting the Exception
"An exception of type 'System.NullReferenceException'
occurred in YYYYYY.Web.dll(Default
project dll) but was not handled in user code
Additional information: Object reference not set to an instance of an object."
i need to call static functions since i had to call some functions asynchronously.Like Report generation
This works perfectly fine when called from a non static function in controller.
Thanks in advance
Punnoose

But when i call a function in repository class, With dependency Injection(NInject). 
eg:-
 public Batch GetBatchDetail(string batchID)
            return this.db.Batches.Where(x => x.ID=batchID).FirstOrDefault();
Db is Datacontext
I am getting the Exception  "An exception of type 'System.NullReferenceException'
occurred in YYYYYY.Web.dll(Default
project dll) but was not handled in user code
Please do help me
regards
punnoose

Similar Messages

  • Calling java class from abap function moduile

    Is it possible to call java class from function module.
    i am a java guy. my need is to call a java class from a  function module in the backend. which in turn performs certain functions.
    i would be highly obliged if someone could let me know if this is possible.
    regards
    Srikumar V

    Hi Srikumar ,
    you can call a java webservice in ABAP .
    u can call the webservice and via that u can trigger the java class..
    Regards
    Renu

  • Accessing Java Classes from Forms

    Is is possible to access a Java class from Forms? I have been
    creating an Active X control that returns a Java object, and from
    that I can call methods on that object, but I would really like
    to do that without having and Active X control in the mix. Any
    suggestions?
    null

    Oracle Developer Team wrote:
    : Robert Nocera (guest) wrote:
    : : Oracle Developer Team wrote:
    : : : hey robert -
    : : : Developer 6.0 provides this ability for web deployment.
    You
    : : can
    : : : insert your own custom Java components into your
    application
    : : and
    : : : they will appear in the application when it is run via the
    : web.
    : : : If you look at the documentation for 6.0, there are a few
    : : : section son Pluggable Java Components and JavaBeans that
    : : : describes what is provided and how you use the interfaces
    : and
    : : : classes we provide.
    : : : A whitepaper on this topic will be posted to the OTN
    : shortly,
    : : as
    : : : well as some samples that illustrate how to go about doing
    : it.
    : : : cheers!
    : : : -Oracle Developer Team-
    : : Thanks for the quick response. Is there any way to access
    : those
    : : classes without being in a web deployment. That's probably
    : not
    : : totally out of the question, but what we had in mind was
    : adding
    : : some Java Functionality (actually connectictivity to some
    EJBs
    : : that we have) to existing forms. Currently there forms are
    : not
    : : deployed in a "web" environment and are just run from the
    : forms
    : : runtime engine.
    : : -Rob
    : hey again robert -
    : there's no easy way (yet!) to call out from forms runtime
    : process to a Java application.
    : We've played around some with creating an ORA_FFI interface to
    : JNI and then wrappering this with PL/SQL code. We've been able
    : to make calling into an EJB running in 8i from a forms runtime
    : work using this approach.
    : Let me know if this is of interest to you and I can post the
    : stuff we've currently got. It's no more than a simple demo and
    : is not complete. It requires quite a bit of manual coding on
    : the PL/SQL side since the interface emulates JNI (FindClass,
    : GetMethodID, CallMethodID, etc.).
    : cheers!
    : -the Oracle Developer Team-
    I'd be interested in this ORA_FFI doc you've been playing with.
    Would you please email it to me or post it.
    null

  • Class not Found when accessing Proxy class from backing bean in VC.

    Hi All,
    I'm attempting to access a class of a webservice(generated as a proxy) within my ADF application and invoke the method within a backing bean of the View Controller(bean scope : backing bean). The proxy has generated an ObjectFactory class among other classes. When I access this Object factory class from within the backing bean, the application throws a Class not found error.
    I don't know where the error lies since I've declared the View Controller of the ADF application dependent on the Proxy and I've imported the class and accessing it within a backing bean. How would you suggest I approach resolveing this.
    JDev : 1.1.1.4
    Thank you.
    Regards
    PP.

    Hello Arun,
    Thank you for suggesting a Data control, but my requirement isn't to drag and drop the method as a button. It's more of a behind the scnes updating data via a database adapter requirement.
    I've resolved the issue. turns out, my deployment archive didn't include the proxy.jpr. Once included it works likea charm.
    Thanks
    PP.

  • Accessing custom classes from JSP

    Hi Guys,
    I am having some problems accessing my custom classes from my JSP.
    1) I've created a very simple class, SimpleCountingBean that just has accessors for an int. The class is in the package "SimpleCountingBean". I compiled this class locally on my laptop and uploaded the *.class file to my ISP.
    2) I've checked my classpath and yes, the file "SimpleCountingBean/SimpleCountingBean.class" is located off of one of the directories listed in the classpath.
    3) When I attempt to use this class in my JSP, via the following import statement:
    import "SimpleCountingBean.*"
    I get the following compile error
    java.lang.NoClassDefFoundError: SimpleCountingBean/SimpleCountingBean
    I'm pretty sure that my classpath is properly setup because when I purposely garble the import statement, I get the "package not found" compile error.
    Do I need to upload some other files in addition to the class file? Any suggestions would of course be appreciated.
    Sonny.

    Trying to get some clearer view.. so don't mind..
    So you uploaded all your .jsp files into your account which is:
    home/sonny
    and it compiles and work. But custom classes doesn't seems to be working, where did you place your classes?
    From my knowledge of tomcat, classes are normally placed in, in this case:
    home/sonny/web-inf/classes
    Maybe it differs from windows enviroment to *nix enviroment.. well, I'm just saying out so if its not the case.. don't mind me.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Abstract class and static function

    Please tell me that why a static function can't be made abstract?
    Thanks.
    Edited by: RohitRawat on Sep 9, 2009 7:45 AM

    RohitRawat wrote:
    Please tell me that why a static function can't be made abstract?
    Thanks.Because the method belongs to the class.

  • EJBs accessing protected classes from java classloader

    Hello,
    We are facing a problem with classes isolation. I read from this newsgroup that
    to access a package level class from the base classloader from a bean, the supporting
    classes has to be from the same classloader as the bean. Well I think the only
    way we could do that is to have the *Bean.class in the base classloader, which
    is not what's recommended or move the support classes into the bean's classloader,
    which we cannot do.
    The purpose of this mail is to ask: is it a bug from weblogic server? Will it
    be fixed one day? If not, does it mean that it is impossible to isolate classes
    for local access from public classes?
    Thank you, Khiet.

    Thank you for your reply.
    Hope that one day we will not be obliged to have anything in the main classpath.
    :) Khiet.
    Rob Woollen <[email protected]> wrote:
    Tran T. Khiet wrote:
    Hello,
    We are facing a problem with classes isolation. I read from this newsgroupthat
    to access a package level class from the base classloader from a bean,the supporting
    classes has to be from the same classloader as the bean. Well I thinkthe only
    way we could do that is to have the *Bean.class in the base classloader,which
    is not what's recommended or move the support classes into the bean'sclassloader,
    which we cannot do.All correct.
    The purpose of this mail is to ask: is it a bug from weblogic server?No, it's how java classloaders work.
    Will it
    be fixed one day? If not, does it mean that it is impossible to isolateclasses
    for local access from public classes?You can expect that future versions of WLS will allow the user more
    control over classloaders, but for now you'll need public or protected
    access to cross classloaders.
    -- Rob
    Thank you, Khiet.

  • Accessing java classes from javascript

    Hi,
    I have the following javascript function
    function testjava {   
        var myString = new java.lang.String("Hello world"); // line 1
        alert("len:"+myString.length()); // line 2
    }It gives me a error at line 1 saying "'java' is undefined" in IE browser 5.5 sp2. But, both the lines execute correctly in netscape 6.
    Can someone please help..
    Thanks,
    Vijay.

    It seems that IE 5.5 doesn't support accessing java classes in JavaScript, so try to install IE 6 to see if it works or maybe, you doesn't have installed propertly support for JVM in IE.

  • Accessing IFS classes from Weblogic

    Can I access the classes of IFS from within Weblogic by adding the IFS jars to the Classpath of Weblogic?
    Also how does EJBs work with IFS?
    Kaustuva Mukherjee

    I'm doing exactly the same thing that you are asking. first install ifs client on weblogic server, so that all ifs jar files are on weblogic. then do this in the weblogic class path file:
    REM ------------------ IFS CLASSPATH ------------------------
    SET IFS_CLASSPATH=d:\Oracle\Ora81\ifs1.1\lib\adk.jar;d:\Oracle\Ora81\ifs1.1\lib\clientlib.jar;d:\Oracle\Ora81\ifs1.1\lib\cmdlineutils.jar;d:\Oracle\Ora81\ifs1.1\lib\cup.jar;d:\Oracle\O ra81\ifs1.1\lib\http.jar;d:\Oracle\Ora81\ifs1.1\lib\oemadmin.jar;d:\Oracle\Ora81\ifs1.1\lib\release.jar;d:\Oracle\Ora81\ifs1.1\lib\repos.jar;d:\Oracle\Ora81\ifs1.1\lib\utils.jar;d: \Oracle\Ora81\ifs1.1\lib\webui.jar;d:\Oracle\Ora81\ifs1.1\settings
    and include IFS_CLASSPATH in your weblogic path.
    restart weblogic and u'll have all ifs classes for your use.
    null

  • I cant access my ipod from itunes

    ok, ive looked all over itunes to fix this problem. i just bought an ipod video and i just finished downloading my music from my itunes, the only problem is that i cant access my ipod!! there is a icon that looks like a lock near the free space end of my ipod
    THIS IS WHAT IT LOOKS LIKE
    Used: 7.79 GB [ ] Free: 20.03 GB (and heres the icon)
    so... i can put music onto my ipod, i just cant take it off... or change it...

    Grey text when you look at the content and lock symbol at the bottom of the screen simply shows that your iPod is set to "automatically update songs and playlists". . If you want to access your iPod directly, play it through your iTunes, connect it to a second computer etc. you just need to change the update method to "Manually manage songs and Playlists" in the iPod preferences. For more detail see this tutorial: Managing Your Songs Manually
    One thing to be aware of with manually updating is that the iPod also has to be manually ejected before the "Do Not Disconnect" message will go away. Safely disconnect iPod
    For info: iPod 101
    The iPod offers three ways to transfer music from your computer. You can select one of the following update modes from the iPod Preferences menu in iTunes (Edit=>Preferences=>'iPod' tab):
    1) Automatically update all songs and playlists. This is the default mode, in which your entire music library, including playlists, is automatically synced to your iPod. If the music library on your computer exceeds the iPod storage capacity, you are prompted to select a different update method.
    2) Automatically update selected playlists only. With this option, iTunes automatically copies the playlists you have selected to the iPod when you connect it to the computer.
    3) Manually manage songs and playlists. You can also choose to transfer music to the iPod manually. This allows you to drag and drop individual songs and playlists from iTunes to the iPod.

  • How to access the screen from one function group to other function group

    Hi Experts,
    How to access the the screen from one function group to other function group.
    Please help me on this , Bcoz it is client requirement i need to finish this urgently.
    Please
    Thanks
    Basu

    HI ,
    You can do a call transaction or submit and return
    Regards,
    Sooness.

  • Accessing a class from a loaded SWF

    In Flash Professional, I drew a shape, converted it to symbol, linked it to class Symbol1 (extends MovieClip) which is generated at run-time, and saved the SWF file as shape.swf.
    Now my main application wants to load shape.swf and create multiple instances of Symbol1 but I get ReferenceError when trying to access the class Symbol1.
    Below is my main application's code. Errors thrown are mentioned in comments.
    public class MovieClipTest extends Sprite
        public function MovieClipTest()
            var url:String = 'shapes.swf';
            var l:Loader = new Loader();
            l.contentLoaderInfo.addEventListener(Event.COMPLETE, f);
            l.load(new URLRequest(url), new LoaderContext(false, ApplicationDomain.currentDomain));
        private function f(event:Event):void
            var content:Sprite = (event.currentTarget as LoaderInfo).content as Sprite;
            trace(getQualifiedClassName(content.getChildAt(0))); // output: Symbol1
            trace(ApplicationDomain.currentDomain.getDefinition('Symbol1')); // throws Error #1065: Variable Symbol1 is not defined.
            trace(getDefinitionByName('Symbol1')); // throws Error #1065: Variable Symbol1 is not defined.

    Your "Symbol" is obviously not in the current ApplicationDomain, but in the loaded SWF's domain:
    var symbolClass:Class = event.target.applicationDomain.getDefinition("Symbol") as Class;
    var symbolInstance:MovieClip = new symbolClass() as MovieClip;
    Also because you're loading a SWF, the content of the Loader is a MovieClip, not a Sprite.
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • Accessing Java Classes from Webservice Stubs

    So far I have been able to call a web service and copy the appropriate directories and files to the designated class path.  I can also successfully access a class file like this:
    MyObject = CreateObject("java", "ca.x.y.z.TestCollection.TestItem");
    However, whenever I try to do something with that variable, I get a white screen.  Any text that should have appeared before the command, will appear, but nothing appears afterwards, not even debugging info.  Here are a couple of commands that will cause this to happen.
    <cfdump var = "#MyObject#">
    MyObject = CreateObject("java", "ca.x.y.z.TestCollection.TestItem").init();
    x = MyObject.init();
    Anybody have any ideas?

    Ah, nothing like a fresh set of eyes to remind of the fundamentals.  Thank you for that.
    I actually could create a normal error by calling a method incorrectly.  I would see the grey box and my debgging info would appear.  However, if I did something I expected to succeed, it would seem to stop.  Any text above that command would appear.  No error message, no de-bugging.
    But I didn't think to look in our error log.  I see things like:
    Could not initialize class com.microsoft.schemas._2003._10.Serialization.Arrays.ArrayOfstring
    or
    org.apache.axis.description.TypeDesc.(Ljava/lang/Class;Z)V
    At least it's not a mystery anymore.  Thanks again for suggesting the error log.

  • Accessing utility classes from ebj

    I have a session bean trying to access a utility class in the lib directory (same
    directory as weblogic.jar). I have packaged it into a jar file and set the classpath
    pointing to the file in the startWeblogic.cmd file. I compiled and depolyed the session
    bean and it runs fine until it starts to access the class. I got NoClassFoundException.
    I have tried to shut down and restart the server without any success. Anyone can
    help me this this?
    I know I can package the utility into the same jar as my ejb. But I don't want to
    do it because it is going to be everywhere. What is the right way of doing it?
    Thanks in advance.
    L.W.Xu

    Rob,
    You are right.
    Thanks a lot.
    L.W.X.
    Rob Woollen <[email protected]> wrote:
    >
    >
    If it's in the server classpath, the ejb will have no problem finding it.
    Either you have a typo and the class is not in the classpath. You can prove
    this by running
    javap on the class using the same classpath as your startWebLogic script.
    Or, as I suggested in the last response, it's not really standalone. The
    jar probably has a
    dependence on some classes in the ejb.jar.
    -- Rob
    "L. W. Xu" wrote:
    Rob,
    It is a standalone generic jar which has some classes in it. The ejb justcan't find
    it.
    I have a simple java program which uses it and it runs fine.
    Thanks.
    L. W. Xu
    Rob Woollen <[email protected]> wrote:
    If your utility.jar is standalone, then your approach is fine. However,
    it sounds like it
    is referencing a class that's only
    available in your ejb.jar. That won't work.
    -- Rob
    "L. W. Xu" wrote:
    I have a session bean trying to access a utility class in the lib directory(same
    directory as weblogic.jar). I have packaged it into a jar file and
    set
    the classpath
    pointing to the file in the startWeblogic.cmd file. I compiled and
    depolyed
    the session
    bean and it runs fine until it starts to access the class. I got NoClassFoundException.
    I have tried to shut down and restart the server without any success.Anyone can
    help me this this?
    I know I can package the utility into the same jar as my ejb. But I
    don't
    want to
    do it because it is going to be everywhere. What is the right way of
    doing
    it?
    Thanks in advance.
    L.W.Xu--
    AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnWebLogic.com
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    If your utility.jar is standalone, then your approach is fine. However,
    it sounds like it is referencing a class that's only
    <br>available in your ejb.jar. That won't work.
    <p>-- Rob
    <p>"L. W. Xu" wrote:
    <blockquote TYPE=CITE>I have a session bean trying to access a utility
    class in the lib directory (same
    <br>directory as weblogic.jar). I have packaged it into a jar file and
    set the classpath
    <br>pointing to the file in the startWeblogic.cmd file. I compiled and
    depolyed the session
    <br>bean and it runs fine until it starts to access the class. I gotNoClassFoundException.
    <br>I have tried to shut down and restart the server without any success.
    Anyone can
    <br>help me this this?
    <p>I know I can package the utility into the same jar as my ejb. ButI
    don't want to
    <br>do it because it is going to be everywhere. What is the right wayof
    doing it?
    <p>Thanks in advance.
    <p>L.W.Xu</blockquote>
    <pre>--
    AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnWebLogic.com</pre>
    </html>
    AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    http://learnWebLogic.com
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
    If it's in the server classpath, the ejb will have no problem finding it.
    <p>Either you have a typo and the class is not in the classpath. 
    You can prove this by running javap on the class using the same classpath
    as your startWebLogic script.
    <p>Or, as I suggested in the last response, it's not really standalone.  
    The jar probably has a dependence on some classes in the ejb.jar.
    <p>-- Rob
    <br> 
    <p>"L. W. Xu" wrote:
    <blockquote TYPE=CITE>Rob,
    <p>It is a standalone generic jar which has some classes in it. The ejb
    just can't find
    <br>it.
    <p>I have a simple java program which uses it and it runs fine.
    <p>Thanks.
    <p>L. W. Xu
    <p>Rob Woollen <[email protected]> wrote:
    <br>>
    <br>>
    <br>>If your utility.jar is standalone, then your approach is fine. 
    However,
    <br>>it sounds like it
    <br>>is referencing a class that's only
    <br>>available in your ejb.jar.  That won't work.
    <br>>
    <br>>-- Rob
    <br>>
    <br>>"L. W. Xu" wrote:
    <br>>
    <br>>> I have a session bean trying to access a utility class in the lib
    directory
    <br>>(same
    <br>>> directory as weblogic.jar). I have packaged it into a jar file and
    set
    <br>>the classpath
    <br>>> pointing to the file in the startWeblogic.cmd file. I compiled and
    depolyed
    <br>>the session
    <br>>> bean and it runs fine until it starts to access the class. I got
    NoClassFoundException.
    <br>>> I have tried to shut down and restart the server without any success.
    <br>>Anyone can
    <br>>> help me this this?
    <br>>>
    <br>>> I know I can package the utility into the same jar as my ejb. But
    I don't
    <br>>want to
    <br>>> do it because it is going to be everywhere. What is the right way
    of doing
    <br>>it?
    <br>>>
    <br>>> Thanks in advance.
    <br>>>
    <br>>> L.W.Xu
    <br>>
    <br>>--
    <br>>
    <br>>----------------------------------------------------------------------
    <br>>
    <br>>AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    <br>>
    <br>>by Michael Girdley, Rob Woollen, and Sandra Emerson
    <br>>
    <br>>http://learnWebLogic.com
    <br>>
    <br>>
    <br>>
    <br>>
    <br>><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <br>><html>
    <br>>If your utility.jar is standalone, then your approach is fine. 
    However,
    <br>>it sounds like it is referencing a class that's only
    <br>><br>available in your ejb.jar.  That won't work.
    <br>><p>-- Rob
    <br>><p>"L. W. Xu" wrote:
    <br>><blockquote TYPE=CITE>I have a session bean trying to access a
    utility
    <br>>class in the lib directory (same
    <br>><br>directory as weblogic.jar). I have packaged it into a jar file
    and
    <br>>set the classpath
    <br>><br>pointing to the file in the startWeblogic.cmd file. I compiled
    and
    <br>>depolyed the session
    <br>><br>bean and it runs fine until it starts to access the class.
    I got NoClassFoundException.
    <br>><br>I have tried to shut down and restart the server without any
    success.
    <br>>Anyone can
    <br>><br>help me this this?
    <br>><p>I know I can package the utility into the same jar as my ejb.
    But I
    <br>>don't want to
    <br>><br>do it because it is going to be everywhere. What is the right
    way of
    <br>>doing it?
    <br>><p>Thanks in advance.
    <br>><p>L.W.Xu</blockquote>
    <br>>
    <br>><pre>--
    <br>>
    <br>>----------------------------------------------------------------------
    <br>>
    <br>>AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    <br>>
    <br>>by Michael Girdley, Rob Woollen, and Sandra Emerson
    <br>>
    <br>>http://learnWebLogic.com"><a
    href="http://learnWebLogic.com">http://learnWebLogic.com</a></A></pre>
    <br>> </html>
    <br>>
    <br>></blockquote>
    <pre>-- 
    AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
    by Michael Girdley, Rob Woollen, and Sandra Emerson
    <A HREF="http://learnWebLogic.com">http://learnWebLogic.com</A></pre>
     </html>

  • Problem Calling a Java class from PLSQL function

    We are calling a Java class through oracle function as
    FUNCTION CalculateAMW (contributorid IN Number,
    fromdate IN Date,OHorAnncoverage in Number,
    OHAnncoverage in Number,
    AppStatus in Number,
    Status in Number)
    RETURN Number
    AS LANGUAGE JAVA
    NAME 'AMWCalculations.calculateAMW
    (long,java.sql.Timestamp,long,long,long,long) return double';
    on execution of this function the sql prompt for the 1st time it is giving the output
    but
    if reexecute it is throwing and error ORA - 932 : Inconsistent
    datatypes.
    Recompiling the java class then it works for the 1st time and the next
    time
    we execute it throws error as explained above.
    What could be the problem.
    Thanks
    Nanda Kishore

    any idea???Yes, you are in the wrong forum, this is a Java forum, you have an ASP question, so i suggest you visit an ASP forum/site

Maybe you are looking for

  • Difference in the minutes on the subscription

    Hello, I bought a 400 minutes subscription. According to my call history I only used 136.12 minutes. But in my account it's written that I have only 192 minutes left, when I suppose to have 263.88 minutes. Does anybody know why this difference betwee

  • Getting exceptions while trying to set index

    I'm trying to create an index using the following code: NamedCache cache = this.getPrimaryDAO().getCache(); cache.addIndex(new ReflectionExtractor("getStateCode"), true, null); I get the following Unsupported operation exception: java.lang.Unsupporte

  • How to impdp when I do not have the source tablespace.

    I have a situation where a may not know what a client's source tablespace is. I only know the source schema. What I need to be able to do is import the data into another schema(that's easy with remap_schema). What i need impdp to do is to place the '

  • Final Cut Pro 5.1 and youtube

    I am trying to find out the best work flow for you tube Hd video. I have a JVC GYHD 720P and SONY a1J and Kona 3 card and Mac Pro 2.8 8 core. Can anyone tell me the best work flow for you tube HD. ^_^

  • Location of iTunes Preferences or Cookie files?

    Does anyone know where the file(s) that tell iTunes it's been setup before are? Every once in a while it seems to forget and runs the Setup program. I basically skip/uncheck all the setup options and it still has all my files & podcast subscriptions