Weblogic & EJB

Hi, everyone
I am a freshman .There is a problem to me .I need your help. thanks.
the detail as following:
InitialContext ctx=new InitialContext();
Object objRef = ctx.lookup("java:comp/env/Hello"); ---when i want to call ejb module and the application run to this line,it will throw a javax.naming.NamingException.
the detailed error info :
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
     at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:640)
     at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
     at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:280)
     at javax.naming.InitialContext.lookup(InitialContext.java:347)
     at Test.main(Test.java:9)
others:
1.Weblogic is as ejb container.
2.There is no warning and error when I start weblogic server ,so i can confirm that there is no problem in the ejb module. And there is no problem in the file of "ejb-jar.xml" either.
<2004-8-23 03:53:27 PM> <Notice> <Application Poller> <149400> <Activating
application: appsdirHello_jar>
<2004-8-23 03:53:27 PM> <Notice> <Application Poller> <149404> <Activate ap
plication appsdirHello_jar on rickyserver - Running>
<2004-8-23 03:53:29 PM> <Notice> <Application Poller> <149404> <Activate ap
plication appsdirHello_jar on rickyserver - Completed>
THE 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>
     <description>
          This is Hello EJB example
     </description>
     <display-name>HelloBean</display-name>
     <enterprise-beans>
          <session>
               <display-name>Hello</display-name>
               <ejb-name>Hello</ejb-name>
               <home>HelloHome</home>
               <remote>Hello</remote>
               <ejb-class>HelloEJB</ejb-class>
               <session-type>Stateless</session-type>
               <transaction-type>Container</transaction-type>
          </session>
     </enterprise-beans>
</ejb-jar>
question&#65306;
where is error? plz tell me, thanks very much.

Check your weblogic-ejb-jar.xml file and add following...
I am assuming you are using weblogic 8.1, if not then refer respective .dtd and make change accordingly.
<weblogic-enterprise-bean>
<ejb-name>Hello</ejb-name>
<local-jndi-name>Hello</local-jndi-name>
</weblogic-enterprise-bean>
Following is the sample code for lookup...
Hashtable h = new Hashtable();
h.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
h.put(Context.PROVIDER_URL, "t3://localhost:7001");
h.put(Context.SECURITY_PRINCIPAL, "username");
h.put(Context.SECURITY_CREDENTIALS, "password");               
InitialContext initialContext = new InitialContext(h);
HelloLocalHome helloLocalHome = (HelloLocalHome)initialContext.lookup("Hello");
Note : You need to provide valid username and password of the weblogic.
h.put(Context.SECURITY_PRINCIPAL, "username");
h.put(Context.SECURITY_CREDENTIALS, "password");     
Here dummy values are written; replace these values by valid username and password.
+ Mihir

Similar Messages

  • Failed to load weblogic-ejb-jar.xml

    Hi,
    I try to deploy an EJB on Weblogic 9.1, but the weblogic-ejb-jar seems to cause this exception :
    ======================================================
    [wlappc] <30 oct. 2006 12 h 13 CET> <Error> <J2EE> <BEA-160187> <weblogic.appc failed to compile your application. Recompile with the -verbose option for more details. Please see the error message(s) below.>
    [wlappc] com.bea.xml.XmlException: failed to load java type corresponding to e=weblogic-ejb-jar@http://www.bea.com/ns/weblogic/910
    [wlappc] at com.bea.staxb.runtime.internal.UnmarshalResult.getPojoBindingType(UnmarshalResult.java:325)
    [wlappc] at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:292)
    [wlappc] at com.bea.staxb.runtime.internal.UnmarshalResult.determineTypeForGlobalElement(UnmarshalResult.java:302)
    [wlappc] at com.bea.staxb.runtime.internal.UnmarshalResult.determineRootType(UnmarshalResult.java:283)
    [wlappc] at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalDocument(UnmarshalResult.java:153)
    [wlappc] at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:65)
    [wlappc] at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:138)
    [wlappc] at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:271)
    [wlappc] at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:240)
    [wlappc] at weblogic.descriptor.DescriptorManager.createDescriptor(DescriptorManager.java:300)
    [wlappc] at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:344)
    [wlappc] at weblogic.application.descriptor.CachingDescriptorLoader.createDescriptor(CachingDescriptorLoader.java:188)
    [wlappc] at weblogic.application.descriptor.AbstractDescriptorLoader.createDescriptor(AbstractDescriptorLoader.java:328)
    [wlappc] at weblogic.application.descriptor.AbstractDescriptorLoader.getDescriptor(AbstractDescriptorLoader.java:237)
    [wlappc] at weblogic.application.descriptor.AbstractDescriptorLoader.getRootDescriptorBean(AbstractDescriptorLoader.java:217)
    [wlappc] at weblogic.ejb.spi.EjbJarDescriptor.parseWeblogicEjbJarBean(EjbJarDescriptor.java:171)
    [wlappc] at weblogic.ejb.container.dd.xml.DDUtils.processWLEjbJarXMLWithSchema(DDUtils.java:706)
    [wlappc] at weblogic.ejb.container.dd.xml.DDUtils.parseWLDD(DDUtils.java:535)
    [wlappc] at weblogic.ejb.container.dd.xml.DDUtils.createDescriptorFromJarFile(DDUtils.java:358)
    [wlappc] at weblogic.ejb.container.dd.xml.DDUtils.createReadOnlyDescriptorFromJarFile(DDUtils.java:141)
    [wlappc] at weblogic.ejb.container.ejbc.EJBCompiler.parseDescriptors(EJBCompiler.java:1345)
    [wlappc] at weblogic.ejb.container.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:431)
    [wlappc] at weblogic.application.compiler.AppcUtils.compileEJB(AppcUtils.java:292)
    [wlappc] at weblogic.application.compiler.EJBCompiler.compile(EJBCompiler.java:95)
    [wlappc] at weblogic.application.compiler.flow.AppCompilerFlow.compileInput(AppCompilerFlow.java:113)
    [wlappc] at weblogic.application.compiler.flow.AppCompilerFlow.compile(AppCompilerFlow.java:43)
    [wlappc] at weblogic.application.compiler.FlowDriver$FlowStateChange.next(FlowDriver.java:55)
    [wlappc] at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    [wlappc] at weblogic.application.compiler.FlowDriver.run(FlowDriver.java:24)
    [wlappc] at weblogic.application.compiler.Appc.runBody(Appc.java:151)
    [wlappc] at weblogic.utils.compiler.Tool.run(Tool.java:158)
    [wlappc] at weblogic.utils.compiler.Tool.run(Tool.java:115)
    ======================================================
    Here is my weblogic-ejb-jar.xml file :
    ======================================================
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/910"
              xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
              xsi:schemaLocation="http://www.bea.com/ns/weblogic/910
              http://www.bea.com/ns/weblogic/910/weblogic-ejb-jar.xsd">
    <weblogic-enterprise-bean>
    <ejb-name>MyMDB</ejb-name>
    <message-driven-descriptor>
         <resource-adapter-jndi-name>ActiveMQRA</resource-adapter-jndi-name>
         <connection-factory-jndi-name>myQCF</connection-factory-jndi-name>
    </message-driven-descriptor>
    <resource-description>
    <res-ref-name>jms/factory</res-ref-name>
    <jndi-name>myQCF</jndi-name>
    </resource-description>
    <resource-env-description>
    <resource-env-ref-name>jms/queue</resource-env-ref-name>
    <jndi-name>queue.out</jndi-name>
    </resource-env-description>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    ======================================================
    So, it looks like this problem : http://forums.bea.com/bea/message.jspa?messageID=600018030&tstart=0
    I just need a confirmation :
    - is the "res-ref-name" format incorrect with '/' character ?
    - is the jndi-name format incorrect with '.' character ?
    Else, what is the problem with this DD ?
    Thanks,
    Rudy

    "shubha" <[email protected]> wrote:
    >
    hi ,
    Ejb with ejb-name 'hellobean' in ejb-jar.xml
    should be specified in weblogic-ejb-jar.xml with <weblogic-enterprise-bean></weblogic-enterprise-bean>
    i am having problem in deploying the most simple bean on wls7.0 .
    when i try to open the bean module with the weblogic builder i get the
    following
    message
    weblogic.ejb20.WLDeploymentException: Could not locate bean with ejb-name
    'hellobean'
    in weblogic-ejb-jar.xml
         at weblogic.ejb20.deployer.CompositeMBeanDescriptor.initialize60(CompositeMBeanDescriptor.java:249)
         at weblogic.ejb20.deployer.CompositeMBeanDescriptor.init(CompositeMBeanDescriptor.java:180)
         at weblogic.ejb20.deployer.CompositeMBeanDescriptor.<init>(CompositeMBeanDescriptor.java:171)
         at weblogic.marathon.model.EJBJarCMBean.setup(EJBJarCMBean.java:408)
         at weblogic.marathon.tasks.OpenModuleTask.figureOutModule(OpenModuleTask.java:76)
         at weblogic.marathon.tasks.OpenModuleTask.figureOutModule(OpenModuleTask.java:109)
         at weblogic.marathon.tasks.OpenModuleTask.runBackground(OpenModuleTask.java:64)
         at weblogic.jellybeans.core.task.TaskThread.execute(TaskThread.java:114)
         at weblogic.jellybeans.core.task.TaskThread.run(TaskThread.java:55)
    Could not locate bean with ejb-name 'hellobean' in weblogic-ejb-jar.xml
    Module hello1 descriptors failed to load
    if anyone has come across the same problem and have debugged it please
    help me
    out
    thanks in advance

  • Dynamic jndi-name in weblogic-ejb-jar.xml

    Is there a way to create dynamic (i.e. runtime) jndi-names for EJBs instead of
    (or in addition to) "hard coding" them in the weblogic-ejb-jar.xml file? What
    I'm trying to do is have one WebLogic instance (JVM) host multiple environments
    (our Beta and Training environments) and I simply want to deploy the same .ear
    file twice but have each environment (application - .ear) reference a different
    database schema (jdbc connection pool). I have everything working just fine for
    this scenario except when I define jndi-names for our ejbs. The problem is that
    I am really deploying the same ejbs (jndi-names and actually code base) in each
    applicatoin instance and I get an exception when the WebLogic is trying to deploy
    the second application (.ear) because the jndi-names in it have already been deployed
    by the first application instance. I recieve a jndi error stating that the name
    is already deployed.
    Or is there a better path to go down for what I am trying to do to have one WebLogic
    instance support our beta and training environments? Usually (but not always)
    our code base is the for same for both of these environments, I simply need to
    have each environment use a different database schema.
    Thanks

    A little birdie tells me that BEA does this very thing. Looking at the
    descriptors for WebLogic Portal I see:
    <weblogic-enterprise-bean>
    <ejb-name>LoaderEJB</ejb-name>
    <enable-call-by-reference>True</enable-call-by-reference>
    <jndi-name>${APPNAME}.BEA_content.LoaderHome</jndi-name>
    </weblogic-enterprise-bean>
    Yes, the ${APPNAME} token really is expanded into the J2EE application
    name at deployment time!
    Sincerely,
    Daniel Selman
    Bryan Dixon wrote:
    Rewriting our build process isn't really much of an option for me. Our current
    build process is too complex and time consuming right now to convert to Ant (we
    eventually will do this but not for a while). So are there any other ideas that
    aren't build related?
    Thanks
    "Eric Ma" <[email protected]> wrote:
    You don't need run-time dynamism in JDNI names and it can't be done anyways.
    You
    need token substitution in XML configuration files when building the
    app. If
    you are using Ant for building, then it is a breeze. If not, first convert
    your
    build process to use Ant.
    Also, a single WLS instance hosting multiple environments sounds really
    INTRIGUING
    to me.
    Eric Ma
    "Bryan Dixon" <[email protected]> wrote:
    Is there a way to create dynamic (i.e. runtime) jndi-names for EJBsinstead
    of
    (or in addition to) "hard coding" them in the weblogic-ejb-jar.xml file?
    What
    I'm trying to do is have one WebLogic instance (JVM) host multiple environments
    (our Beta and Training environments) and I simply want to deploy the
    same .ear
    file twice but have each environment (application - .ear) referencea
    different
    database schema (jdbc connection pool). I have everything working just
    fine for
    this scenario except when I define jndi-names for our ejbs. The problem
    is that
    I am really deploying the same ejbs (jndi-names and actually code base)
    in each
    applicatoin instance and I get an exception when the WebLogic is trying
    to deploy
    the second application (.ear) because the jndi-names in it have already
    been deployed
    by the first application instance. I recieve a jndi error stating that
    the name
    is already deployed.
    Or is there a better path to go down for what I am trying to do to have
    one WebLogic
    instance support our beta and training environments? Usually (but not
    always)
    our code base is the for same for both of these environments, I simply
    need to
    have each environment use a different database schema.
    Thanks

  • Can't I use the comment in weblogic-ejb-jar.xml?

    Hi, I am migrating to WebLogic Server 6.1 from 5.1.
    And for the weblogic-ejb-jar.xml,
    the following error occurs:
    ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml' line 14: An invalid XML character
    (Unicode: 0xb8) was found in the comment.
    ERROR: ejbc found errors
    The errorneous line is the following comment. (it's fine in 5.1)
    <!-- if false, ... -->
    Must I remove this comment?
    Thanks in advance.

    I used Korean language in comment.
    But the charset of XML was iso-8859-1.
    Sorry.
    "mariah" <[email protected]> wrote:
    >
    Hi, I am migrating to WebLogic Server 6.1 from 5.1.
    And for the weblogic-ejb-jar.xml,
    the following error occurs:
    ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml' line 14: An invalid
    XML character
    (Unicode: 0xb8) was found in the comment.
    ERROR: ejbc found errors
    The errorneous line is the following comment. (it's fine in 5.1)
    <!-- if false, ... -->
    Must I remove this comment?
    Thanks in advance.

  • Help: I'm sure it is a Bug in JNI calling WebLogic EJB

    Help me! I'm using jni to call weblogic EJB from a Com+ component,here is the code:
    // This is the main project file for VC++ application project
    // generated using an Application Wizard.
    #include "stdafx.h"
    #pragma unmanaged
    #include <windows.h>
    #include <jni.h>
    #include <process.h>
    #include <stdio.h>
    #define USER_CLASSPATH "C:\\myClasses;C:\\j2sdk1.4.0\\lib\\tools.jar;Z:\\wlserver6.1\\lib\\weblogic.jar;"
    /* where Prog.class is */
    JavaVM *jvm;
    * Function GetJNIEnv(void) returns the java environment pointer
    * in case we are executing on a thread other than the one the
    * jvm was created on.
    JNIEnv* GetJNIEnv(void){
         JNIEnv *env = NULL;
         jint nRet = jvm->GetEnv((void **)&env, JNI_VERSION_1_2);
         if(nRet == JNI_EDETACHED){
              jvm->AttachCurrentThread((void **)&env, NULL);
         return env;
    * Function DoJNDI(void *arg) uses the Java Invocation API to
    * execute the following Java code:
    * Hashtable prop = new Hashtable();
    * prop.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"
    * prop.put( Context.PROVIDER_URL, "t3://192.168.40.137:7001" );
    * ctxInitial = new InitialDirContext( prop );
    void DoJNDI(void *arg){
         jclass clsHash, clsInitDirCx;
         jmethodID mHashInit, mHashPut, mInitDirCxInit;
         jobject objHash, objInitDirCx;
         JNIEnv *env = GetJNIEnv(); // Get the environment if on a different thread
         clsHash = env->FindClass("java/util/Hashtable");
         mHashInit = env->GetMethodID(clsHash, "<init>", "()V");
         objHash = env->NewObject(clsHash, mHashInit);
         mHashPut = env->GetMethodID(clsHash, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
         jstring jstrICxFactoryPut = env->NewStringUTF("java.naming.factory.initial");
         jstring jstrICxFactoryVal = env->NewStringUTF("weblogic.jndi.WLInitialContextFactory");
         env->CallObjectMethod(objHash, mHashPut, jstrICxFactoryPut,jstrICxFactoryVal);
         jstring jstrProviderUrlPut = env->NewStringUTF("java.naming.provider.url");
         jstring jstrProviderUrlVal = env->NewStringUTF("t3://192.168.40.137:7001");
         env->CallObjectMethod(objHash, mHashPut, jstrProviderUrlPut,jstrProviderUrlVal);
         clsInitDirCx = env->FindClass("javax/naming/InitialContext");
         mInitDirCxInit = env->GetMethodID(clsInitDirCx, "<init>", "(Ljava/util/Hashtable;)V");
         objInitDirCx = env->NewObject(clsInitDirCx, mInitDirCxInit, objHash);
         if(objInitDirCx == NULL){
              printf("%s test FAILED:\n\n", (char*)arg);
         else{
              printf("%s test PASSED\n\n", (char*)arg);
         jvm->DetachCurrentThread();
    * Function main(void) creates a JVM, and calls DoJNDI twice:
    * Once as a regular function call, and once as a spun off thread.
    void main() {
    JavaVMInitArgs vm_args;
    JavaVMOption options[5];
         options[0].optionString = "-client";
    options[1].optionString =
    "-cp " USER_CLASSPATH;
    options[2].optionString =
    "-Djava.class.path=" USER_CLASSPATH;
         //options[3].optionString =
         //     "-Xbootclasspath:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;z:\\wlserver6.1\\lib\\weblogic.jar;";
         options[3].optionString =
              "-Xbootclasspath/a:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;";
         options[4].optionString =
              "-Xbootclasspath/p:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;";
    vm_args.version = 0x00010002;
    vm_args.options = options;
    vm_args.nOptions = 5;
    vm_args.ignoreUnrecognized = JNI_TRUE;
         JNIEnv *env;
         jint res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
         // *** Make the magic calls! (Both lines should do the same thing) ***
         DoJNDI((void*)"Function call");
         _beginthread(DoJNDI,0,(void *)"Thread call");
         /* wait for thread(s) to finish */
         Sleep(5000);
         jvm->DestroyJavaVM();
    But it always send me a Exception like below:
    javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory.
    Root exception is java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:207)
    at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    when I search this problem in java.sun.com,an article announce that it is a bug that
    JNDI not support multi-threads call,and it is fixed is JDK1.4 beta. The link is:
    http://developer.java.sun.com/developer/bugParade/bugs/4307751.html
    It seems that weblogic's JNDI is not support multi-thread call. what can i do?

    Try adding the following code before instantiating your initial context:
    Thread.currentThread().setContextClassLoader( ClassLoader.getSystemClassLoader()
    This fixed the problem for me.
    -Brian
    "Edward Lu" <[email protected]> wrote:
    >
    Help me! I'm using jni to call weblogic EJB from a Com+ component,here is
    the code:
    // This is the main project file for VC++ application project
    // generated using an Application Wizard.
    #include "stdafx.h"
    #pragma unmanaged
    #include <windows.h>
    #include <jni.h>
    #include <process.h>
    #include <stdio.h>
    #define USER_CLASSPATH "C:\\myClasses;C:\\j2sdk1.4.0\\lib\\tools.jar;Z:\\wlserver6.1\\lib\\weblogic.jar;"
    /* where Prog.class is */
    JavaVM *jvm;
    * Function GetJNIEnv(void) returns the java environment pointer
    * in case we are executing on a thread other than the one the
    * jvm was created on.
    JNIEnv* GetJNIEnv(void){
         JNIEnv *env = NULL;
         jint nRet = jvm->GetEnv((void **)&env, JNI_VERSION_1_2);
         if(nRet == JNI_EDETACHED){
              jvm->AttachCurrentThread((void **)&env, NULL);
         return env;
    * Function DoJNDI(void *arg) uses the Java Invocation API to
    * execute the following Java code:
    * Hashtable prop = new Hashtable();
    * prop.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory"
    * prop.put( Context.PROVIDER_URL, "t3://192.168.40.137:7001" );
    * ctxInitial = new InitialDirContext( prop );
    void DoJNDI(void *arg){
         jclass clsHash, clsInitDirCx;
         jmethodID mHashInit, mHashPut, mInitDirCxInit;
         jobject objHash, objInitDirCx;
         JNIEnv *env = GetJNIEnv(); // Get the environment if on a different thread
         clsHash = env->FindClass("java/util/Hashtable");
         mHashInit = env->GetMethodID(clsHash, "<init>", "()V");
         objHash = env->NewObject(clsHash, mHashInit);
         mHashPut = env->GetMethodID(clsHash, "put", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
         jstring jstrICxFactoryPut = env->NewStringUTF("java.naming.factory.initial");
         jstring jstrICxFactoryVal = env->NewStringUTF("weblogic.jndi.WLInitialContextFactory");
         env->CallObjectMethod(objHash, mHashPut, jstrICxFactoryPut,jstrICxFactoryVal);
         jstring jstrProviderUrlPut = env->NewStringUTF("java.naming.provider.url");
         jstring jstrProviderUrlVal = env->NewStringUTF("t3://192.168.40.137:7001");
         env->CallObjectMethod(objHash, mHashPut, jstrProviderUrlPut,jstrProviderUrlVal);
         clsInitDirCx = env->FindClass("javax/naming/InitialContext");
         mInitDirCxInit = env->GetMethodID(clsInitDirCx, "<init>", "(Ljava/util/Hashtable;)V");
         objInitDirCx = env->NewObject(clsInitDirCx, mInitDirCxInit, objHash);
         if(objInitDirCx == NULL){
              printf("%s test FAILED:\n\n", (char*)arg);
         else{
              printf("%s test PASSED\n\n", (char*)arg);
         jvm->DetachCurrentThread();
    * Function main(void) creates a JVM, and calls DoJNDI twice:
    * Once as a regular function call, and once as a spun off thread.
    void main() {
    JavaVMInitArgs vm_args;
    JavaVMOption options[5];
         options[0].optionString = "-client";
    options[1].optionString =
    "-cp " USER_CLASSPATH;
    options[2].optionString =
    "-Djava.class.path=" USER_CLASSPATH;
         //options[3].optionString =
         //     "-Xbootclasspath:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;z:\\wlserver6.1\\lib\\weblogic.jar;";
         options[3].optionString =
              "-Xbootclasspath/a:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;";
         options[4].optionString =
              "-Xbootclasspath/p:c:\\j2sdk1.4.0\\lib\\tools.jar;z:\\wlserver6.1\\lib\\weblogic_sp.jar;";
    vm_args.version = 0x00010002;
    vm_args.options = options;
    vm_args.nOptions = 5;
    vm_args.ignoreUnrecognized = JNI_TRUE;
         JNIEnv *env;
         jint res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
         // *** Make the magic calls! (Both lines should do the same thing) ***
         DoJNDI((void*)"Function call");
         _beginthread(DoJNDI,0,(void *)"Thread call");
         /* wait for thread(s) to finish */
         Sleep(5000);
         jvm->DestroyJavaVM();
    But it always send me a Exception like below:
    javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory.
    Root exception is java.lang.ClassNotFoundException: weblogic/jndi/WLInitialContextFactory
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:207)
    at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:42)
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:649)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
    at javax.naming.InitialContext.init(InitialContext.java:219)
    at javax.naming.InitialContext.<init>(InitialContext.java:195)
    when I search this problem in java.sun.com,an article announce that it is
    a bug that
    JNDI not support multi-threads call,and it is fixed is JDK1.4 beta. The
    link is:
    http://developer.java.sun.com/developer/bugParade/bugs/4307751.html
    It seems that weblogic's JNDI is not support multi-thread call. what can
    i do?

  • Use of externally-defined/ in weblogic-ejb-jar.xml

    I am trying to use Global Roles defined via the Weblogic console to control access to EJB methods.
    I am using the <externally-defined/> tag in security role assignments, however when I deploy to Weblogic I get the following error :
    <8/09/2004 04:21:42 PM GMT+10:00> <Error> <Deployer> <BEA-149205> <Failed to initialize the application appsdirmars-marketdata_ear due to error weblogic.manag
    ement.ApplicationException: Prepare failed. Task Id = null
    Module Name: ejb-marketdata.jar, Error: [EJB:011024]The XML parser encountered an error in your deployment descriptor. Please ensure that your deployment descriptor corresponds to the format in the DTD. The error was:
    Error parsing file 'META-INF/weblogic-ejb-jar.xml' at line: 51 column: 26. Element type "externally-defined" must be declared..
    at weblogic.j2ee.J2EEApplicationContainer.checkForErrors(J2EEApplication
    Container.java:1612)
    at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
    er.java:1207)
    at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
    er.java:1051)
    at weblogic.j2ee.J2EEApplicationContainer.prepare(J2EEApplicationContain
    er.java:823)
    at weblogic.management.deploy.slave.SlaveDeployer$Application.prepare(Sl
    aveDeployer.java:2925)
    at weblogic.management.deploy.slave.SlaveDeployer.prepareAllApplications
    (SlaveDeployer.java:967)
    at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.j
    ava:349)
    at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resum
    e(DeploymentManagerServerLifeCycleImpl.java:229)
    at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
    at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:966)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:361)
    at weblogic.Server.main(Server.java:32)
    I am running Weblogic 8.1 SP3 on Windows XP Pro.
    The XML is valid for the specified DTD according to my XML editor.
    The relevevant fragment from weblogic-ejb-jar.xml is included below.
    Any help much appreciated.
    Gavin.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
    <weblogic-ejb-jar>
    <security-role-assignment>
    <role-name>MarsAdmin</role-name>
    <externally-defined/>
    </security-role-assignment>
    <security-role-assignment>
    <role-name>MarsViewer</role-name>
    <externally-defined/>
    </security-role-assignment>
    </weblogic-ejb-jar>

    I tried using the <global-role/> tag instead - this does deploy without any errors - but when I call the secure EJB method I get the Security Violation error below.
    The DTD says using the <global-role/> tag is fine, albeit deprecated, but the Weblogic 8.1 manual says this has been replaced by <externally-defined/>, so I'm not sure if this should work or not.
    [EJB:010160]Security Violation: User: 'ghughes' has insufficient permission to access EJB: type=<ejb>, application=_appsdir_mars-marketdata_ear, module=ejb-marketdata.jar, ejb=marketdata.MarketDataManager, method=getEnergyOverview, methodInterface=Remote, signature={java.util.Date}.
    So on the whole I'd prefer to work out why Weblogic isn't recognising <externally-defined/> - I've included the full deployment descriptor below - I'm generating it using the latest snapshot of XDoclet - is the DTD specified correct for Weblogic 8.1 SP3 ? (It matches the one specified in http://e-docs.bea.com/wls/docs81/ejb/DDreference-ejb-jar.html - but I can't think of anything else that could be wrong).
    Any tips much appreciated as I need to enable an administrator to customise these roles at runtime rather than hard-coding the role - group mappings into the deployment descriptors.
    Thanks,
    Gavin.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE weblogic-ejb-jar PUBLIC "-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN" "http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd">
    <weblogic-ejb-jar>
    <description><![CDATA[Generated by XDoclet]]></description>
    <weblogic-enterprise-bean>
    <ejb-name>marketdata.MarketDataManager</ejb-name>
    <stateless-session-descriptor>
    </stateless-session-descriptor>
    <reference-descriptor>
    </reference-descriptor>
    <jndi-name>marketdata.MarketDataManager</jndi-name>
    <local-jndi-name>marketdata.MarketDataManagerLocal</local-jndi-name>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>marketdata.MessageManager</ejb-name>
    <message-driven-descriptor>
    <pool>
    <max-beans-in-free-pool>5</max-beans-in-free-pool>
    <initial-beans-in-free-pool>1</initial-beans-in-free-pool>
    </pool>
    <destination-jndi-name>FileTopic</destination-jndi-name>
    <connection-factory-jndi-name>JMSConnectionFactory</connection-factory-jndi-name>
    <jms-polling-interval-seconds>10</jms-polling-interval-seconds>
    <jms-client-id>1</jms-client-id>
    </message-driven-descriptor>
    <transaction-descriptor>
    <trans-timeout-seconds>10</trans-timeout-seconds>
    </transaction-descriptor>
    <reference-descriptor>
    </reference-descriptor>
    <enable-call-by-reference>True</enable-call-by-reference>
    </weblogic-enterprise-bean>
    <!--
    To add enterprise beans that you have deployment descriptor info for, add
    a file to your XDoclet merge directory called weblogic-enterprise-beans.xml that contains
    the <weblogic-enterprise-bean></weblogic-enterprise-bean> markup for those beans.
    -->
    <!-- xdoclet merge file -> weblogic-ejb-jar.xml -->
    <security-role-assignment>
    <role-name>MarsAdmin</role-name>
    <externally-defined/>
    </security-role-assignment>
    <security-role-assignment>
    <role-name>MarsViewer</role-name>
    <externally-defined/>
    </security-role-assignment>
    <idempotent-methods>
    </idempotent-methods>
    </weblogic-ejb-jar>
    Message was edited by [email protected] at Sep 8, 2004 8:45 PM

  • Deployment issues, how is weblogic-ejb-jar.xml linked to ejb-jar.xml

    Hey guys,
    I'm getting the following error I think because i have something configured incorrectly in my xml files. Instead of yousing activationConfig properties in my MDB I wanted to set them in the ejb-jar.xml file manually. The following error I'm getting is...
    Unable to deploy EJB: MyMDB from MDBtest2:
    [EJB:011026]The EJB container failed while creating the java:/comp/env namespace for this EJB deployment.
    weblogic.deployment.EnvironmentException: [EJB:010176]The resource-env-ref 'inQueue' declared in the ejb-jar.xml descriptor has no JNDI name mapped to it. The resource-ref must be mapped to a JNDI name using the resource-description element of the weblogic-ejb-jar.xml descriptor.
         at weblogic.ejb.container.deployer.EnvironmentBuilder.addResourceEnvReferences(EnvironmentBuilder.java:641)
         at weblogic.ejb.container.deployer.EJBDeployer.setupEnvironmentContext(EJBDeployer.java:330)
         at weblogic.ejb.container.deployer.EJBDeployer.setupEnvironmentFor(EJBDeployer.java:1097)
         at weblogic.ejb.container.deployer.EJBDeployer.setupBeanInfos(EJBDeployer.java:991)
         at weblogic.ejb.container.deployer.EJBDeployer.prepare(EJBDeployer.java:1273)
         at weblogic.ejb.container.deployer.EJBModule.prepare(EJBModule.java:372)
    ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
         <display-name>MDBtest2</display-name>
         <enterprise-beans>
              <message-driven>
                   <ejb-name>MyMDB</ejb-name>
                   <ejb-class>cms.crown.mdb.MyMDB</ejb-class>
                   <transaction-type>Container</transaction-type>
                   <message-destination-link>omg</message-destination-link>
                   <resource-ref>
                        <res-ref-name>weblogic.jms.XAConnectionFactory</res-ref-name>
                        <res-type>javax.jms.XAConnectionFactory</res-type>
                        <res-auth>Container</res-auth>
                   </resource-ref>
                   <resource-env-ref>
                        <resource-env-ref-name>inQueue</resource-env-ref-name>
                        <resource-env-ref-type>javax.jms.Queue</resource-env-ref-type>
                   </resource-env-ref>
              </message-driven>
         </enterprise-beans>
         <assembly-descriptor>
              <container-transaction>
                   <method>
                        <ejb-name>MyMDB</ejb-name>
                        <method-name>onMessage</method-name>
                        <method-params>
                             <method-param>javax.jms.Message</method-param>
                        </method-params>
                   </method>
                   <trans-attribute>Required</trans-attribute>
              </container-transaction>
         </assembly-descriptor>
    </ejb-jar>
    weblogic-ejb-jar.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-ejb-jar xmlns:wls="http://www.bea.com/ns/weblogic/10.0" 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 http://www.bea.com/ns/weblogic/10.0 http://www.bea.com/ns/weblogic/10.0/weblogic-ejb-jar.xsd">
    <!--weblogic-version:10.0-->
    <wls:message-destination-descriptor>
    <!--lookup-method:JNDI-->
    <wls:message-destination-name>omg</wls:message-destination-name>
    <wls:destination-jndi-name>inQueue</wls:destination-jndi-name>
    <wls:initial-context-factory>weblogic.jms.XAConnectionFactory</wls:initial-context-factory>
    <wls:provider-url>http://localhost:8010</wls:provider-url>
    </wls:message-destination-descriptor>
    </wls:weblogic-ejb-jar>
    Hope this is readable, thanks for any assistance

    Hi,
    It looks like first thing you are using EJB3 but your XML files are still pointing to version="2.1" and very old.
    <font color=red>
    <ejb-jar id="ejb-jar_ID" version="2.1" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee "http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd">
    </font><br>
    *try this: In below "ejb-jar.xml" file*
    QCF = your Connection factory JNDI Name
    TestQ = your Queue JNDI Name
    Transaction Attribute is ByDefault = Required ...so no need to add it here.
    <?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" metadata-complete="true">
    <enterprise-beans>
    <message-driven>
    <ejb-name>MyMDB</ejb-name>
    <mapped-name>TestQ</mapped-name>
    <ejb-class>cms.crown.mdb.MyMDB</ejb-class>
    <messaging-type>javax.jms.MessageListener</messaging-type>
    <transaction-type>Container</transaction-type>
    <activation-config>
    <activation-config-property>
    <activation-config-property-name>destinationType</activation-config-property-name>
    <activation-config-property-value><b><font color=maroon>javax.jms.Queue</font></b></activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
    <activation-config-property-name>connectionFactoryJndiName</activation-config-property-name>
    <activation-config-property-value><b><font color=maroon>QCF</font></b></activation-config-property-value>
    </activation-config-property>
    <activation-config-property>
    <activation-config-property-name>destinationJndiName</activation-config-property-name>
    <activation-config-property-value><b><font color=maroon>TestQ</font></b></activation-config-property-value>
    </activation-config-property>
    </activation-config>
    </message-driven>
    </enterprise-beans>
    <assembly-descriptor></assembly-descriptor>
    </ejb-jar>
    "weblogic-ejb-jar.xml":
    <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/weblogic-ejb-jar http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd">
    <font color=maroon><b> Now u need to Just define the Provider URL here...if you want a remote provider...else not required<BR> JNDI names are already defined in the ejb-jar.xml file</b></font><BR>
    </weblogic-ejb-jar>
    Some Links which you can refer:
    To Generate the Deployment Descriptors ...in case of EJB3 Applications: *http://jaysensharma.wordpress.com/2010/04/02/generating-ejb3-clientjar/*
    MDB3.0 Sample: *http://jaysensharma.wordpress.com/2009/08/17/mdb3-0-sample-for-weblogic-application-server/*
    Thanks
    Jay SenSharma

  • Sample weblogic-ejb-jar.xml for Resource-ref EJB 3.0

    I am trying to create an MDB that can be re-used under different names.
    @MessageDriven(description = "An MDB that transfers messages from one Queue to another", activationConfig = { @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue") })
    @TransactionAttribute(TransactionAttributeType.REQUIRED)
    public class TransferMdb implements MessageListener {
    private static final Logger LOG = Logger.getLogger(TransferMdb.class);
    @Resource(name = "jms/connfactory")
    private ConnectionFactory connectionFactory;
    @Resource(name = "jms/targetDestination")
    private Queue targetDestination;
    <ejb-jar version="3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_3_0.xsd">
    <enterprise-beans>
    <message-driven>
    <ejb-name>TransferMdb</ejb-name>
    <ejb-class>TransferMdb</ejb-class>
    </message-driven>
    </enterprise-beans>
    </ejb-jar>
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>TransferMdb</ejb-name>
    <message-driven-descriptor>
    <pool>
    <max-beans-in-free-pool>200</max-beans-in-free-pool>
    <initial-beans-in-free-pool>5</initial-beans-in-free-pool>
    </pool>
    <destination-jndi-name>test_queue</destination-jndi-name>
    <transaction-descriptor>
    <trans-timeout-seconds>20</trans-timeout-seconds>
    </transaction-descriptor>
    </message-driven-descriptor>
    <reference-descriptor>
    <resource-description>
    <res-ref-name>jms/connectionfactory</res-ref-name>
    <jndi-name>connectionfactory</jndi-name>
    </resource-description>
    <resource-description>
    <res-ref-name>jms/targetDestination</res-ref-name>
    <jndi-name>reply_queue</jndi-name>
    </resource-description>
    </reference-descriptor>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    However when I deploy the above, I get exceptions such as:
    problem: cvc-complex-type.2.4a: Expected elements 'initial-context-factory@http://www.bea.com/ns/weblogic/weblogic-ejb-jar provider-url@http://www.bea.com/ns/weblogic/weblogic-ejb-jar connection-factory-jndi-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar jms-polling-interval-seconds@http://www.bea.com/ns/weblogic/weblogic-ejb-jar jms-client-id@http://www.bea.com/ns/weblogic/weblogic-ejb-jar generate-unique-jms-client-id@http://www.bea.com/ns/weblogic/weblogic-ejb-jar durable-subscription-deletion@http://www.bea.com/ns/weblogic/weblogic-ejb-jar max-messages-in-transaction@http://www.bea.com/ns/weblogic/weblogic-ejb-jar distributed-destination-connection@http://www.bea.com/ns/weblogic/weblogic-ejb-jar use81-style-polling@http://www.bea.com/ns/weblogic/weblogic-ejb-jar init-suspend-seconds@http://www.bea.com/ns/weblogic/weblogic-ejb-jar max-suspend-seconds@http://www.bea.com/ns/weblogic/weblogic-ejb-jar security-plugin@http://www.bea.com/ns/weblogic/weblogic-ejb-jar' instead of 'transaction-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar' here in element message-driven-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar:<null>
    problem: cvc-complex-type.2.4a: Expected elements 'transaction-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar iiop-security-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar resource-description@http://www.bea.com/ns/weblogic/weblogic-ejb-jar resource-env-description@http://www.bea.com/ns/weblogic/weblogic-ejb-jar ejb-reference-description@http://www.bea.com/ns/weblogic/weblogic-ejb-jar service-reference-description@http://www.bea.com/ns/weblogic/weblogic-ejb-jar enable-call-by-reference@http://www.bea.com/ns/weblogic/weblogic-ejb-jar network-access-point@http://www.bea.com/ns/weblogic/weblogic-ejb-jar clients-on-same-server@http://www.bea.com/ns/weblogic/weblogic-ejb-jar run-as-principal-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar create-as-principal-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar remove-as-principal-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar passivate-as-principal-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar jndi-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar local-jndi-name@http://www.bea.com/ns/weblogic/weblogic-ejb-jar dispatch-policy@http://www.bea.com/ns/weblogic/weblogic-ejb-jar remote-client-timeout@http://www.bea.com/ns/weblogic/weblogic-ejb-jar stick-to-first-server@http://www.bea.com/ns/weblogic/weblogic-ejb-jar' instead of 'reference-descriptor@http://www.bea.com/ns/weblogic/weblogic-ejb-jar' here in element weblogic-enterprise-bean@http://www.bea.com/ns/weblogic/weblogic-ejb-jar:<null>
    at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:234)
    at weblogic.descriptor.internal.MarshallerFactory$1.evaluateResults(MarshallerFactory.java:221)
    at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:146)
    at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:306)
    at weblogic.application.descriptor.AbstractDescriptorLoader2.getDescriptorBeanFromReader(AbstractDescriptorLoader2.java:788)
    Truncated. see log file for complete stacktrace
    I am clearly missing items in the weblogic-ejb-jar.xml. If anyone has a sample or tips, that would be awesome as a starting point.

    Those tags just declare that you are using our CMP provider and that
    your descriptor is in META-INF/weblogic-cmp-rdbms-jar.xml.
    FWIW, you might also want to check out EJBGen. It tends to keep more up
    to date with WLS than xdoclet.
    -- Rob
    Gen wrote:
    I am using xdoclets to generate descriptor file weblogic-ejb-jar.xml
    for a BMP entity bean. Xdoclet is generating the descriptor file
    alright, but is putting the following extra tags. This happens even
    for samples which come with the download, so my tags in java file are
    not wrong.
    My question is, are the extra tags below harmless, or should I
    manually go to each desciptor file and remove them?
    Thanks.
    ----------- EXTRA TAGS GENERATED START ---------
    persistence> <persistence-type>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>6.0</type-version>
    <type-storage>META-INF/weblogic-cmp-rdbms-jar.xml</type-storage>
    </persistence-type>
    <persistence-use>
    <type-identifier>WebLogic_CMP_RDBMS</type-identifier>
    <type-version>6.0</type-version>
    </persistence-use>
    </persistence>
    ----------- EXTRA TAGS GENERATED END ---------
    ----------- TAGS I PUT IN JAVA CLASS START --------
    * @ejb:bean name="com.ejb.entity.Customer"
    * jndi-name="com.ejb.entity.CustomerHome"
    * view-type="remote"
    * type="BMP"
    * primkey-field="com.ejb.entity.CustomerPK"
    * reentrant="false"
    * @weblogic:cache
    * max-beans-in-cache="1000"
    * read-timeout-seconds="900"
    * concurrency-strategy="ReadOnly"
    ----------- TAGS I PUT IN JAVA CLASS END --------

  • Role- group in weblogic-ejb-jar.xml?

    How do I map a security role, defined in ejb-jar.xml, to a group (e.g., not just a single Principal)?
    For example, I'd like to have the following in weblogic-ejb-jar.xml:
    <security-role-assignment>
    <role-name>EJBAdministrator</role-name>
    <principal-name>admins</principal-name>
    </security-role-assignment>
    where 'admins' is a user group in my directory.
    I'm using the Active Directory authenticator on WLS7, and when I set 'principal-name' to a user-type entry, it works fine. But I really don't want to hardcode all the authorized usernames into the weblogic-ejb-jar.xml. Is there a way around it?

    Just use the name of the group instead of the user. Remember a group is
    a principal too. so in your example:
    <security-role-assignment>
    <role-name>EJBAdministrator</role-name>
    <principal-name>admin group</principal-name>
    </security-role-assignment>
    Hope that helps...
    Kitten wrote:
    How do I map a security role, defined in ejb-jar.xml, to a group (e.g., not just a single Principal)?
    For example, I'd like to have the following in weblogic-ejb-jar.xml:
    <security-role-assignment>
    <role-name>EJBAdministrator</role-name>
    <principal-name>admins</principal-name>
    </security-role-assignment>
    where 'admins' is a user group in my directory.
    I'm using the Active Directory authenticator on WLS7, and when I set 'principal-name' to a user-type entry, it works fine. But I really don't want to hardcode all the authorized usernames into the weblogic-ejb-jar.xml. Is there a way around it?

  • Reg. Provider Url set in weblogic-ejb-jar.xml

    have created an MDB which listens to an IBM MQ. I currently
    specify the path of the binding file by setting the provider_url in the weblogic-ejb-jar.xml
    An example is as follows::
    <destination-jndi-name>Sample.Q</destination-jndi-name>
    <initial-context-factory>com.sun.jndi.fscontext.RefFSContextFactory</initial-context-factory>
    <provider-url>file:/apps/test/</provider-url>
    <connection-factory-jndi-name>Sample.QCF</connection-factory-jndi-name>
    is there any way to set this parameter dynamically from MDB itself

    AFAIK you can't dynamically reconfigure MDBs; whats in the XML is what you get.
    One alternative is to use Spring and Message Driven POJOs which allows you to use Spring to configure the provider & activation spec, which allows you to dynamically at runtime configure properties however you wish or even hot deploy MDPs within a running application.
    http://jencks.org/Message+Driven+POJOs
    Depending on how complex your runtime-configuration is you could create your own Spring Factory Beans to do wacky stuff (query a database or whatever to figure out the provider URLs etc) or use a Spring post processor to inject values from some other source (JNDI, LDAP etc).
    James
    http://logicblaze.com/

  • Building weblogic ejbs with ant...

    Hi, it may be not the proper place, but I haven't found a better one...
    Here comes my question:
    I have an ant build.xml file where I have the following tasks defined:
    <property name="ejb.dtd.location" value="weblogic/ejb/deployment/xml/ejb-jar.dtd"/>
        <condition property="ejb.dtd.location" value="weblogic/ejb20/dd/xml/ejb11-jar.dtd">
          <equals arg1="${weblogic.major.version}" arg2="6"/>
        </condition>
        <property name="weblogic.ejb.dtd.location" value="weblogic/ejb/deployment/xml/weblogic-ejb-jar.dtd"/>
        <condition property="ejb.dtd.location" value="weblogic/ejb20/dd/xml/weblogic510-ejb-jar.dtd">
          <equals arg1="${weblogic.major.version}" arg2="6"/>
        </condition>
    <!-- compiles EJBs -->
      <target name="compile.ejb" depends="init">
        <javac srcdir="${srcDir.ejb}"
              destdir="${srcDir.ejb}"
                debug="${npm.debug}">
          <classpath id="ejb.cpath">
             <pathelement path="${weblogic.sp.path}"/>
             <pathelement path="${weblogic.core.path}"/>
             <pathelement location="${outDir.core}${file.separator}npm.jar"/>
             <pathelement location="${srcDir.ejb}"/>
           </classpath>
        </javac>
      </target>
      <!-- delivers EJBs -->
      <target name="make.ejb" depends="prepare, compile.ejb">
        <!-- ejbc 'n jar 'em -->
        <ejbjar srcdir="${srcDir.ejb}">
           <weblogic destdir="${outDir.ejb}"
                     compiler="${compiler.ejb}"
                     keepgeneric="false"
                     suffix=".jar"
                     args="-g -nowarn"
                     oldCMP="false">
             <classpath refid="ejb.cpath"/>
           </weblogic>
           <include name="**/*-ejb-jar.xml"/>
           <exclude name="**/*-weblogic-ejb-jar.xml"/>
           <!-- WLS v5 DTDs!!! -->
           <dtd publicId="-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN"
                location="${ejb.dtd.location}"/>
           <dtd publicId="-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN"
                location="${weblogic.ejb.dtd.location}"/>
        </ejbjar>
      </target>This should build my ejbs with either the wls61 ejbc or the wls51 one. Anyway ant seems to have problems finding the local dtds in the classpath, although this is specified in the documentation. When I set both location attributes to point to files it works perfect. The problem is that these are in weblogic.jar for the wls61 release. This has two solutions, but either are bad in my opinion:
    1. extract the needed dtds to a temp dir with a jar task and then delete em...
    2. put the proper wls.jar in the classpath so ejbc could automatically resolve the dtds
    Can anyone help or may be send his ant build file, where a <dtd> nested element is used for <ejbjar> for wls61?
    Thank you in advance
    Anton

    Anton,
    Your second solution is the correct one. If you look at dtd element description under ejbjar task in the Ant manual, you'll see that vendors jars are required in Ant's classpath in order for ejbjar task to resolve DTD dependencies, in which case you don't need to specify dtd elements. I don't particularly like it either. If you find a better way to solve this problem, let me know.
    -Dmitry

  • Download locally weblogic-ejb-jar.dtd

    Hi,
    Can we download weblogic-ejb-jar.dtd, weblogic-rdbms-persistence.dtd, weblogic-web-jar.dtd
    locally and refer to those dtds instead of http://www.bea.com/...
    and ship with our products? Because we don't want the end user to have internet
    connection while deploying.
    Is this legally allowed?
    Sambath.

    I have no idea, but ... all the WLS tools will resolve the weblogic
    DTDs locally. They won't open a socket to bea.com. (If they do, it's a
    bug.)
    -- Rob
    sambath wrote:
    Hi,
    Can we download weblogic-ejb-jar.dtd, weblogic-rdbms-persistence.dtd, weblogic-web-jar.dtd
    locally and refer to those dtds instead of http://www.bea.com/...
    and ship with our products? Because we don't want the end user to have internet
    connection while deploying.
    Is this legally allowed?
    Sambath.

  • ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml'

    I have this error while compiling session bean (Stateful). my weblogic-ejb-jar.xml
    file looks like this. Could anyone tell me what I'm doing wrong.
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>TransactionAgent</ejb-name>
    <stateless-session-descriptor>
         <pool>10</pool>
         <stateless-clustering>false</stateless-clustering>
    </stateless-session-descriptor>
    <ejb-ref-name>ejb/Transaction</ejb-ref-name>
    <jndi-name>Transaction</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>

    <pool> should not have any value. Instead it shud have the child nodes
    <max-beans-in-free-pool> and/or <initial-beans-in-free-pool>
    it will look like
    <pool>
    <max-beans-in-free-pool> 500 </max-beans-in-free-pool>
    <initial-beans-in-free-pool>100 </initial-beans-in-free-pool>
    </pool>
    Also, <ejb-ref-name> and <jndi-name> goes under <ejb-reference-descriptor>
    which is under <reference-descriptor>
    So it would look like
    <reference-descriptor>
    <ejb-reference-description>
    <ejb-ref-name> .. </ejb-ref-name>
    <jndi-name> .. </jndi-name>
    <ejb-reference-description>
    </reference-descriptor>
    The jndi name should also be defined for the bean. Also note that ejb-refs
    are defined under a bean which is referring other beans. Like Transaction
    should not refer to itself. Rather if it is referring to Customer, then
    ejb-ref will be defined for CustomerBean.
    Hope it helps.
    Rupesh.
    Owen <[email protected]> wrote in message
    news:3c614fb0$[email protected]..
    >
    I have this error while compiling session bean (Stateful). myweblogic-ejb-jar.xml
    file looks like this. Could anyone tell me what I'm doing wrong.
    <weblogic-ejb-jar>
    <weblogic-enterprise-bean>
    <ejb-name>TransactionAgent</ejb-name>
    <stateless-session-descriptor>
    <pool>10</pool>
    <stateless-clustering>false</stateless-clustering>
    </stateless-session-descriptor>
    <ejb-ref-name>ejb/Transaction</ejb-ref-name>
    <jndi-name>Transaction</jndi-name>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>

  • Simple Step-by-Step Weblogic+EJB Tutorial

    Anyone know of a simple step-by-step weblogic+ejb tutorial? Online?
    Thanks,
    Rocky

    See my signature line.. Book and examples are still free for download. WL6.1
    only at this point, but not for long.
    Check out my WebLogic 6.1 Workbook for O'Reilly EJB Third Edition
    www.oreilly.com/catalog/entjbeans3 or www.titan-books.com
    "Rocky" <[email protected]> wrote in message
    news:3cd95d54$[email protected]..
    >
    Anyone know of a simple step-by-step weblogic+ejb tutorial? Online?
    Thanks,
    Rocky

  • Java.lang.NoSuchMethodError: weblogic.ejb.internal.EJBHomeImpl

    Hi All,
    I have recently encountered very very unusual problem which am not able to understand. If you could kindly shade some light on that it would be of great help. I have three environment where the application is being deployed. In the first two environment it works fine without any problem. But when I deployed in the third environment it behave very funny. The full stack trace of the error is bellow:
    Exception in EJBTestClient: java.rmi.RemoteException: ; nested exception is:
    weblogic.rmi.ServerError: A RemoteException occurred in the server metho
    d
    - with nested exception:
    [java.lang.NoSuchMethodError: weblogic.ejb.internal.EJBHomeImpl: method findMeth
    The problem occurs when I try to call EJB from client. When I re-build the EJBS on the same environment it works fine. Am not able to understand this unusual behavior. If you could kindly help me understand the problem it would of great help. The environments are as follows.
    ENV-1
    OS - SunOS 5.6 Generic_105181-23 sun4u sparc SUNW,Ultra-Enterprise
    JDK - Solaris VM (build Solaris_JDK_1.2.2_07, native threads, sunwjit)
    Weblogic - 5.1.0 Service Pack 8 12/20/2000 16:34:54 #95137
    Oracle � 8.1.6
    ENV-2
    OS - SunOS 5.8 Generic_108528-07 sun4u sparc SUNW,Ultra-Enterprise
    JDK - Solaris VM (build Solaris_JDK_1.2.2_07, native threads, sunwjit)
    Weblogic - 5.1.0 Service Pack 9 04/06/2001 12:10:43 #105983
    Oracle � 8.1.6
    ENV-3
    OS - SunOS cfesit 5.8 Generic_108528-07 sun4u sparc SUNW,Ultra-Enterprise
    JDK - Solaris VM (build Solaris_JDK_1.2.2_07, native threads, sunwjit)
    Weblogic - 5.1.0 Service Pack 9 04/05/2001 14:59:53 #105983
    Oracle � 8.1.6
    The problem occurs in the 3rd environment.
    Cheers,
    Tapas
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi..
    I guess itzz more of the service pack problems.
    Jars built on the later version won't work in the previous version (service packs) of weblogic.
    Try building a jar on the oldest version (service pack) u have and then try deploying it to the later version , i think it won't give u any problems.
    Try it out and let me know if u face any problems

  • Error in stateless-clustering in weblogic-ejb-jar.xml

    Hi,
    This is my <weblogic-ejb-jar.xml> and I see an error in <stateless-bean-is-clusterable>. Can anybody please help me regarding this.
    <?xml version="1.0" encoding="UTF-8"?>
    <weblogic-ejb-jar xmlns="http://www.bea.com/ns/weblogic/10.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/10.0 http://www.bea.com/ns/weblogic/10.0/weblogic-ejb-jar.xsd">
    <weblogic-enterprise-bean>
    <ejb-name>Sample1</ejb-name>
    <stateless-session-descriptor>
    <pool>
    <initial-beans-in-free-pool>10</initial-beans-in-free-pool>
    </pool>
    <stateless-clustering>
    <stateless-bean-is-clusterable>TRUE</stateless-bean-is-clusterable>
    </stateless-clustering>
    </stateless-session-descriptor>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>Sample2</ejb-name>
    <stateless-session-descriptor>
    <pool>
    <initial-beans-in-free-pool>10</initial-beans-in-free-pool>
    </pool>
    <stateless-clustering>
    <stateless-bean-is-clusterable>TRUE</stateless-bean-is-clusterable>
    </stateless-clustering>
    </stateless-session-descriptor>
    </weblogic-enterprise-bean>
    <weblogic-enterprise-bean>
    <ejb-name>Sample3</ejb-name>
    <stateless-session-descriptor>
    <pool>
    <initial-beans-in-free-pool>10</initial-beans-in-free-pool>
    </pool>
    <stateless-clustering>
    <stateless-bean-is-clusterable>TRUE</stateless-bean-is-clusterable>
    </stateless-clustering>
    </stateless-session-descriptor>
    </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
    I am using weblogic 10.3 and EJB 3.0 Can I include all the EJBs in a single <weblogic-ejb-jar.xml> file and can I put it in the EAR->EarContent->META-INF folder, where the application.xml and weblogic-application.xml files exist.
    Basically, I am trying to include <initial-beans-in-free-pool> and <stateless-bean-is-clusterable> for each of my EJBs. Since there is no annotation equivalent for them in EJB 3.0, I had to include the <weblogic-ejb-jar.xml> file. I appreciate if anybody can suggest me if there is any annotation equivalent for these.
    Thank you,
    Sowmya

    Hi,
    1. please try with <stateless-bean-is-clusterable>true</stateless-bean-is-clusterable>
    2. the EJB Specification requires "The deployment descriptor must be stored with the name META-INF/ejb-jar.xml in the ejb-jar file." So you shouldn't put the weblogic-ejb-jar.xml to EAR's META-INF folder.
    3. <stateless-bean-is-clusterable> has a default value as "true". so you needn't specify it in your weblogic-ejb-jar.xml if you just want to have the "true" value.
    4. default value of <initial-beans-in-free-pool> is 0. Since you're changing the default value, you'll have to specify it in weblogic-ejb-jar.xml. If you can put all EJBs in one ejb jar file, you can have only one weblogic-ejb-jar.xml in the META-INF folder of this ejb jar.
    Thanks,
    Amy

Maybe you are looking for

  • T61 - how do I find my Windows XP Serial on a reformatte​d machine?

    Hi Guys, I've totally reformatted my T61 due to being hit with malware/spyware that pretty much rendered my laptop useless.  This was the second time I've installed Windows using a legit XP disc I had for my desktop, but I used the serial number for

  • How to find out whether USER-EXIT is active or not

    Hello! How can I  find out whether USER-EXIT is active or not ? I set a break-point at these points and nothing happens if I want save my daocument ??? Why PERFORM USEREXIT_SAVE_DOCUMENT. PERFORM USEREXIT_SAVE_DOCUMENT_PREPARE. Ragards Ilhan

  • How to compare table's date field with dropdown year field

    Hi All, I have one requirement to display the selected rows from a database table based on the selection of drop down. Here, I have one dropdown of year(like 2009,2010,....) and I have one database table which contains one field with "DATE". Now, I w

  • How findout who created a software component:

    I am in a situation where I have to findout which user (userid) created a software component in SLD and imported them into IR and created many namespaces? Is there a way to find out? Regards, N.S

  • Getting files off zip disks??

    Anyone know how to connect an old SCSI device to my new iMac? Trying to salvage old files on zip disk. Data recovery companies charging $30/disk, would like to do myself if possible. TIA.