Accessing utility classes from ebj

I have a session bean trying to access a utility class in the lib directory (same
directory as weblogic.jar). I have packaged it into a jar file and set the classpath
pointing to the file in the startWeblogic.cmd file. I compiled and depolyed the session
bean and it runs fine until it starts to access the class. I got NoClassFoundException.
I have tried to shut down and restart the server without any success. Anyone can
help me this this?
I know I can package the utility into the same jar as my ejb. But I don't want to
do it because it is going to be everywhere. What is the right way of doing it?
Thanks in advance.
L.W.Xu

Rob,
You are right.
Thanks a lot.
L.W.X.
Rob Woollen <[email protected]> wrote:
>
>
If it's in the server classpath, the ejb will have no problem finding it.
Either you have a typo and the class is not in the classpath. You can prove
this by running
javap on the class using the same classpath as your startWebLogic script.
Or, as I suggested in the last response, it's not really standalone. The
jar probably has a
dependence on some classes in the ejb.jar.
-- Rob
"L. W. Xu" wrote:
Rob,
It is a standalone generic jar which has some classes in it. The ejb justcan't find
it.
I have a simple java program which uses it and it runs fine.
Thanks.
L. W. Xu
Rob Woollen <[email protected]> wrote:
If your utility.jar is standalone, then your approach is fine. However,
it sounds like it
is referencing a class that's only
available in your ejb.jar. That won't work.
-- Rob
"L. W. Xu" wrote:
I have a session bean trying to access a utility class in the lib directory(same
directory as weblogic.jar). I have packaged it into a jar file and
set
the classpath
pointing to the file in the startWeblogic.cmd file. I compiled and
depolyed
the session
bean and it runs fine until it starts to access the class. I got NoClassFoundException.
I have tried to shut down and restart the server without any success.Anyone can
help me this this?
I know I can package the utility into the same jar as my ejb. But I
don't
want to
do it because it is going to be everywhere. What is the right way of
doing
it?
Thanks in advance.
L.W.Xu--
AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
http://learnWebLogic.com
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
If your utility.jar is standalone, then your approach is fine. However,
it sounds like it is referencing a class that's only
<br>available in your ejb.jar. That won't work.
<p>-- Rob
<p>"L. W. Xu" wrote:
<blockquote TYPE=CITE>I have a session bean trying to access a utility
class in the lib directory (same
<br>directory as weblogic.jar). I have packaged it into a jar file and
set the classpath
<br>pointing to the file in the startWeblogic.cmd file. I compiled and
depolyed the session
<br>bean and it runs fine until it starts to access the class. I gotNoClassFoundException.
<br>I have tried to shut down and restart the server without any success.
Anyone can
<br>help me this this?
<p>I know I can package the utility into the same jar as my ejb. ButI
don't want to
<br>do it because it is going to be everywhere. What is the right wayof
doing it?
<p>Thanks in advance.
<p>L.W.Xu</blockquote>
<pre>--
AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
http://learnWebLogic.com</pre>
</html>
AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
http://learnWebLogic.com
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
If it's in the server classpath, the ejb will have no problem finding it.
<p>Either you have a typo and the class is not in the classpath. 
You can prove this by running javap on the class using the same classpath
as your startWebLogic script.
<p>Or, as I suggested in the last response, it's not really standalone.  
The jar probably has a dependence on some classes in the ejb.jar.
<p>-- Rob
<br> 
<p>"L. W. Xu" wrote:
<blockquote TYPE=CITE>Rob,
<p>It is a standalone generic jar which has some classes in it. The ejb
just can't find
<br>it.
<p>I have a simple java program which uses it and it runs fine.
<p>Thanks.
<p>L. W. Xu
<p>Rob Woollen <[email protected]> wrote:
<br>>
<br>>
<br>>If your utility.jar is standalone, then your approach is fine. 
However,
<br>>it sounds like it
<br>>is referencing a class that's only
<br>>available in your ejb.jar.  That won't work.
<br>>
<br>>-- Rob
<br>>
<br>>"L. W. Xu" wrote:
<br>>
<br>>> I have a session bean trying to access a utility class in the lib
directory
<br>>(same
<br>>> directory as weblogic.jar). I have packaged it into a jar file and
set
<br>>the classpath
<br>>> pointing to the file in the startWeblogic.cmd file. I compiled and
depolyed
<br>>the session
<br>>> bean and it runs fine until it starts to access the class. I got
NoClassFoundException.
<br>>> I have tried to shut down and restart the server without any success.
<br>>Anyone can
<br>>> help me this this?
<br>>>
<br>>> I know I can package the utility into the same jar as my ejb. But
I don't
<br>>want to
<br>>> do it because it is going to be everywhere. What is the right way
of doing
<br>>it?
<br>>>
<br>>> Thanks in advance.
<br>>>
<br>>> L.W.Xu
<br>>
<br>>--
<br>>
<br>>----------------------------------------------------------------------
<br>>
<br>>AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
<br>>
<br>>by Michael Girdley, Rob Woollen, and Sandra Emerson
<br>>
<br>>http://learnWebLogic.com
<br>>
<br>>
<br>>
<br>>
<br>><!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<br>><html>
<br>>If your utility.jar is standalone, then your approach is fine. 
However,
<br>>it sounds like it is referencing a class that's only
<br>><br>available in your ejb.jar.  That won't work.
<br>><p>-- Rob
<br>><p>"L. W. Xu" wrote:
<br>><blockquote TYPE=CITE>I have a session bean trying to access a
utility
<br>>class in the lib directory (same
<br>><br>directory as weblogic.jar). I have packaged it into a jar file
and
<br>>set the classpath
<br>><br>pointing to the file in the startWeblogic.cmd file. I compiled
and
<br>>depolyed the session
<br>><br>bean and it runs fine until it starts to access the class.
I got NoClassFoundException.
<br>><br>I have tried to shut down and restart the server without any
success.
<br>>Anyone can
<br>><br>help me this this?
<br>><p>I know I can package the utility into the same jar as my ejb.
But I
<br>>don't want to
<br>><br>do it because it is going to be everywhere. What is the right
way of
<br>>doing it?
<br>><p>Thanks in advance.
<br>><p>L.W.Xu</blockquote>
<br>>
<br>><pre>--
<br>>
<br>>----------------------------------------------------------------------
<br>>
<br>>AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
<br>>
<br>>by Michael Girdley, Rob Woollen, and Sandra Emerson
<br>>
<br>>http://learnWebLogic.com"><a
href="http://learnWebLogic.com">http://learnWebLogic.com</a></A></pre>
<br>> </html>
<br>>
<br>></blockquote>
<pre>-- 
AVAILABLE NOW!: Building J2EE Applications & BEA WebLogic Server
by Michael Girdley, Rob Woollen, and Sandra Emerson
<A HREF="http://learnWebLogic.com">http://learnWebLogic.com</A></pre>
 </html>

Similar Messages

  • Referencing utility classes from a war file

    How do you reference a utility class from a war file? I tried adding the class to the deployment plan descriptor, however I still get a ClassNotFoundException.
    Thanks,
    Will

    To use the utility classes from a war you have to place them under the web-inf/classes directory.
    webApplication(WAR directory)--->WEB-INF--> classes (put your utility classes in this directory)

  • Accessing IFS classes from Weblogic

    Can I access the classes of IFS from within Weblogic by adding the IFS jars to the Classpath of Weblogic?
    Also how does EJBs work with IFS?
    Kaustuva Mukherjee

    I'm doing exactly the same thing that you are asking. first install ifs client on weblogic server, so that all ifs jar files are on weblogic. then do this in the weblogic class path file:
    REM ------------------ IFS CLASSPATH ------------------------
    SET IFS_CLASSPATH=d:\Oracle\Ora81\ifs1.1\lib\adk.jar;d:\Oracle\Ora81\ifs1.1\lib\clientlib.jar;d:\Oracle\Ora81\ifs1.1\lib\cmdlineutils.jar;d:\Oracle\Ora81\ifs1.1\lib\cup.jar;d:\Oracle\O ra81\ifs1.1\lib\http.jar;d:\Oracle\Ora81\ifs1.1\lib\oemadmin.jar;d:\Oracle\Ora81\ifs1.1\lib\release.jar;d:\Oracle\Ora81\ifs1.1\lib\repos.jar;d:\Oracle\Ora81\ifs1.1\lib\utils.jar;d: \Oracle\Ora81\ifs1.1\lib\webui.jar;d:\Oracle\Ora81\ifs1.1\settings
    and include IFS_CLASSPATH in your weblogic path.
    restart weblogic and u'll have all ifs classes for your use.
    null

  • Class not Found when accessing Proxy class from backing bean in VC.

    Hi All,
    I'm attempting to access a class of a webservice(generated as a proxy) within my ADF application and invoke the method within a backing bean of the View Controller(bean scope : backing bean). The proxy has generated an ObjectFactory class among other classes. When I access this Object factory class from within the backing bean, the application throws a Class not found error.
    I don't know where the error lies since I've declared the View Controller of the ADF application dependent on the Proxy and I've imported the class and accessing it within a backing bean. How would you suggest I approach resolveing this.
    JDev : 1.1.1.4
    Thank you.
    Regards
    PP.

    Hello Arun,
    Thank you for suggesting a Data control, but my requirement isn't to drag and drop the method as a button. It's more of a behind the scnes updating data via a database adapter requirement.
    I've resolved the issue. turns out, my deployment archive didn't include the proxy.jpr. Once included it works likea charm.
    Thanks
    PP.

  • Accessing custom classes from JSP

    Hi Guys,
    I am having some problems accessing my custom classes from my JSP.
    1) I've created a very simple class, SimpleCountingBean that just has accessors for an int. The class is in the package "SimpleCountingBean". I compiled this class locally on my laptop and uploaded the *.class file to my ISP.
    2) I've checked my classpath and yes, the file "SimpleCountingBean/SimpleCountingBean.class" is located off of one of the directories listed in the classpath.
    3) When I attempt to use this class in my JSP, via the following import statement:
    import "SimpleCountingBean.*"
    I get the following compile error
    java.lang.NoClassDefFoundError: SimpleCountingBean/SimpleCountingBean
    I'm pretty sure that my classpath is properly setup because when I purposely garble the import statement, I get the "package not found" compile error.
    Do I need to upload some other files in addition to the class file? Any suggestions would of course be appreciated.
    Sonny.

    Trying to get some clearer view.. so don't mind..
    So you uploaded all your .jsp files into your account which is:
    home/sonny
    and it compiles and work. But custom classes doesn't seems to be working, where did you place your classes?
    From my knowledge of tomcat, classes are normally placed in, in this case:
    home/sonny/web-inf/classes
    Maybe it differs from windows enviroment to *nix enviroment.. well, I'm just saying out so if its not the case.. don't mind me.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • EJBs accessing protected classes from java classloader

    Hello,
    We are facing a problem with classes isolation. I read from this newsgroup that
    to access a package level class from the base classloader from a bean, the supporting
    classes has to be from the same classloader as the bean. Well I think the only
    way we could do that is to have the *Bean.class in the base classloader, which
    is not what's recommended or move the support classes into the bean's classloader,
    which we cannot do.
    The purpose of this mail is to ask: is it a bug from weblogic server? Will it
    be fixed one day? If not, does it mean that it is impossible to isolate classes
    for local access from public classes?
    Thank you, Khiet.

    Thank you for your reply.
    Hope that one day we will not be obliged to have anything in the main classpath.
    :) Khiet.
    Rob Woollen <[email protected]> wrote:
    Tran T. Khiet wrote:
    Hello,
    We are facing a problem with classes isolation. I read from this newsgroupthat
    to access a package level class from the base classloader from a bean,the supporting
    classes has to be from the same classloader as the bean. Well I thinkthe only
    way we could do that is to have the *Bean.class in the base classloader,which
    is not what's recommended or move the support classes into the bean'sclassloader,
    which we cannot do.All correct.
    The purpose of this mail is to ask: is it a bug from weblogic server?No, it's how java classloaders work.
    Will it
    be fixed one day? If not, does it mean that it is impossible to isolateclasses
    for local access from public classes?You can expect that future versions of WLS will allow the user more
    control over classloaders, but for now you'll need public or protected
    access to cross classloaders.
    -- Rob
    Thank you, Khiet.

  • Accessing Java Classes from Forms

    Is is possible to access a Java class from Forms? I have been
    creating an Active X control that returns a Java object, and from
    that I can call methods on that object, but I would really like
    to do that without having and Active X control in the mix. Any
    suggestions?
    null

    Oracle Developer Team wrote:
    : Robert Nocera (guest) wrote:
    : : Oracle Developer Team wrote:
    : : : hey robert -
    : : : Developer 6.0 provides this ability for web deployment.
    You
    : : can
    : : : insert your own custom Java components into your
    application
    : : and
    : : : they will appear in the application when it is run via the
    : web.
    : : : If you look at the documentation for 6.0, there are a few
    : : : section son Pluggable Java Components and JavaBeans that
    : : : describes what is provided and how you use the interfaces
    : and
    : : : classes we provide.
    : : : A whitepaper on this topic will be posted to the OTN
    : shortly,
    : : as
    : : : well as some samples that illustrate how to go about doing
    : it.
    : : : cheers!
    : : : -Oracle Developer Team-
    : : Thanks for the quick response. Is there any way to access
    : those
    : : classes without being in a web deployment. That's probably
    : not
    : : totally out of the question, but what we had in mind was
    : adding
    : : some Java Functionality (actually connectictivity to some
    EJBs
    : : that we have) to existing forms. Currently there forms are
    : not
    : : deployed in a "web" environment and are just run from the
    : forms
    : : runtime engine.
    : : -Rob
    : hey again robert -
    : there's no easy way (yet!) to call out from forms runtime
    : process to a Java application.
    : We've played around some with creating an ORA_FFI interface to
    : JNI and then wrappering this with PL/SQL code. We've been able
    : to make calling into an EJB running in 8i from a forms runtime
    : work using this approach.
    : Let me know if this is of interest to you and I can post the
    : stuff we've currently got. It's no more than a simple demo and
    : is not complete. It requires quite a bit of manual coding on
    : the PL/SQL side since the interface emulates JNI (FindClass,
    : GetMethodID, CallMethodID, etc.).
    : cheers!
    : -the Oracle Developer Team-
    I'd be interested in this ORA_FFI doc you've been playing with.
    Would you please email it to me or post it.
    null

  • Accessing Java Classes from Webservice Stubs

    So far I have been able to call a web service and copy the appropriate directories and files to the designated class path.  I can also successfully access a class file like this:
    MyObject = CreateObject("java", "ca.x.y.z.TestCollection.TestItem");
    However, whenever I try to do something with that variable, I get a white screen.  Any text that should have appeared before the command, will appear, but nothing appears afterwards, not even debugging info.  Here are a couple of commands that will cause this to happen.
    <cfdump var = "#MyObject#">
    MyObject = CreateObject("java", "ca.x.y.z.TestCollection.TestItem").init();
    x = MyObject.init();
    Anybody have any ideas?

    Ah, nothing like a fresh set of eyes to remind of the fundamentals.  Thank you for that.
    I actually could create a normal error by calling a method incorrectly.  I would see the grey box and my debgging info would appear.  However, if I did something I expected to succeed, it would seem to stop.  Any text above that command would appear.  No error message, no de-bugging.
    But I didn't think to look in our error log.  I see things like:
    Could not initialize class com.microsoft.schemas._2003._10.Serialization.Arrays.ArrayOfstring
    or
    org.apache.axis.description.TypeDesc.(Ljava/lang/Class;Z)V
    At least it's not a mystery anymore.  Thanks again for suggesting the error log.

  • Accessing java classes from javascript

    Hi,
    I have the following javascript function
    function testjava {   
        var myString = new java.lang.String("Hello world"); // line 1
        alert("len:"+myString.length()); // line 2
    }It gives me a error at line 1 saying "'java' is undefined" in IE browser 5.5 sp2. But, both the lines execute correctly in netscape 6.
    Can someone please help..
    Thanks,
    Vijay.

    It seems that IE 5.5 doesn't support accessing java classes in JavaScript, so try to install IE 6 to see if it works or maybe, you doesn't have installed propertly support for JVM in IE.

  • Accessing a class from a loaded SWF

    In Flash Professional, I drew a shape, converted it to symbol, linked it to class Symbol1 (extends MovieClip) which is generated at run-time, and saved the SWF file as shape.swf.
    Now my main application wants to load shape.swf and create multiple instances of Symbol1 but I get ReferenceError when trying to access the class Symbol1.
    Below is my main application's code. Errors thrown are mentioned in comments.
    public class MovieClipTest extends Sprite
        public function MovieClipTest()
            var url:String = 'shapes.swf';
            var l:Loader = new Loader();
            l.contentLoaderInfo.addEventListener(Event.COMPLETE, f);
            l.load(new URLRequest(url), new LoaderContext(false, ApplicationDomain.currentDomain));
        private function f(event:Event):void
            var content:Sprite = (event.currentTarget as LoaderInfo).content as Sprite;
            trace(getQualifiedClassName(content.getChildAt(0))); // output: Symbol1
            trace(ApplicationDomain.currentDomain.getDefinition('Symbol1')); // throws Error #1065: Variable Symbol1 is not defined.
            trace(getDefinitionByName('Symbol1')); // throws Error #1065: Variable Symbol1 is not defined.

    Your "Symbol" is obviously not in the current ApplicationDomain, but in the loaded SWF's domain:
    var symbolClass:Class = event.target.applicationDomain.getDefinition("Symbol") as Class;
    var symbolInstance:MovieClip = new symbolClass() as MovieClip;
    Also because you're loading a SWF, the content of the Loader is a MovieClip, not a Sprite.
    Kenneth Kawamoto
    http://www.materiaprima.co.uk/

  • Access parent class from instance of nested class

    Hi,
    I have the following class hierarchy:
    public class BaseClass
    public class ParentClass
      private NestedClass    mNestedClass;
      public ParentClass()
        mNestedClass = new NestedClass();
      protected NestedClass getNestedClass()
        return mNestedClass;
      public static BaseClass createParentClass()
        parentClass = new ParentClass();
        // some code...
        return parentClass.getNestedClass();
      protected class NestedClass extends BaseClass
        NestedClass( int i )
          // some other code...
    }I cannot modify the classes above, as they are third-party and they are subject to changes...
    In my code, I may only use the static method to create an instance of ParentClass, because there is some important code (not accessible outside of the package) instead of the comments. The problem is that the static method only returns me an instance of the NestedClass, but not the ParentClass. For some reasons, I would need to access the instance of ParentClass.
    Is there a way (Java syntax, I mean) that would allow me to access from an instance of NestedClass the corresponding ParentClass instance?
    I know that inside a NestedClass method I may use ParentClass.this, but, as I wrote above, that class cannot be modified. Worse, I am not able to extend it neither, because the constructor is not public (or at least protected)...
    Please, does anybody have the correct answer?
    Thanks,
    Adrian

    There are at least 3 funny things in the code you posted:
    1) an instance of NestedClass cannot be created with "new NestedClass()", because the only constructor is NestedClass(int)
    2) I can't see why a method called "createParentClass" should return an instance of NestedClass
    3) The funniest: I really can't understand why you "may only use the static method to create an instance of ParentClass": if the ParentClass developer didn't want you to instantiate it directly, why did he made the constructor public?
    But the fact is there's no way to access the enclosing object of a nested object if the sw architect didn't want this (maybe including in the interface a method like this:
    class EnclosingClass {
      class NestedClass {
       EnclosingClass getEnclosingObject() {
        return EnclosingClass.this;
    This simply should break encapsulation and object hyerarchy security... really a bad thing I guess!!
    Bye

  • Accessing war classes from ejb-jar

    Hi,
    I've a.ear with b.war and c.jar. c.jar contains ejbs.
    I've some classes in b.war which i need to access from the ejbs.
    How may I achieve it? what do i need to configure in the app server or the ejb deployment descriptor?
    tx in adv
    Kejal

    are you absolute sure that the needed jar / class is
    in the classpath?Yes, there is no question about that. Because I can run the same app (unjarred version) with a command such as
    java MyApp
    without specifying classpath explicitly. And I also double checked that the postgresql.jar is listed in the CLASSPATH of my Windows box.
    Is the Class.forName the line where the ClassNotFound
    Exception is thrown?Yes, I caught the exception exactly at that line.
    I use the same for cloudscape�
    Object driver =
    Class.forName("com.ibm.db2.jcc.DB2Driver").newInstance
    ();and it works fine!Probably your app is not a jarred one, or is it?
    By the way, I have written JDBC codes hundreds of times, each time without any trouble. This is my first time I happened to run a JDBC app as an executable jar. And it failed. So I guess there must be other ways to load the class in this case.

  • "Best practice" for accessing a class from a custom component?

    My app utilizes a simple class to hold global properties such as username, session data, and similar data. The class is initialized at app startup via code similar to: appGlobals:myGlobals=new myGlobals.
    Many of the custom MXML components and AS classes need to access that data. I have been able to work with it using Application.application.appGlobals.propertyname.
    Is this method the best way to communicate from components and classes to a class initiated at the application level, or should I learn something new before I build a lot of code on this method?
    Thanks.
    Paul

    The WizardModel class is interesting, it is a "singleton" where it is designed to only have one instance, and the class actually has a static variable of its own class. Because that variable is static, an instance is created the first time the class is accessed.
    As to where the WizardModel is "first accessed" and thus its own variable of type WizardModel instantiated, is hard to say, as you really need to understand the application and component startup lifecycle indepth. I have a certain depth of knowledge of that but not enough depth to say definitively when WizardModel  is first accessed, but here are some possibilities:
    WizardModel.wizardTitle = WizardModel.wizardTitleBase;      In the WizardController "wizardTitleChangeHandler" event handler
    creationComplete="WizardModel.app = this;"      In the Wizard.mxml main app creationComplete handler
    <mx:Panel title="{WizardModel.wizardTitle}" width="100%" height="100%">    Opening tag of Panel in Wizard.mxml
    I know its confusing, but just try to absorb what you can for now, and over time it will become gradually more clear.

  • Composition in java : how to access super-class from sub-class

    I have 3 classes related by composition
    class A{
    B b = new B();
    class B{
    List<C> cList = new ArrayList<C>();
    in class C{
    getSample(){
         //Try to access class A     
    how can I access A from class C ?
    Any help is appreciated!

    well, 'Id' is known only to class A, and class C has a getSample() which is called in class A.
    class A{
    B b = new B();
    getID(){
    return id;
    b.getC().getSample();
    class B{
    List<C> cList = new ArrayList<C>();
    class C{
    getSample(){
    if() {
    //pick up value from properties file
    // format the value and parameter substitute it with 'Id' from A
    The design does seem a little weird, but I guess this is the only way to do this considering the other constraints we have ....
    TIA

  • Access Application Class from Model Class in BSP

    Hello,
    I am developing a BSP Application based on MVC. Is there any way, I can access the Application Class's Attribute from a Method in the Model Class?
    Thanksin Advance.
    Regards
    Gladson

    Hello,
    I solved it by passing the application class attribute to the model method, from the controller class.
    Regards
    Gladson

Maybe you are looking for