Git Product home page Git Product logo

Comments (13)

jack-jjy avatar jack-jjy commented on June 22, 2024

also:

org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type WeldListener with qualifiers @Default
    at injection point [BackedAnnotatedField] @Inject @ApplicationScoped private org.jglue.cdiunit.ContextController.listener
    at org.jglue.cdiunit.ContextController.listener(ContextController.java:0)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:368)
    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:289)
    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135)
    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:166)
    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:514)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)

from cdi-unit.

BrynCooke avatar BrynCooke commented on June 22, 2024

Is this outside of a unit test?
Please put your CDI-Unit dependency in test scope:

            <groupId>org.jglue.cdi-unit</groupId>
            <artifactId>cdi-unit</artifactId>
            <version>3.0.1</version>
<scope>test</scope>
        </dependency> 

Also in HEAD the CDI-Unit dependency does not participate in bean discovery outside of a unit test.

from cdi-unit.

jack-jjy avatar jack-jjy commented on June 22, 2024

I chanage like this

  <dependency>
        <groupId>org.jboss.weld.se</groupId>
        <artifactId>weld-se-core</artifactId>
        <version>2.1.2.Final</version>
    </dependency>
      <dependency>
        <groupId>org.jglue.cdi-unit</groupId>
        <artifactId>cdi-unit</artifactId>
        <version>3.0.1</version>
        <scope>test</scope>
    </dependency> 

when i do the test

        @RunWith(CdiRunner.class)
        public class CategoryManagerTest2 {

            @Inject
            Manager<Category> manager;

            @Test
            public void test(){
                Category data = new Category();
                data.name = "xx";
                manager.create(data);
            } 
        }

i will always get the failue Trace

org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Manager<Category> with qualifiers @Default
at injection point [UnbackedAnnotatedField] @Inject cn.tt100.rms.impl.persistence.CategoryManagerTest2.manager
at cn.tt100.rms.impl.persistence.CategoryManagerTest2.manager(CategoryManagerTest2.java:0)
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:368)
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:289)
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135)
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:166)
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:514)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)

I can not inject any Bean

from cdi-unit.

BrynCooke avatar BrynCooke commented on June 22, 2024

The strange thing is that your call stack doesn't have junit in it. Are you running this outside a test e.g. by starting weld manually?

from cdi-unit.

BrynCooke avatar BrynCooke commented on June 22, 2024

For that matter your call stack doesn't have CDI-Unit in it either....

from cdi-unit.

jack-jjy avatar jack-jjy commented on June 22, 2024

No,I do not starting weld manually,I only running the @test,and if I do like this,it will be ok

        CategoryManager manager;

        @BeforeClass
        public static void setUpClass(){
            weld = new Weld();
            weldContainer = weld.initialize();
            System.out.println("weld init");
        }

        @AfterClass
        public static void teardownClass() {
            weld.shutdown();
            System.out.println("weld teardown");
        }

        @Override
        @Before
        public void init() {
            manager = weldContainer.instance().select(CategoryManager.class).get();
        }

        @Override
        @Test()
        public void test() {

            Category data1 = new Category();
            data1.name = "xx";
            manager.create(data1);

        }

from cdi-unit.

BrynCooke avatar BrynCooke commented on June 22, 2024

OK. Given your least stack trace I am guessing that Category is an interface or abstract class.
You will need to tell the container about the implementing class using one of the discovery annotations.

http://jglue.org/cdi-unit-user-guide/#controllingEnvironment

from cdi-unit.

jack-jjy avatar jack-jjy commented on June 22, 2024

In addition to,when i do running @test,the weld not starting Seemingly!

    17:09:23.709 [main] DEBUG org.jboss.weld.Bootstrap - WELD-000100: Weld initialized. Validating beans
    17:09:23.716 [weld-worker-3] WARN  org.jboss.weld.Validator - WELD-001440: Scope type @javax.enterprise.context.ApplicationScoped() used on injection point [BackedAnnotatedField] @Inject @ApplicationScoped private org.jglue.cdiunit.ContextController.listener

yea,CategoryManager is a class implements interface Manager.I try like this

@RunWith(CdiRunner.class)
@AdditionalClasses(Manager.class) 
public class CategoryManagerTest2 {

    @Inject
    CategoryManager manager;

    @Test
    public void test(){
        Category data = new Category();
        data.name = "xx";
        manager.create(data);
    }
}

from cdi-unit.

BrynCooke avatar BrynCooke commented on June 22, 2024

17:09:23.716 [weld-worker-3] WARN org.jboss.weld.Validator - WELD-001440: Scope type @javax.enterprise.context.ApplicationScoped() used on injection point [BackedAnnotatedField] @Inject @ApplicationScoped private org.jglue.cdiunit.ContextController.listener

This is a warning, I've corrected the code but you can ignore it. Weld should still be starting fine.

from cdi-unit.

jack-jjy avatar jack-jjy commented on June 22, 2024

Weld not starting after the warning,i did not kown why...

from cdi-unit.

BrynCooke avatar BrynCooke commented on June 22, 2024

Is there a stack trace?

from cdi-unit.

BrynCooke avatar BrynCooke commented on June 22, 2024

On 15/07/14 10:42, 蒋建洋 wrote:

no!when weld running to this warning,there will be nothing after.


Reply to this email directly or view it on GitHub
#58 (comment).

Is your test passing? CDI-Unit shuts down weld after each test.

Attached is what I can piece together from your test. It seems to work
for me

from cdi-unit.

jack-jjy avatar jack-jjy commented on June 22, 2024

It really work!Ok!The cdi-unit work normally,there are some other problems about the EntityManager...so thank you.

from cdi-unit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.