facebook

Tring to start Weblogic 7 using MyEclipse 4

  1. MyEclipse Archived
  2.  > 
  3. Application Servers and Deployment
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #243693 Reply

    jadeite100
    Member

    To whom it may concern:

    I tried to started weblogic 7 using myEclipse with the following settings in Preferences/Application Servers/Weblogic 7

    Bea home directory: c:\bea\weblogic701
    Weblogic installation directory c:\bea
    admin username:system
    admin password:administrator
    Execution domain name:mydomain
    Execution server name:myserver
    Hostname:PortNumber: localhost:7001

    I go to the server startup for weblogic 7 and when I clicked on “Start” I get the below error message:

    A configuration error occurred during startup. Please verify the preference field with the prompt:Security policy file.

    Is there anymore information you would need from me to solve this problem?

    Yours,

    🙁

    #243715 Reply

    Scott Anderson
    Participant

    You’ve got the BEA home directory and the WLS directory reversed. The BEA home is c:\bea and the Weblogic intallation should be c:\bea\weblogic701. Here’s an example from the FAQ for comparison to help you get going:
    http://www.myeclipseide.com/FAQ+index-myfaq-yes-id_cat-17.html

    #243721 Reply

    jadeite100
    Member

    Hi Scott:

    Thank you for the quick reply. I got the myeclipse to run Weblogic 7 now.

    Thank You.

    Another question:

    I am trying to run a weblogic client in myeclipse.
    In dos prompt, I use the following command:
    java -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory -Djava.naming.provider.url=t3://localhost:7001 -classpath %CLASSPATH%;.\build day04.Client

    How do I setup my myeclipse project to do the same thing.
    I create a normal java project but I don’t know where in myEclipse to add the parameters such as -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory .

    Also, I have the source code to a stateless session bean. Is there a url that shows how I can setup myeclipse so that when I called the java client for the ejb I can debug the stateless session beans such classes as the session bean?

    Yours,

    Frustrated user. 🙁

    #243725 Reply

    Greg
    Member

    How do I setup my myeclipse project to do the same thing.
    I create a normal java project but I don’t know where in myEclipse to add the parameters such as -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory .

    When you are running the java application, go to the Run… or Debug… menu and select the java application launch configuration. Then when you have that selected, go to the “Arguments” tab and add in your program or vm arguments. Does that help?

    #243735 Reply

    jadeite100
    Member

    Hi Greg:

    Thank you I got it to work. But I have a question why I have to do the following:

    I went into Run menu and than “Run..” and I selected the “Arguments” tab.
    I added the following statements to the “Program Arguments:” and “VM arguments:”

    -Djava.naming.factory.initial=weblogic.jndi.WLInitialContextFactory -Djava.naming.provider.url=t3://localhost:7001

    My question is why do I have to add the above statements to both the “Program Arguments:” and “VM arguments:” for my java client to correctly call an Stateless session bean using Weblogic 7 SP1.

    If I added the above statements to only the “Program Arguments:” I cannot run my java client successfully. Or if I use only “VM arguments” I also cannot run my java client successfully.

    Here is the code for my java client:
    import java.util.*;
    import java.rmi.*;
    import java.io.*;
    import javax.naming.*;
    import javax.ejb.*;

    // This client demonstrates a sample usage of the JNDI tree

    public class Client{
    public static InitialContext ctx;
    public static void main(String[] argv) {
    print(“Day 4: Demonstration of the usage of JNDI…”);
    if(argv.length < 1){
    print(“Usage : Client <JNDI root name>\n”);
    return;
    }
    try {
    print(“Connecting to a JNDI service…”);
    ctx = new InitialContext();
    print(” Connected successfully. Initial context created.\n”);
    print(“Getting Environment Properties…”);
    print(” Properties: ” + ctx.getEnvironment().toString() + “\n”);
    // Adding a binding
    String name = “mary”;
    String email = “mary@hotmail.com”;
    print(“Binding a new name: ” + name + ” to an object: “+email+”…”);
    ctx.bind(name, email);
    print(” Object: “+ email+ ” is bound to name: ” + name + “\n”);
    // Lookup a binding
    print(“Looking up the name…”);
    String s = (String) ctx.lookup(“mary”);
    print(” Found Name= mary, with email= ” + s + “\n”);
    // Delete a binding
    print(“Unbinding the name…”);
    ctx.unbind(“mary”);
    print(” Name is unbound successfully!\n”);
    print(“Spanning JNDI context bindings…”);

    spanJNDI(argv[0]);
    print(“\n”);
    // Lookup a “deleted” binding
    print(“Lookup for the unbound name…error expected”);
    s = (String) ctx.lookup(“mary”);
    print(” Found Name= mary, with email= ” + s);

    }
    catch (CommunicationException e) {
    print(“**ERROR: Failed to connect with the JNDI server.” +
    “Startup the App Server, and run again..”+e);
    }
    catch (Exception e) {
    print(“**ERROR: An unexpected exception occurred…”+e);
    }
    finally {
    if (ctx != null) {
    try {
    ctx.close();
    print(“Connection to JNDI is closed successfully.”);
    }
    catch (NamingException e) {
    print(“**ERROR: Failed to close context due to: ” + e);
    }
    }
    }
    }

    static void spanJNDI(String name){
    try{
    ctx = new InitialContext();
    NamingEnumeration bindList = ctx.listBindings(name);
    // Go through each item in list
    while (bindList !=null && bindList.hasMore()) {
    Binding bd = (Binding)bindList.next();
    print(” ” + bd.getName() + “: ” + bd.getClassName() + “: ” + bd.getObject());
    spanJNDI(bd.getName());
    }
    }catch (NamingException e) {

    }
    }
    static void print(String s) {
    System.out.println(s);
    }

    }

    Yours,

    Curious.

    #243740 Reply

    Greg
    Member

    Ah ok, you should be able to specify these 2 java properties in a simple jndi.properties file located at the same location in your java client source as the main program. So just create a jndi.properties file in the same package as the java client and make sure it contains the following 2 lines:

    java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
    java.naming.provider.url=t3://localhost:7001

    Then you shouldn’t need to add this properties via the jvm arguments.

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Tring to start Weblogic 7 using MyEclipse 4

You must be logged in to post in the forum log in