Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/354.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 无法在WebLogic server 12c中部署EJB_Java_Ejb_Weblogic_Jndi_Weblogic12c - Fatal编程技术网

Java 无法在WebLogic server 12c中部署EJB

Java 无法在WebLogic server 12c中部署EJB,java,ejb,weblogic,jndi,weblogic12c,Java,Ejb,Weblogic,Jndi,Weblogic12c,我创建了一个EJB,创建了一个jar(包含必需的EJB-jar.xml和weblogic-EJB-jar.xml文件) 当我使用管理控制台将这个jar添加到WebLogicServer12c时,我遇到了以下问题- Issues were encountered while parsing this deployment to determine module type. Assuming this is a library deployment. 因此,我的ejb没有显示在jndi树视图中。因

我创建了一个EJB,创建了一个jar(包含必需的EJB-jar.xml和weblogic-EJB-jar.xml文件)

当我使用管理控制台将这个jar添加到WebLogicServer12c时,我遇到了以下问题-

Issues were encountered while parsing this deployment to determine module type. Assuming this is a library deployment.
因此,我的ejb没有显示在jndi树视图中。因此,我无法进行jndi查找。请纠正我的错误

ejb-jar.xml-

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
    <display-name>ProductManager</display-name>
    <enterprise-beans>
    <session>
    <ejb-name>Product</ejb-name>    
    <home>rohit.ProductHome</home>
    <remote>rohit.ProductRemote</remote>
    <ejb-class>rohit.ProductBean</ejb-class>    
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>  
    </enterprise-beans>
    <ejb-client-jar>ProductManagerClient.jar</ejb-client-jar>

</ejb-jar>
<?xml version=“1.0? encoding=“UTF-8??>
<weblogic-ejb-jar

xmlns=“http://www.bea.com/ns/weblogic/90? xmlns:j2ee=“http://java.sun.com/xml/ns/j2ee” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd”>

<welogic-enterprise-bean>
<ejb-name>Product</ejb-name>
<jndi-name>Product</jndi-name>
<stateless-session-descriptor></stateless-session-descriptor>
</welogic-enterprise-bean>
</weblogic-ejb-jar>

产品经理
产品
罗希特产品之家
rohit.ProductRemote
rohit.ProductBean
无国籍
容器
ProductManagerClient.jar
weblogic-ejb-jar.xml-

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar id="ejb-jar_ID">
    <display-name>ProductManager</display-name>
    <enterprise-beans>
    <session>
    <ejb-name>Product</ejb-name>    
    <home>rohit.ProductHome</home>
    <remote>rohit.ProductRemote</remote>
    <ejb-class>rohit.ProductBean</ejb-class>    
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>  
    </enterprise-beans>
    <ejb-client-jar>ProductManagerClient.jar</ejb-client-jar>

</ejb-jar>
<?xml version=“1.0? encoding=“UTF-8??>
<weblogic-ejb-jar

xmlns=“http://www.bea.com/ns/weblogic/90? xmlns:j2ee=“http://java.sun.com/xml/ns/j2ee” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=“http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-ejb-jar.xsd”>

<welogic-enterprise-bean>
<ejb-name>Product</ejb-name>
<jndi-name>Product</jndi-name>
<stateless-session-descriptor></stateless-session-descriptor>
</welogic-enterprise-bean>
</weblogic-ejb-jar>

产品
产品

与您的想法相反,ejb-jar.xml和weblogic-ejb-jar.xml文件不是必需的。作为主要的部署描述符,它们是2004年的古老产物

如果你重视你的理智,你的
ProductHome
类也应该被删除。这是一个EJB2工件,在这个时代完全没有必要

要开始使用EJB,您只需要一个带有
@Stateless
注释的POJO:

@Stateless
public class ProductBean {
    // ...
}

将其打包并部署。这就是全部。您不必显式命名bean(它将获得一个名称),当然也不必在某个XML文件中声明它的存在。

将应用程序部署为jar文件时,ejb-jar.XML是必需的。正确的放置位置是jar中的META-INF

是的,注释确实很好,而且更易于维护。尝试将ejb-jar.xml保留为最小值

我总是把我的应用程序包在耳朵里,里面装着罐子。在这种情况下,需要一个application.xml文件


听起来好像容器没有将jar识别为应用程序。检查ejb-jar.xml的位置或使用EAR打包。

Oracle建议将独立的ejb打包为EAR文件。EJB描述符应该位于EJB模块的META-INF中。 有关EAR结构的更多详细信息,请参阅此链接。

伙计们,我需要一些帮助。