Search Results

Search found 985 results on 40 pages for 'instantiate'.

Page 11/40 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • facescontext.getcurrentinstance returns nullpointerexception

    - by mvg
    I am creating a Spring based JSF application, where I am getting FacesContext.getCurrentInstance which returns null. Here is my Java code public static ServletContext getServletContext() { return (ServletContext) FacesContext.getCurrentInstance() .getExternalContext().getContext(); } This is the stack trace of my error SEVERE: Exception sending context initialized event to listener instance of class org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dbSettingsServiceTarget' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.baytalkitec.smartcall.service.impl.DbSettingsServiceImpl]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:883) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:839) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409) at java.security.AccessController.doPrivileged(Native Method) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381) at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardHost.start(StandardHost.java:785) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:519) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:581) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414) Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.baytalkitec.smartcall.service.impl.DbSettingsServiceImpl]: Constructor threw exception; nested exception is java.lang.NullPointerException at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:115) at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:877) ... 31 more Caused by: java.lang.NullPointerException at com.smartcall.util.FacesUtil.getServletContext(FacesUtil.java:21) at com.smartcall.util.SpringApplicationContextUtil.init(SpringApplicationContextUtil.java:21) at com.smartcall.util.SpringApplicationContextUtil.<init>(SpringApplicationContextUtil.java:16) at com.smartcall.service.impl.DbSettingsServiceImpl.init(DbSettingsServiceImpl.java:17) at com.smartcall.service.impl.DbSettingsServiceImpl.<init>(DbSettingsServiceImpl.java:12) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100) ... 33 more and hence due to this error Server console in Eclipse reports that application failed to startup due to previous errors My web.xml file <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>smartcall2.0</display-name> <context-param> <param-name>javax.faces.STATE_SAVING_METHOD</param-name> <param-value>server</param-value> </context-param> <context-param> <param-name>javax.faces.CONFIG_FILES</param-name> <param-value> /WEB-INF/faces-config.xml,/WEB-INF/faces-managed-bean.xml,/WEB-INF/faces-navigation.xml </param-value> </context-param> <listener> <listener-class> com.sun.faces.config.ConfigureListener </listener-class> </listener> <listener> <listener-class> org.springframework.web.context.ContextLoaderListener </listener-class> </listener> <filter> <display-name>RichFaces Filter</display-name> <filter-name>richfaces</filter-name> <filter-class>org.ajax4jsf.Filter</filter-class> </filter> <filter-mapping> <filter-name>richfaces</filter-name> <servlet-name>Faces Servlet</servlet-name> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> <dispatcher>INCLUDE</dispatcher> </filter-mapping> <servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.xhtml</param-value> </context-param> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>*.jsf</url-pattern> </servlet-mapping> <session-config> <session-timeout>180</session-timeout> </session-config> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> I am not clear whether this error belongs to Spring or JSF or Eclipse. I am using Eclipse Galileo, JSF 1.2,Spring 3 Please help Thanks in advance

    Read the article

  • Can I Create A Generic Method of a Type of Interface?

    - by DaveDev
    Is it possible to create a generic method with a signature like public static string MyMethod<IMyTypeOfInterface>(object dataToPassToInterface) { // an instance of IMyTypeOfInterface knows how to handle // the data that is passed in } Would I have to instantiate the Interface with (T)Activator.CreateInstance();?

    Read the article

  • Using Guice with circular dependencies

    - by Yury Litvinov
    Consider this simple example. Class A { B b; A() { this.b = new B(this); } } In this example instance A knows about instance B, and instance B knows about instance A. My question is: how to instantiate instance A with Guice, i.e. how to make Guice take care of this complex circle dependencies?

    Read the article

  • joomla component error

    - by ankur
    I have installed a joomla component and its working quite good but i am facing the problem that whenever i am trying to send mail by using the component iam always getting the message "Could not instantiate mail function." Please help me in getting the solution to the problem

    Read the article

  • beneficial in terms of performance

    - by Usama Khalil
    Hi, is it better to declare Webservice class object instances as static as the .asmx webservice classes have only static methods. what i want is that i declare and instantiate webservice asmx class as static in aspx Page Behind Class. and on every event call on that page i could perform operation against webservice methods. is it beneficial in terms of performance? Thanks Usama

    Read the article

  • how to invoke a webservice from one container in another container in glassfish

    - by vinny
    I have webservices deployed on two containers in two separate servers A and B. A webMethod in 'Server A' needs to invoke a webmethod in 'Server B'. I have created a client stub for Sever B. Im trying to make 'Server A' use this client stub and talk to Server B. I get an exception while trying to instantiate the port object specifically at : service.getABCBeanPort(); (using JAX-WS library) Is my approach correct? Is there any better way of invoking a webservice on a remote server?

    Read the article

  • How to make JCarousel Vertical Scroller reverse scroll?

    - by Scott Faisal
    I was able to instantiate a working scroller using jQuery Jcarousel however I need it to reverse scroll. For example right now I have: jQuery(document).ready(function() { jQuery('#mycarousel').jcarousel({ auto: 1, vertical: true, scroll: 1, animation: "slow", wrap: 'last', initCallback: mycarousel_initCallback }); }); What do I need to do to make the items scroll upwards instead of downwards? Thank You in advance

    Read the article

  • I am faceing problem with this error

    - by Sanjeev
    I am using Struts application while running welcome page is run successfully after that the following error is appear org.apache.jasper.JasperException: Failed to load or instantiate TagLibraryValidator class: org.apache.taglibs.standard.tlv.JstlCoreTLV any idea whats the problem.

    Read the article

  • PHP cannot find .net assembly in the .net-4 GAC

    - by stacker
    <?php $console = new DOTNET("ProjectX.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=KeyTokenHere-i used a real value here", "ProjectX.Core.Services.ServicX"); echo '1'; ?> The error message: Fatal error: Uncaught exception 'com_exception' with message 'Failed to instantiate .Net object [CreateInstance] [0x80070002] The system cannot find the file specified. What's the problem can be?

    Read the article

  • Load an Assembly from Bin in ASP.NET

    - by Pete Michaud
    I have a file name, like "Foo.dll," for a library that I know is in the bin directory. I want to create an Assembly object for it. I'm trying to instantiate this object from a class that's not a page, so I don't have the Request object to get the path. How do I get the path I need to use Assembly.Load()?

    Read the article

  • How to perform duplicate key validation using entlib (or DataAnnotations), MVC, and Repository pattern

    - by olivehour
    I have a set of ASP.NET 4 projects that culminate in an MVC (3 RC2) app. The solution uses Unity and EntLib Validation for cross-cutting dependency injection and validation. Both are working great for injecting repository and service layer implementations. However, I can't figure out how to do duplicate key validation. For example, when a user registers, we want to make sure they don't pick a UserID that someone else is already using. For this type of validation, the validating object must have a repository reference... or some other way to get an IQueryable / IEnumerable reference to check against other rows already in the DB. What I have is a UserMetadata class that has all of the property setters and getters for a user, along with all of the appropriate DataAnnotations and EntLib Validation attributes. There is also a UserEntity class implemented using EF4 POCO Entity Generator templates. The UserEntity depends on UserMetadata, because it has a MetadataTypeAttribute. I also have a UserViewModel class that has the same exact MetadataType attribute. This way, I can apply the same validation rules, via attributes, to both the entity and viewmodel. There are no concrete references to the Repository classes whatsoever. All repositories are injected using Unity. There is also a service layer that gets dependency injection. In the MVC project, service layer implementation classes are injected into the Controller classes (the controller classes only contain service layer interface references). Unity then injects the Repository implementations into the service layer classes (service classes also only contain interface references). I've experimented with the DataAnnotations CustomValidationAttribute in the metadata class. The problem with this is the validation method must be static, and the method cannot instantiate a repository implementation directly. My repository interface is IRepository, and I have only one single repository implementation class defined as EntityRepository for all domain objects. To instantiate a repository explicitly I would need to say new EntityRepository(), which would result in a circular dependency graph: UserMetadata [depends on] DuplicateUserIDValidator [depends on] UserEntity [depends on] UserMetadata. I've also tried creating a custom EntLib Validator along with a custom validation attribute. Here I don't have the same problem with a static method. I think I could get this to work if I could just figure out how to make Unity inject my EntityRepository into the validator class... which I can't. Right now, all of the validation code is in my Metadata class library, since that's where the custom validation attribute would go. Any ideas on how to perform validations that need to check against the current repository state? Can Unity be used to inject a dependency into a lower-layer class library?

    Read the article

  • Parser that accepts Scala Identifiers?

    - by Mirko Stocker
    I was wondering whether the standard Scala parser combinators contain a parser that accepts the same identifiers that the Scala language itself also accepts (as specified in the Scala Language Specification, Section 1.1). The StdTokenParsers trait has an ident parser, but it rejects identifiers like empty_?. (If there is indeed no such parser, I could also just instantiate the Scala parser itself, but that wouldn't be as lightweight anymore.)

    Read the article

  • C++ MPL or_, and_ implementations

    - by KRao
    Hi, I am trying to read the boost headers to figure out how they managed to implement the or_<...> and and_<...> metafunctions so that: 1) They can have an arbitrary number of arguments (ok, say up to 5 arguments) 2) They have short circuit behavior, for example: or_<false_,true_,...> does not instantiate whatever is after true_ (so it can also be declared but not defined) Unfortunately the pre-processor metaprogramming is making my task impossible for me :P Thank you in advance for any help/suggestion.

    Read the article

  • Is there any way to add references without recompiling in .NET?

    - by Jader Dias
    I am using a IoC Container (Castle Windsor) to instantiate classes accordingly to the configuration file. If I want to add classes from a new dll that didn't exist when I compiled the project, there is any way to do that without recompiling? Edit: As this project is a Service Host for WCF service, and the classes that I want to include after compilation are WCF Services I would like also to know if I can include endpoint information about new services without recompiling.

    Read the article

  • External project reference in android

    - by bryan costanich
    Hi all, I have an android application that utilizes another project as a project reference. i've gone into the application options, build path, and then selected the project in project references. everything builds and deploys fine, but when i try to run the application and instantiate a class in that project, i'm getting a java.lang.NoClassDefFoundError errrrrr. i'm no java project expert, so i assume i've cocked something simple up. any ideas?

    Read the article

  • Objects With No Behavior

    - by Patrick Donovan
    I've been teaching myself object oriented programming and I'm thinking about a situation where I have an object "Transaction", that has quite a few properties to it like account, amount, date, currency, type, etc. I never plan to mutate these data points, and calculation logic will live in other classes. My question is, is it poor Python design to instantiate thousands of objects just to hold data? I find the data far easier to work with embedded in a class rather than trying to cram it into some combination of data structures.

    Read the article

  • Why does C# allow abstract class with no abstract members?

    - by fatcat1111
    The C# spec, section 10.1.1.1, states: An abstract class is permitted (but not required) to contain abstract members. This allows me to create classes like this: public abstract class A { public void Main() { // it's full of logic! } } This is really a concrete class; it's only abstract in so far as one can't instantiate it. If inheritors don't actually have to provide implementation, then why call it abstract?

    Read the article

  • Ninject: Controller Constructor with int argument

    - by Fleents
    How can you instantiate a Controller that has an int argument? Using Ninject.. My HomeController has a constructor like this: private int _masterId; Public HomeController(int masterId){ _masterId = masterId; } I created a controller factory like this: public class NinjectControllerFactory : DefaultControllerFactory { IKernel kernel = new StandardKernel(new ExampleConfigModule()); protected override IController GetControllerInstance(Type controllerType) { return controllerType == null ? null : (IController)kernel.Get(controllerType, 1); } }

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >