You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geronimo.apache.org by "Jacky Liu (JIRA)" <ji...@apache.org> on 2011/05/26 04:12:47 UTC

[jira] [Commented] (GERONIMO-5979) Some objects to be injected were not found in jndi

    [ https://issues.apache.org/jira/browse/GERONIMO-5979?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13039483#comment-13039483 ] 

Jacky Liu commented on GERONIMO-5979:
-------------------------------------

I choose Geronimo samples "calculator" to demonstrate my ideas.

Firstly, in ..\calculator\calculator-ejb\src\main\java\org\apache\geronimo\samples\slsb\calculator\calculator.java add

import javax.ejb.Local;
import javax.ejb.Remote;

Secondly, add

@Local(CalculatorLocal.class)
@Remote(CalculatorRemote.class)

to explicitly implicate EJB local business interface use CalcluatorLocal.class as an interface and EJB remote business interface use CalculatorRemote.class as an interface.

Then with "import org.apache.geronimo.samples.slsb.calculator.CalculatorLocal;" in ..\calculator\calculator-war\src\main\java\org\apache\geronimo\samples\calculator\CalculatorServlet.java , we CAN use @EJB to inject ejb object, that is, "private CalculatorLocal calc = null;" executes successfully.

With that, bug fixed.

BUT in Geronimo v2.1, EJB local business interface CAN BE FOUND without explicitly implication. So there's still a problem here.

> Some objects to be injected were not found in jndi
> --------------------------------------------------
>
>                 Key: GERONIMO-5979
>                 URL: https://issues.apache.org/jira/browse/GERONIMO-5979
>             Project: Geronimo
>          Issue Type: Bug
>      Security Level: public(Regular issues) 
>          Components: sample apps
>    Affects Versions: 3.0
>         Environment: Windows XP SP3 x86
> IBM jdk Java60
> Geronimo build on 20110525
>            Reporter: Jacky Liu
>            Priority: Minor
>              Labels: sample
>         Attachments: calculator-ear.rar, calculator-ejb.rar, calculator-war.rar
>
>
> 1. start Geronimo
> 2. deploy calculator-ear-3.0-SNAPSHOT.ear
> 3. go to http://localhost:8080/calculator/ and check the add or multiply function
> ERROR OCCURS!!
> The following error message is displayed when calculator-ear-3.0-SNAPSHOT.ear is deployed.
> 2011-05-26 09:55:51,505 WARN  [startup] Unresolved ejb reference "org.apache.geronimo.samples.calculator.CalculatorServlet/calc" in bean "GeronimoEnc"
> .  Will attempt resolution again at runtime.
> 2011-05-26 09:55:51,771 WARN  [startup] Unresolved ejb reference "org.apache.geronimo.samples.calculator.CalculatorServlet/calc" in bean "GeronimoEnc"
> .  Will attempt resolution again at runtime.
> 2011-05-26 09:55:51,786 WARN  [startup] Unresolved ejb reference "org.apache.geronimo.samples.calculator.CalculatorServlet/calc" in bean "GeronimoEnc"
> .  Will attempt resolution again at runtime.
>  2011-05-26 09:56:26,833 ERROR [[/calculator]] Servlet /calculator threw load() exception
> java.lang.InstantiationException: Some objects to be injected were not found in jndi: [javax.naming.NameNotFoundException: No EJB found for reference
> "comp/env/org.apache.geronimo.samples.calculator.CalculatorServlet/calc": ejb-link=null, interface=null]
>         at org.apache.geronimo.j2ee.annotation.Holder.newInstance(Holder.java:174)
>         at org.apache.geronimo.tomcat.TomcatInstanceManager.newInstance(TomcatInstanceManager.java:74)
>         at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1048)
>         at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:996)
>         at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4741)
>         at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5062)
>         at org.apache.catalina.core.StandardContext$3.call(StandardContext.java:5057)
>         at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:314)
>         at java.util.concurrent.FutureTask.run(FutureTask.java:149)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:897)
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:919)
>         at java.lang.Thread.run(Thread.java:736)

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira