• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [ANN] WOInject 1.0
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ANN] WOInject 1.0


  • Subject: Re: [ANN] WOInject 1.0
  • From: Farrukh Ijaz <email@hidden>
  • Date: Fri, 13 Apr 2012 17:05:02 +0300

Hi Ron,

See my comments below:

On 2012-04-13, at 10:55 AM, Ron X wrote:

hi

public class Application extends InjectableApplication {
    private static Logger log = Logger.getLogger(Application.class);
   
    public static void main(String[] argv) {
        WOInject.init("com.legalsounds.Application", argv);
    }

    @Facebook Socialable socialPerson;
   
    public Application() {

        Injector injector = injector();
        socialPerson = injector.getInstance(Socialable.class);

You are confusing the injector by providing Socialable.class, it must be 

socialPerson = injector.getInstance(FacebookPerson.class);

I tell you the reason:

E.g. you've another bindable annotation named Twitter and you've TwitterPerson extending Socialable, what you expect the injector to return when you call injector.getInstance(Socialble.class) when it has no means to understand what implementation you're looking for?

Hope this helps.

Farrukh

..............fails at this line............

    @Override
    protected Module[] modules() {
        return new Module[] { new SocialModule() };
    }
}

public class SocialModule extends AbstractModule {

    @Override
    protected void configure() {

bind(Socialable.class).annotatedWith(Facebook.class).to(FacebookPerson.class).in(WOScopes.SESSION);

    }

}

public class FacebookPerson implements Socialable {
   
    private static Logger log = Logger.getLogger(FacebookPerson.class);

    @Override
    public void send(List<Socialable> socialPersonList) {
        log.info(this);       
    }

}

stack trace:

WARN  32.7 MB used/48.36 MB free [ProcessChangesQueue] (ERXNSLogLog4jBridge.java:43)  - A fatal exception occurred: Guice configuration errors:

1) No implementation for com.ronx.module.Socialable was bound.
  while locating com.ronx.module.Socialable

1 error
[2012-4-13 0:49:49 PDT] <ProcessChangesQueue> com.google.inject.ConfigurationException: Guice configuration errors:

1) No implementation for com.ronx.module.Socialable was bound.
  while locating com.ronx.module.Socialable

1 error
    at com.google.inject.internal.InjectorImpl.getProvider(InjectorImpl.java:1004)

why it happens?

13 апреля 2012 г. 0:05 пользователь Henrique Prange <email@hidden> написал:
Hi Ron,

On 12/04/2012, at 08:04, Ron X wrote:

> please tell me - how you start app with woinject?
> i can't do that!
>

Your Application class should look like this:

package com.ronx;

import com.woinject.InjectableApplication;
import com.woinject.WOInject;

public class Application extends InjectableApplication {
   public static void main(String[] args) {
       WOInject.init("com.ronx.Application", args);
   }
   ...
}

> everytime i have
> Exception in thread "main" java.lang.NoClassDefFoundError: com/ronx/Application
> Caused by: java.lang.ClassNotFoundException: com.ronx.Application
>     at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
>     at java.security.AccessController.doPrivileged(Native Method)
>     at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
>     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>     at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
>
> or if i comment         ERXApplication.main(argv, Application.class);
>

You should not start your application with the ERXApplication class when using WOInject.

Cheers,

Henrique

Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Re: [ANN] WOInject 1.0 (From: Paul Hoadley <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: Henrique Prange <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: "Ricardo J. Parada" <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: Henrique Prange <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: Ramsey Gurley <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: Lachlan Deck <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: Henrique Prange <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: Ron X <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: Henrique Prange <email@hidden>)
 >Re: [ANN] WOInject 1.0 (From: Ron X <email@hidden>)

  • Prev by Date: Re: limiting All Queries in D2W
  • Next by Date: Re: WO 2012 by Apple?
  • Previous by thread: Re: [ANN] WOInject 1.0
  • Next by thread: Re: [ANN] WOInject 1.0
  • Index(es):
    • Date
    • Thread