[Tomcat, HTTPD, Servlets & JSP] - NoClassDefFoundError in a expanded war from its own /lib/ ja
by icordoba
Hi there,
i am trying tu configure class loading in JBoss 4.0.5
I have an .ear file with <loader-repository-config> and java2ParentDelegation=true
I need to access classes in this .ear from my war application, deployed in a war dir (I need to work on it, can't package it in the .ear file)
I've tried to reference to the same class loader with jboss-web.xml and tried all combinations of java2ParentDelegation and java2ClassLoadingCompliance flags with no success. The most I've been able to achieve is loding the classes in the ear' jars but classes in /WEB-INF/lib/ jars are then invisible to the webapp (¿?). How can I make the webapp mix both class loaders?
Thanks for any help. Please don't point me to those 2 documents about JBoss class loading. I've been reading them for years and, as happens with many JBoss users, can't get a clear picture of all this flags. ¿Any alternative documents about class loading configuration in web apps in JBoss? Thanks for any help until some one writes that pending Web Class Loading WiKi.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049282#4049282
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049282
18 years, 10 months
[JBoss Seam] - Question: hot to instantiate Home class correctly?
by anescu
Hi,
We have a Seam generated app, we're making some modifications, so we have the XHome class to manage the entity X.
Now, we have a hierarchy, A, B, C, all inherit from D, each has it's own home class (the use joined for inheritance type, each class has its own attributes).
We have another entity E, which has a relation to D (but in fact under the hood can be any of A, B, C)
Now, we have an action when if I save E, I have to create a new intance of D and save it. So for this, I made a factory to retrieve the correct Home for the D object (that is, retrieve AHome for a A entity and so on)
I have tried 2 aproaches, here they are:
1) In EHome, I use @In to declare AHome, BHome, CHome
In the factory, I use a TreeMap to store key pairs, between the entity and the home class bound name (ex: "package1.A", "aHome")
I have a method that retrieves from the context the Home based on the name.
2) In the factory I store in the map keys to retrieve the home class name (ex: "package1.A", "package2.AHome")
Then I instantiate it like this:
Class.forName( homeName ).newInstance()
In both cases the method returns the BasicHome (extended by AHome, BHome, CHome), and we call the persist method on it.
The first method works, but since we have about 20 classes extending from D it is not very good.
The second throws some NullPointerException inside some of the Seam framework classes:
I managed to figure one out, if i put this code I get reed of the first exception:
home.setEntityClass( package1.A.class );
Here is the stack:
java.lang.NullPointerException
| at org.jboss.seam.framework.Controller.debug(Controller.java:183)
| at org.jboss.seam.framework.Home.createdMessage(Home.java:52)
| at org.jboss.seam.framework.EntityHome.persist(EntityHome.java:51)
So I'm asking what is the difference?
I mean, what is different is that the solution 1) uses the @In, and 2) uses the normal way of creating a class instance. I looked into the Seam code and I have not found any special constructors, one that sets some attributes or does anything special. So, what did I miss???
The line where the error is produced is this:
log.debug(object, params);
So log is null.
Log is instantiated like this:
@Logger Log log;
So, apparently, with the @In annotation, the log gets instantiated, but on the second method I tried it doesn't.
Does Seam provide some methods to instantiate the classes?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4049271#4049271
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4049271
18 years, 10 months