ejb-jar.xml文件如下:<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar
xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
    version="3.0">
    
   <description>jBoss test application </description>
   <display-name>Test</display-name>
    
<enterprise-beans>
<session>
<ejb-name>Injection</ejb-name>
<ejb-class>ioc.ejbIoc.Injection</ejb-class>
<session-type>Stateless</session-type>
<ejb-local-ref>
<ejb-ref-name>ejb3/Injection</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<local>ioc.ejbIoc.InjectionLocal</local>
</ejb-local-ref>
</session>
</enterprise-beans>
</ejb-jar>
java文件如下(ejb3.0的):package ioc.ejbIoc;
import javax.ejb.Local;
@Local
public interface InjectionLocal {
public String say();
}package ioc.ejbIoc;
import javax.ejb.Stateless;
@Stateless
public class Injection implements InjectionLocal {
public String say() {
return "这句话是Ejb注入";
}
}package ioc.ejbIoc;
import javax.ejb.Local;
@Local
public interface SayLocal {
public String say();
}
package ioc.ejbIoc;import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
import javax.naming.NamingException;@Stateless
public class Say implements SayLocal {
public String say() {

//2通过JNDI查找,需先建立ejb-jar.XML文件,然后将其放在META-INF文件夹中
InitialContext ctx;
try {
ctx = new InitialContext();
InjectionLocal i2 = (InjectionLocal)ctx.lookup("java:comp/env/ejb3/Injection");
return i2.say();
} catch (NamingException e) {
System.out.println("JNDI查找出错" + e.getMessage());
return null;
}
}}在将项目的jar放进Jboss时加载ejb-jar.xml文件就出错了:
17:30:40,546 WARN  [HDScanner] Failed to process changes
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):DEPLOYMENTS MISSING DEPENDENCIES:
  Deployment "jboss.j2ee:jar=Ejb.jar,name=Injection,service=EJB3" is missing the following dependencies:
    Dependency "<UNKNOWN jboss.j2ee:jar=Ejb.jar,name=Injection,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'jndi:Injection/local-ioc.ejbIoc.InjectionLocal' **")
  Deployment "jboss.j2ee:jar=Ejb.jar,name=Injection,service=EJB3_endpoint" is missing the following dependencies:
    Dependency "jboss.j2ee:jar=Ejb.jar,name=Injection,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
  Deployment "jboss.j2ee:jar=Ejb.jar,name=Say,service=EJB3" is missing the following dependencies:
    Dependency "<UNKNOWN jboss.j2ee:jar=Ejb.jar,name=Say,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'jndi:Injection/local-ioc.ejbIoc.InjectionLocal' **")
  Deployment "jboss.j2ee:jar=Ejb.jar,name=Say,service=EJB3_endpoint" is missing the following dependencies:
    Dependency "jboss.j2ee:jar=Ejb.jar,name=Say,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")DEPLOYMENTS IN ERROR:
  Deployment "<UNKNOWN jboss.j2ee:jar=Ejb.jar,name=Injection,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jndi:Injection/local-ioc.ejbIoc.InjectionLocal' **
  Deployment "<UNKNOWN jboss.j2ee:jar=Ejb.jar,name=Say,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'jndi:Injection/local-ioc.ejbIoc.InjectionLocal' ** at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993)
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.checkComplete(MainDeployerAdapter.java:128)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:369)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)