EJB classloader, xerces
Hi,
on a BEA 6.1, system administrators put xerces 1 into the classpath. I need to
deploy a EJB which user xerces 2, so I've unpacked xerces2 jar and included all
the classes into my EJB jar.
This doesn't work, i still have, correctly, the classloaders to load the xerces
1 classes. There's a way to force an "inverse" delegation for the EJB classloader
(as in a web app with, preferwebinfclasses).
Thank you!
Stefano.
The classloader that loades EJB is the root classloader of your application. One way to add more libraries to that classloader is modifying the orion-applicaiton.xml.
Similar Messages
-
EJB Classloader issue (dmcl40 library.dll already loaded)
I have written a stateless session bean. The session bean calls a documentum connection pool. This connection pool are java classes that use a dll (dmcl40.dll).
The Project is wrapped into a DC (one for ejb, one for app libs)
The dll-directory is set in the PATH environmentvariable.
Also, I set the classpath to my jar files in application-j2ee-engine.xml (tab expert settings -> classpath).
My problem is the EJB classloading. Any time the createSession method in the EJB (documentum) tries to create a session pool, i get the dmcl40 library already loaded error.
1. Where do I have to set the path to the library in WebAS to fix this?
2. is there a setting in the VisualAdmin, where one can set the path. Where can i set the path for parent classloader?
I am greateful for any hints.
thanks markusHi Markus,
Can u please let me know how did u solve ur problem?..
I am facing same problem and not able to fix it. So ur answer may be greatful to fix my problem..
Thanks in Advance.
Waiting ur Reply.
Best Regards,
Sadik. -
Deploying EAR and EJB (ClassLoader Question)
Hi,
Have a few queries. Appreciate any quick answers.
(a) To deploy a EAR or EJB jar to WebLogic server, is it necessary to include the jar location specifically in $CLASSPATH?
I think not. Am I correct?
(b) Is the bean/EAR deployed at module level? Is there a setting for this - is it at bean deployment descriptor? Where can I find this?
If (say) I need to update an EJB, do I un-deploy, update and re-deploy it?
Or must I restart the entire WLS container?--> An EAR includes one or more EJB files. You don't need to specify the location because it's contained at application.xml file inside the EAR.
--> Each bean has a deployment descriptor. You can see it at META-INF directory
If you need to update an EJB (that it is not part of and EAR), you are right.
The WLS container not need to be restarted.
Jin -
Classloading [EAR] - [webapp.war+ejb.jar]
Hi.
I've got a problem with the classloader hierarchy in WL 6.0.
When I deploy my war/ejb application as an EAR, everything works fine.
But I want (for several reasons) to deploy
EJB jars and WebApp wars (or exploded Web Apps) seperately.
WL 6.0 EJB classloader doesn't export remote/home interfaces and
helper classes,
so my web app can't find them.
When I include that interfaces/classes in my Web App, I get
occasionally ClassCastExceptions (I assume depending on classloader
caching).
Is there a way to configure the classloader hierarchy, or do you have
any other solution for this?
Thanks,
RomanHello,
I have a big application to do.
So, one solution should be to use an EAR for one
module, containing the WAR for the web-tier and the
EJB-JAR for the business-tier.
It would be better doing like this than creating a
big WAR, in order to avoid to deploy a big WAR when a
modification is done in one module.Are you using local EJBs or remote EJBs? The only way for a war to talk to a local EJB is to package the war along with the ejb-jar in an EAR file because they need to be collocated. You can not simply bundle EJB classes in a war file.
If you are using remte EJBs, then you can package the EJB client view classes along with the servlets and JSPs in the war file and deploy the war separately. But again your war will be one big war.
If your EJBs are just entity beans, then Java EE 5 (see http://weblogs.java.net/blog/ss141213/archive/2005/12/using_java_pers.html) allows you some nice options.
>
What about the problem of the session ?
In fact, I have to declare a context-root for one
EAR.
And at each context-root is created an object
HttpSession on the server.
So, I have some questions about this :
- How can I configure my WARs in order to use only
one HttpSession object for every WARs ?
There is no standard way to do this. Relying on any application server specific feature can only make your app non-portable. So I strongly recommend you not to do this.
- Can I put multiple WARs in one EAR ?Of course you can.
If yes, what about the context-root ? This solution would resolve
the session problem.Can't be solved using any standard way. So I suggest you stick to one big war, if that's what your business requirement is.To speed up development-deployment-test cycle, any appserver allows a rapid deployment option where in you can deploy incremental changes to server. Use this facility during development. DON'T sacrifice portability of your app by using any product specific configuration that you may not find any where else.
Thanks,
Sahoo -
Ejb deployment - classloader question
Hi Guys
I have a very basic question regarding EJB deployment in Weblogic 6.1 sp2.
Is it possble to create an EAR file such that -
1>it contains a WAR file [of servlets/jsps/client classes] - A
2>a jar file containing our core server classes[not EJBs] - B
3>a jar file containing EJBs - C
here A and C are definitely getting loaded by different class loaders - I want
the classloader for B to be parent of the classloaders for A and C - so that both
A and C can see B. - is this possible by some EAR/Weblogic specific way.
OR
the best solution is to place the B in the main classpath and deploy the C and
A in an EAR?
thanks
AnamitraInline.
Anamitra wrote:
Hi Guys
I have a very basic question regarding EJB deployment in Weblogic 6.1 sp2.
Is it possble to create an EAR file such that -
1>it contains a WAR file [of servlets/jsps/client classes] - A
2>a jar file containing our core server classes[not EJBs] - B
3>a jar file containing EJBs - C
here A and C are definitely getting loaded by different class loaders - I want
the classloader for B to be parent of the classloaders for A and C - so that both
A and C can see B. - is this possible by some EAR/Weblogic specific way.Made possible by placing B in the ear at the root level and referring to B with the
Class-Path manifest directive in the ejb jar file for C. This will put B in the ejb
classloader's classpath making it visible to C and to A since the classloader for C
is the parent of the classloader for A. Which, is the recommended way.
>
OR
the best solution is to place the B in the main classpath and deploy the C and
A in an EAR?
This works, but the classfiles in B are now static for the uptime of the server. If
you want to make changes in B, you must restart the server. If you configure it the
way described above, you can reload the B classes by redeploying the application ear.
>
thanks
AnamitraHere is the link with all of the info:
http://edocs.bea.com/wls/docs61/programming/packaging.html#1029830
Bill -
How to use a native library (.so) in EJB
Hi,
I know how to package a native library into a connector in iAS. But I don't quite know how to use it. Suppose I provide a wrapper java class for the native library, can I use the java class directly in my EJB (since the classloader of the RA is the parent of the EJB classloader) or I have to issue an outbound call?
Also, if I package the native library into a RA (standalone), iAS will automatically load it so in my wrapper java class, I don't have to call System.loadLibrary(...). Correct?
Thanks,
HaitaoThanks, Russ. My older Mac Pro is a 2,1 -- I think I only missed by a few months in buying one that would run Mavericks (64 bit EFI). I do intend to buy a "trashcan" Mac Pro but not just yet.
As for updating projects — that's my issue, I think. The Mac Pro and the laptop are networked so I can be working on my laptop and go to the Mac Pro and open the Final Cut Pro that is resident on that computer. What is odd is that it doesn't open any of the projects that normally open up with I start up FCP X on the Mac Pro.
I frequently work inside the house on my laptop running programs that are on my Mac Pro outside in my office — usually no problem at all with Adobe applications.
FCP X won't let me open a project by clicking on the project — it insists that I "Open projects from within FCP X" but they won't open that way. This what is odd — that it won't let me open projects even thought they are fully native to that version of FCP and are even on the same hard drive on the Mac Pro. -
How to define your own context in an EJB environment - possibly distributed
I would like to setup a context (an object accissible per logical thread) in an EJB environment, but I am too unfamiliar with the options I may have.
My objective is to create a context in which I may set a value, then invoke a method on an object (which in turn invokes a method on another object and so forth) and eventually get back the value from the context. In other words I am trying to pass a value without passing it as a parameter. More specifically, I have written a JDBC Driver wrapper in which I want to intercept a number of method calls and based on the context settings perform one or the other JDBC preprocessing. The reason for not passing the values as parameters is to interfere as little as possible with any environment in which this code is to be integrated. I simply want to set the context and get the context (in my JDBC wrapper) without the surrounding code needing to change.
I have succeded partially by using a ThreadLocal object to hold my context. I can set and get the values to and from the context and actually pass values to my Driver wrapper without explicitly passing them as parameters. This works well in a non-EJB environment. My concern arises when I switch to the EJB environment.
If my context is set in a session bean, which invokes an entity bean, am I then guaranteed that these will execute in the same physical thread?
If the session and the entity beans are hosted on seperate machines then the answer would certainly be NO. Is there any way to have the container manage the context and propagate it accross containers when needed?
Any thoughts or suggestions on this topic are wellcome, even if they don't solve the issue entirely.
Looking forward to hear from you all!
/poulIn an EJB environment, you have absolutely no control over threading issues. (It was purposefully designed that way.) However, you do have your own little "sandbox" in the EJB ClassLoader - which is why there is a lot of use of the Singleton pattern for factories and (very carefully!) as small caching mechanisms. You might want to look into that avenue - but you have to know how your EJB vendor's ClassLoader scheme works (there does appear to be a convergence in this area) and you must be very sensitive to potential thread-blocking operations that may take a while to complete.
-
Urgent! Serious problem with J2EE Classloader!
Hi all,
I'm having a serious problem with j2ee Classloading.
I have "inherited" a J2EE application where all business classes (invoked by the EJB) are placed in the Application's Server classpath (Weblogic 8.1.4).
Very bad because every time a class is changed the a.s. must be restarted.
So I re-enginereed the package putting the business classes in a jar that is referenced by the EJB's MANIFEST file.
This way all the classes would be loaded by the EJB classloader and no need to start/stop weblogic.
Unfortunately it's not such !! I discovered that all business classes are loaded via REFLECTION
Object objCommand = objClass.newInstance();
Object[] param = new Object[1];
param[0] = aDataContainer;
objDataContainerReturn = (DataContainer) objMethod.invoke(objCommand,param);
and the application server cannot find them using the standard J2EE Classloader mechanism.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at irma.business.Dispatcher.callService(Dispatcher.java:70)
Caused by: java.lang.NoClassDefFoundError: irma/utility/log/LogPrintStream
at irma.business.service.LoginService.login(LoginService.java:79)
On the other hand they're found if I put the classes on the application server classpath.
Has anybody got advice for this ? Should I refactor the application giving up reflection ?
Thanks a lot in advance.Reflection uses the classloader as well so it should work fine.
A common cause of a NoClassDefFoundError is something in a parent classloader that refers to something only available in a child loader.
For instance, do you have any of your application classes which are in the $CLASSPATH but reference something that is only (now) in the business.jar in your ear?
-- Rob
-- Rob
WLS Blog http://dev2dev.bea.com/blog/rwoollen/ -
Hello,
I'm running WLS7.0.
I have an entitybean for which I defined a business interface
EbusinessInterface that is package protected. I have my ejb jar part
of the classpath when I start my server.
When I try to make a rmi call from a client to access this bean, I
have the following error:
java.lang.IllegalAccessError: try to access class
com.foo.EbusinessInterface from class com.foo.EBean_1ipw_EOImpl_WLSkel
What I understand about that is that even if my ejb jar is part of the
classpath, the EBean_1ipw_EOImpl_WLSkel class ,the skeleton that is
generated, is loaded by the ejb classloader. Therefore, it cannot
access the EbusinessInterface that was loaded by a parent classloader
(due to the package protected visibility).
Am I right ?
Please don't tell me that I should not put the ejb jars as part of the
classpath, I know that, it's simply that I try to understand this
error in this specific context.
Thank you,
MathieuHello Mathieu,
Refer to http://dev2dev.bea.com/articles/musser.jsp for more information and best
practices regarding classloader issues.
Best regards,
Ryan LeCompte
[email protected]
http://www.louisiana.edu/~rml7669
[email protected] (Mathieu) wrote:
Hello,
I'm running WLS7.0.
I have an entitybean for which I defined a business interface
EbusinessInterface that is package protected. I have my ejb jar part
of the classpath when I start my server.
When I try to make a rmi call from a client to access this bean, I
have the following error:
java.lang.IllegalAccessError: try to access class
com.foo.EbusinessInterface from class com.foo.EBean_1ipw_EOImpl_WLSkel
What I understand about that is that even if my ejb jar is part of the
classpath, the EBean_1ipw_EOImpl_WLSkel class ,the skeleton that is
generated, is loaded by the ejb classloader. Therefore, it cannot
access the EbusinessInterface that was loaded by a parent classloader
(due to the package protected visibility).
Am I right ?
Please don't tell me that I should not put the ejb jars as part of the
classpath, I know that, it's simply that I try to understand this
error in this specific context.
Thank you,
Mathieu -
GetResourceAsStream problem in a EJB JAR
Hello,
I am trying to get a xml file from the same JAR file my EJB's are
bundled in on 6.1. Its not in the WAR file but the EJB jar file.
I've been trying to use:
getClass().getClassLoader().getResourceAsStream("www.xml")
and various different versions of this (using "/www.xml')
I've tried placing the xml file in the root of the JAR file and in the
same package as the class. I get the impression that its always
looking in the weblogic class path, and not the classloaders. (it
works if I place the file in the Weblogic6.1 dir)
Has anyone managed to retrieve file resources from their EJB JAR
files? If so how?
ThanksI do this by placing the resource file in it's own .jar file. Then place that .jar file in the .ear file with
the ejb .jar files. Then put the resource .jar file in the classpath using the Class-Path: manifest directive
in the ejb .jar files. Then you can use this.getClass().getResourceAsStream("/foo.xml") in the ejb bean
class.
I've never tried it by placing the resource file in the ejb .jar file. I would think it would work, but
apparently not?
Bill Kemp
BEA
Wayne wrote:
Actually I tried this and it doesn't seem to work. I imagine its
becuase the EJB classloader can't see the resources in the WAR file?
Remember I'm trying to load the resource from an EJB JAR file not a
WAR file.
Any idea's how I could do this?
thanks
Rajesh Mirchandani <[email protected]> wrote in message news:<[email protected]>...
If the file is in WEB-INF/classes within your WAR it should work if you
execute
this.getClass().getClassLoader().getResourceAsStream("www.xml");
Wayne wrote:
Hello,
I am trying to get a xml file from the same JAR file my EJB's are
bundled in on 6.1. Its not in the WAR file but the EJB jar file.
I've been trying to use:
getClass().getClassLoader().getResourceAsStream("www.xml")
and various different versions of this (using "/www.xml')
I've tried placing the xml file in the root of the JAR file and in the
same package as the class. I get the impression that its always
looking in the weblogic class path, and not the classloaders. (it
works if I place the file in the Weblogic6.1 dir)
Has anyone managed to retrieve file resources from their EJB JAR
files? If so how?
Thanks -
Where is RAR classloader in the classloader hierarchy?
The 6.1 docs re: packaging
(http://e-docs.bea.com/wls/docs61/programming/packaging.html)
state:
"When WebLogic Server deploys an application, it creates two new classloaders:
one for EJBs and one for Web applications. The EJB classloader is a child of the
Java system classloader and the Web application classloader is a child of the
EJB classloader. This allows classes in a Web application to locate EJB classes,
but EJB classes cannot locate Web application classes."
So where is a RAR's classloader in this scheme? Is another classloader created
as a peer of the EJB classloader? In that case, how can EJB's ever use classes
in common with a resource adapter? The case I have in mind is a resource-adapter-specific
subclass of ManagedConnectionFactory (call it FooManagedCnxnFactory): when
FooManagedCnxnFactory.equals(FooManagedCnxnFactory fmcf)
is called by the appserver during a Connection request, fmcf is not an instanceof
FooManagedCnxnFactory (although that's its classname) because it was loaded by
another classloader. How do the various classloaders relate, and how should I
package my resource adapter so that the classes get loaded by the proper classloader?
Thanks.
Jim Tomlinson
"Jim Tomlinson" <[email protected]> wrote in message
news:[email protected]...
>
> The 6.1 docs re: packaging
> (http://e-docs.bea.com/wls/docs61/programming/packaging.html)
> state:
>
> "When WebLogic Server deploys an application, it creates two new
classloaders:
> one for EJBs and one for Web applications. The EJB classloader is a child
of the
> Java system classloader and the Web application classloader is a child of
the
> EJB classloader. This allows classes in a Web application to locate EJB
classes,
> but EJB classes cannot locate Web application classes."
>
> So where is a RAR's classloader in this scheme? Is another classloader
created
> as a peer of the EJB classloader? In that case, how can EJB's ever use
classes
> in common with a resource adapter? The case I have in mind is a
resource-adapter-specific
> subclass of ManagedConnectionFactory (call it FooManagedCnxnFactory): when
> FooManagedCnxnFactory.equals(FooManagedCnxnFactory fmcf)
> is called by the appserver during a Connection request, fmcf is not an
instanceof
> FooManagedCnxnFactory (although that's its classname) because it was
loaded by
> another classloader. How do the various classloaders relate, and how
should I
> package my resource adapter so that the classes get loaded by the proper
classloader?
> Thanks.
There's no any connection between RAR classloader and EJB classloader. So
whenever you need any classes from RAR, you must have a copy in EJB-JAR. But
still you'll get a lot of classloader-related problems (like
ClassCastException). That's really a vague area in JCA 1.0
>
> Jim Tomlinson
Dmitri "Vinny" Girenko [email protected]
Software Developer http://www.akumiitti.fi/
Akumiitti Ltd GSM: +358 40 846 2486
Tammasaarenkatu 5 B Tel: +358 201 500 574
00180 Helsinki FAX: +358 201 500 502
Finland
-
WAR meta-inf/manifest Class-Path jars use which classloader ?
If using an expanded EAR structure, my Web App requires some utility classes. I
can either put these in my :-
meta-inf/manifest.mf
Class-Path : utility.jar
OR
web-inf/lib
can contain the utility.jar
Is there any difference in terms of which classloader is used to load these classes,
the EAR/EJB classloader or the Web App child classloader ?
What is recommended ?If have found out the answer myself by testing it :-
A jar in the meta-inf/manifest.mf e.g. Class-Path : utility.jar
will be loaded by the EAR/EJB level classloader
whereas
web-inf/lib containing utility.jar
will be loaded by the Web App level child classloader.
Dimitri Rakitine <[email protected]> wrote:
I have this question too - it appears that 6.1sp2 attempts to use Class-Path
in jars in WEB-INF/lib - what this Class-Path: is supposed to do ???
Pete <[email protected]> wrote:
If using an expanded EAR structure, my Web App requires some utilityclasses. I
can either put these in my :-
meta-inf/manifest.mf
Class-Path : utility.jar
OR
web-inf/lib
can contain the utility.jar
Is there any difference in terms of which classloader is used to loadthese classes,
the EAR/EJB classloader or the Web App child classloader ?
What is recommended ?--
Dimitri -
Connector Class Loader in OC4J Classloader Tree
Where does connector class loader fit in the OC4J class loader tree. Is it a parent to the EJB Classloader (as in SunOne) or does it use its own classloader to load classes (similar to weblogic). Becos it can impact visibility into resource adapter's classes.
The classloader tree in the ClassLoadingInOC4J_WP.pdf applies to 10.1.2 and 9.0.4, probably even earlier, where the connector classcloader is the root classloader of an application.
For 10.1.3, the root classloader of an application loads both connector jars and ejb jars. See chapter 3 of Oracle Containers for J2EE Developer's Guide(10.1.3 preview). -
EJB dependent libraries: NoClassDefFoundError
I am using Sun ONE Application Server 7 on a Win2K machine. In porting a working application from Oracle 9i App Server to Sun ONE, I experiece the following problem. When the application's EJB module attemtpts to call code in a third-party jar, a NoClassDefFoundError is thrown. The third-party jar is being deployed in the application's .ear. The jar is also listed in the EJB .jar's manifest file's Class-Path. Although this is in accordance with the J2EE specification, section 8.1.1.2, it does not appear to work in Sun ONE App Server.
Does anyone how to make third-party jars accessible to the EJB classloader in the Sun ONE App Server?
Thanks in Advance.Try to put your classes in a jar file and pur jar file in a class path.That may solve your problem
-
Webapp: ejb jars on servlet classpath
I have created a WebApplication (using WebLogic 5.1 sp8) that uses
the directory structure documented in http://www.weblogic.com/docs51/classdocs/webappguide.html#dirstruct
(with a web-inf/classes for servlet classes and web-inf/lib for
ejb jars)
According to http://www.weblogic.com/docs51/classdocs/API_ejb/EJB_deployover.html#1056431
, the public interface of my ejb's should be exported to the weblogic
classloader so that my servlet can use these classes when doing
remote calls.
When I run the weblogic console and check my web application's
servlet classpath however, I see that all jar files in web-inf/lib
have been included. So now my servlets have access to not only
the remote interface, but the entire implementation of my ejb's!
This is not what I want, or what should happen according to the
documentation.
Is there something I am doing wrong, is this a weblogic bug, or
is the documentation just wrong?
Luke Hutteman
Bank of America
In 5.1, ejb classloader will export public interfaces to weblogic
classloader automatically. And servlet can access those classes since
weblogic classloader is the parent of servlet classloader.
So, you do not need to pack your ejbs in jar and put them in WEB-INF/lib.
However, for application exception classes and other classes used by your
ejb, you have to pack them, either put them in weblogic.class.path or
WEB-INF/classes or WEB-INF/lib (as jar file)
My 2 cents.
Cheers - Wei
"Luke Hutteman" <[email protected]> wrote in message
news:[email protected]...
>
> I have created a WebApplication (using WebLogic 5.1 sp8) that uses
> the directory structure documented in
http://www.weblogic.com/docs51/classdocs/webappguide.html#dirstruct
> (with a web-inf/classes for servlet classes and web-inf/lib for
> ejb jars)
>
> According to
http://www.weblogic.com/docs51/classdocs/API_ejb/EJB_deployover.html#1056431
> , the public interface of my ejb's should be exported to the weblogic
> classloader so that my servlet can use these classes when doing
> remote calls.
>
> When I run the weblogic console and check my web application's
> servlet classpath however, I see that all jar files in web-inf/lib
> have been included. So now my servlets have access to not only
> the remote interface, but the entire implementation of my ejb's!
> This is not what I want, or what should happen according to the
> documentation.
>
> Is there something I am doing wrong, is this a weblogic bug, or
> is the documentation just wrong?
>
> Luke Hutteman
> Bank of America
>
Maybe you are looking for
-
What is the point of the Mail Activity pane (vs. Window Activity)?
I was happy to see this new little pane in the lower left corner, but I have yet to actually see it display anything. The old, separate Activity Window still shows everything in great detail, but I'd prefer the more compact version... if that's what
-
Crash furing Garageband3 Export to iTunes
I wanted to export a track to itunes from GB3. My itunes resides on external drive. When given the command to do so, GB3 displayed itunes as if it had never run. It cleared my whole list. (The files survived.) I then copied them to the "new " itunes,
-
Does anyone have a problem with their T500 wifi speed? I connect only at about 280kbps but my other laptop on the same nework connects at 2mbps. type added. Message Edited by Agotthelf on 07-04-2009 08:59 AM
-
SQL Developer 1.5 disable manual updates
We are creating an SMS package to push this out to the client desktops since we are trying to wean ourselves off of TOAD. We don't want users doing any updates to the client via the manual check updates. There is a check box for disabling auto update
-
Not specifically a Photoshop question really but maybe someone can help - I shoot RAW files and save them as Tifs when I edit them. I normally use a PC and these RAW > TIF files are usually around 20-25 mb each. But the same files loaded to the Macs