• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JNDI

 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
nobody is there to help me....
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Frederik Ericsson
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 128
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 was born with webbed fish toes. This tiny ad is my only friend:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic