File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes JNDI Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "JNDI" Watch "JNDI" New topic
Author

JNDI

Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
Hello Guys,

'm using WLS8.1, actually I wrote advice bean, after build, I got the AdviceApp.jar in that i got these files...Adiveremote, AdviceHome, ejb-jar.xml, weblogic-ejb-jar.xml.

while am trying to rewrite the weblogic xml file for naming JNDI, it says this is not rewritable file.

client code
Object o = ic.lookup("Advisor"); // replace with YOUR JNDI name for the bean
AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);
Advice advisor = home.create();

geting error here.
D:\Weblogic\user_projects\AdviceApp\AdviceApp\headfirst>javac -classpath "C:\Program Files\j2sdkee1.3.1\lib\j2ee.jar";"D:\Weblogic\user_projects\AdviceApp\Advic
eApp\AdviceApp.jar" AdviceClient.java
AdviceClient.java:28: cannot resolve symbol
symbol : class Advice
location: class headfirst.AdviceClient
Advice advisor = home.create();
^
1 error



Please guys.. help me how and where to give JNDI name in weblogic8.1 and how to rectify this problem

Cheers
Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
nobody is there to help me....
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

Patience Is A Virtue
It sounds like you have two problems. If weblogic xml is read-only, make it writable. Simple enough.
The other error is a simple classpath problem. The release notes for the JVM describe how classes are found. Did you try specifying the classpath without quotes? Did you examine your JAR to make sure the classes are in the correct place? How about the path to the JAR. I notice AdviceApp is repeated.
Edited to add: I just noticed that you don't say that your JAR contains the Advice class. If it doesn't, then that's your problem.
[ October 04, 2006: Message edited by: Joe Ess ]

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
Hello Joe,

Actually I got only one problem, am suppose to give JNDI name in weblogic***.xml file, while am trying to give in xml it says not rewritable, becoz its under jar. this weblogic-ejb-jar.xml file is created by WLS.

how can I make it to writable file, in Weblogic workshop, if I choose that file it shows only 2 options which are save as and close. I cant able to acces that file directly, coz its under jar.

If I solve this one pb the other one will be resolved automatically.

Cheers
[ October 04, 2006: Message edited by: Frederik Ericsson ]
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

Originally posted by Frederik Ericsson:

how can I make it to writable file, in Weblogic workshop

I don't use Weblogic Workshop. You can always extract all the files from the jar, edit the weblogic.xml file, then jar the files back up.


If I solve this one pb the other one will be resolved automatically.

That's unlikely since your other problem is being reported by the compiler and has nothing to do with either JNDI or the weblogic.xml file.
Lin Feng
Ranch Hand

Joined: Dec 11, 2002
Posts: 142
Frederik,

You can set the JNDI name of the EJB on the property palette. the weblogic-ejb-jar.xml will be updated automatically when it is compiled. Acutally it is using a doclet embedded in the source code to specify the JNDI name.

Lin
Frederik Ericsson
Ranch Hand

Joined: Apr 27, 2005
Posts: 128
it says getMessage() is not found in AdviceRemote, this AdviceRemote is created br WLS, so I cant able to declare my business method in this component interface.

Client code

public class AdviceClient {

public static void main(String[] args) {
new AdviceClient().go();
}

public void go() {
try {
Context ic = new InitialContext();

Object o = ic.lookup("Test1"); // replace with YOUR JNDI name for the bean

AdviceHome home = (AdviceHome) PortableRemoteObject.narrow(o, AdviceHome.class);

AdviceRemote advisor = home.create();

System.out.println("Testing...");
System.out.println(advisor.getMessage());// error getMessage() is not found in AdviceRemote

} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8708
    
    6

The methods of a bean are declared in the remote interface. According to the naming convention of EJB's, your remote interface should be named Advice.java. Since you are using Weblogic Workshop it is likely that this class is being generated by some property.
BTW, you should use the interface name, not the generated class name, in your create() call (i.e. Advice instead of AdviceRemote).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JNDI
 
Similar Threads
Weblogic8.1 with JNDI
HFEJB - Basic Question from
Weblogic with Ejb, HFEJB
Trouble running Advice EJB
Plz guys help me to fix JNDI