I am working on converting from v3.2.3 to version 4.0.3SP1.  I've run into a 
weird problem where an ArrayStoreException is being thrown.  The strange thing 
is it works fine in v3.2.3 running with the same sun jvm so I'm gussing there 
might be a class loader difference in 4.0.3SP1 which is causing the problem.  
Here's what's going on.

I have an interface which simplifed looks like this:

public interface OrderBy {
  |   public String getField();
  | }

Then I have an implementation which looks like this:

public class ProductOrderBy implements OrderBy {
  | 
  |   public static ProductOrderBy NAME = new ProductOrderBy("name");
  | 
  |   private String field;
  |   private ProductOrderBy(String s) {
  |     field = s;
  |   }
  |   public String getField() {
  |     return field;
  |   }
  | }
So far this is pretty simple stuff, nothing too exciting here.  I just have an 
interface, an implementation, and an exercise of the singleton pattern.

Now, when I use this in my code what I do is create an array of OrderBy 
interfaces.  So that code snippet looks like this:

  new OrderBy []{ProductOrderBy.NAME}

There is nothing wrong with the code.  It compiles fine and it should because 
ProductOrderBy implments the OrderBy interface so it should be able to be put 
into an OrderBy array.

Now when I run in v3.2.3 everthing works fine.  But now when I try to run in 
v4.0.3SP1 the creation of the array throws a java.lang.ArrayStoreException.  So 
I'm quite puzzled about this.

But it gets more weird.  As an experiment I tried changing the static singleton:

FROM THIS: 
public static ProductOrderBy NAME = new ProductOrderBy("name");

TO THIS: 
public static OrderBy NAME = new ProductOrderBy("name");

My though was if I defined the singleton as the interface instead of the 
implementing class it might help.  But this didn't work either.  I got a 
different error though.  I got: anonymous wrote : 
javax.servlet.ServletException: loader constraints violated when linking 
org/moss/sql/OrderBy class.

As a last effort I decided to try and change the way the array was created:

FROM THIS: 
new OrderBy []{ProductOrderBy.NAME}

TO THIS: 
new ProductOrderBy []{ProductOrderBy.NAME}

Doing this works and I don't get any errors.  So I guess it's a workaround to 
the problem but I still don't understand what the problem is.  I believe it 
should work the way I had it, after all it does work fine in v3.2.3.

My application deployment is very typical.  It is an ear file which looks like 
this:

/beans.jar        --My ejb's, manifest class-path uses jars in /library
  | /homesuite.war    --My webapp
  | /library/jar1.jar --classes used by the ejb's in beans.jar
  | /library/jar2.jar
  | /library/jar3.jar
  | /meta-inf/application.xml  
  | /meta-inf/jboss-app.xml   
  | /meta-inf/Manifest.mf       

Now in my case, the OrderBy interface is located in two places.  It's in the 
/library/jar1.jar file AND in the WEB-INF/lib/jar1.jar file inside the war.  
Everything's alwasy compiled together so there are no version issues.  The 
implementation class ProductOrderBy is inside the beans.jar file.  The bean.jar 
file is NOT in the WEB-INF/lib directory of the war.

I hope this makes sense.  I've tried to provide all the information I could.  
If anyone has any suggestions please let me know.  

Michael
[EMAIL PROTECTED]

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3946535#3946535

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3946535


-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to