History | Log In     View a printable version of the current page. Get help!  
Issue Details (XML | Word)

Key: JBSEAM-2592
Type: Patch Patch
Status: Closed Closed
Resolution: Done
Priority: Minor Minor
Assignee: Jay Balunas
Reporter: lauerc
Votes: 3
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Seam

Seam 2.0.1 GA patched to support BEA WebLogic Server 10.x with EJB3 support

Created: 07/Feb/08 02:24 AM   Updated: 14/May/08 08:34 AM
Component/s: Platform interoperability
Affects Version/s: 2.0.1.GA
Fix Version/s: 2.1.0.BETA1 , 2.0.2.GA

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
File Attachments: 1. Zip Archive examples-patches.zip (3 kb)
2. Zip Archive jboss-seam-2.0.1.GA-patches.zip (240 kb)
3. Text File SessionBeanInterceptor.java.patch (0.7 kb)

Environment: BEA WebLogic Server 10.0 MP1
Issue Links:
Duplicate
This issue duplicates:
JBSEAM-2482 Possible work around for Weblogic "va... Critical Closed
 
Related
 
This issue is related to:
JBSEAM-2964 glassfish jee5 example throws Illegal... Major Closed

JBoss Forum Reference: http://www.seamframework.org/Community/HotelBookingSampleRunsOnWeblogic10MP1
SourceForge Reference: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=129316
Affects: Interactive Demo/Tutorial, Compatibility/Configuration
Complexity: Medium


 Description  « Hide
Hi folks,

I'm currently in working on the meanwhile old WebLogic compatibility issue, which is a show stopper for products which are forced to run in an BEA environment and rely on EJB features.

The current situation is that the EJB3 compiler of WebLogic Server 10.x doesn't deploy JBoss Seam applications, because it doesn't support EJB3 interfaces containing methods with varars (Object...) definitions. This is obviously a bug, but it's known by the vendor of WebLogic for more than a year and meanwhile I don't believe anymore that is going to be fixed in short. This situation is critical for many projects, since this is a killer arguments against JBoss Seam.
Since it is more or less unknown what more supprises this mix brings, I started an affort to patch the current JBoss Seam version (2.0.1.GA) to work wis BEA WebLogic 10.0 MP1.

First of all I've replaced the varargs in interfaces to get one step beyond the known EJB3 compiler problem. This was quite easy because only one single EJB interface is affected:

    org.jboss.seam.async.Dispatcher

I've replaced the varargs definitions (Object...) by Object[], which is what the compiler creates anyway from it. For reasons of convenience, I've also created an method which completely reduces the method to the non variable parts.

Here's an example:

    public T scheduleTimedEvent(String type, S schedule, Object... parameters);

was turned into:

    public T scheduleTimedEvent(String type, S schedule);
    public T scheduleTimedEvent(String type, S schedule, Object[] parameters);


Maybe this is not as elegant as the varags solution, but it's a pragmatic way to suit our needs as I don't think BEA will fix the related problem in short.

The next problem I stumbled into was a classloading problem related to another problem in BEA WebLogic 10.0 MP1. The server only works properly with it's own jsf implementation which is not deployed by default. It is packed into a war archive located at

    wlserver_10.0/common/deployable-libraries/jsf-1.2.war


I've tried to deploy this archive which failed, so I unpacked it and placed the included jars into the 'lib' folder below my weblogic domain root.

After that I found out, that one jboss jar, which is needed to run the application under other application servers was missing in the seam distribution. I placed this file (concurrent.jar) into the folder lib below by test application subproject (examples/jee5/lib).

After some more deployment descriptor related changes, which I will not describe in detail, the application seems to work at first.
Unfortunately I detected runtime failures when playing around with the booking application. From time to time the application failed with an InvocationTargetException. After hours of code analyzing and debugging, I found out that the problem has to be a side effect of different EJB lifecycle implementation in WebLogic Server compared to JBoss AS (I don't know which behaviour is wrong or right, and I won't judge it here).

Actually the method postConstruct(...) of class

    org.jboss.seam.intercept.SessionBeanInterceptor

seems to rule the initialization of this interceptor. This method seems to be called before any call of aroundInvoke at JBoss AS. On WebLogic Server this is different. As a result of this sometimes the injection field or method invoking for a specific object is executed using the reflection fields and methods of different component classes. To fix this problem, I've copied the initialization calls from method post construct into the method aroundInvoke to make sure that it is called prior to the actual invocation. After this change the booking demo seems to work perfectly.

I've packed all source changes and the missing jar file into one zip archive and will post it into this thread. To use this, simply extract it below the exploded distro archive and rebuild first seam and then the jee5/booking demo.

Best regards,
Christian

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order:
lauerc [07/Feb/08 02:26 AM]
Patches for JBoss Seam 2.0.1.GA to gain WebLogic Server compatibility.

Pete Muir [10/Feb/08 07:20 PM]
I will look at the interceptor issue.

The timer issue we will work around by not supporting EJB timers in WLS

Pete Muir [10/Feb/08 07:21 PM]
Can you please post the interceptor changes separately in a diff format?

lauerc [11/Feb/08 12:12 PM]
Hi Pete,

the patch of the session bean is quite small. Only the method aroundInvoke(InvocationContext) is affected.
I've marked it with START/END comments. You should be able to detect it easily.

Here's the snippet:

   @AroundInvoke
   public Object aroundInvoke(InvocationContext invocation) throws Exception
   {
     // START: changed by lauerc
     //System.out.println("SESSIONBEANINTERCEPTOR::aroundInvoke: " + invocation.getTarget().getClass().getName() + ", COMPONENT: '" + getComponentName() + "' ...");
     Component invokingComponent = SessionBeanInterceptor.COMPONENT.get();
     Object bean = invocation.getTarget();
     if ( invokingComponent!=null && invokingComponent.getBeanClass().isInstance(bean) )
     {
        init(invokingComponent);
     }
     // END: changed by lauerc
     return invoke( new EJBInvocationContext(invocation), EventType.AROUND_INVOKE);
   }

Furthermore I've got news from the BEA front: I was able to fix the varars problem.
Unfortunately I discovered that the fix just works for my simple example, the affected Seam Component still doesn't deploy.
I've managed to reproduce this problem and openend another case.
I hope the problem will be finally fixed in short. I'll keep you up to date.

Best regards,
Christian

Jay Balunas [10/Mar/08 01:26 PM]
A user has announced that BEA has a patch to resolve the EJB3 varargs issues (CR327275) on weblogic 10.X. This needs to be downloaded and tested - with updates to the docs as needed. http://www.seamframework.org/Community/WeblogicCR327275AvailableForEJBBlockers

lauerc [12/Mar/08 05:47 AM]
Hi Jay,

this patch doesn't fully solve the problem it only makes simple EJBs with varargs work.
The Seam Timer Component still doesn't work. I've openend another case to get it fixed, but unfortunately theres

lauerc [12/Mar/08 06:47 AM]
no solution available yet.

The current problem is, that the method scheduleAsynchronousEvent is not included in the internal stubs for mysterious reasons which makes the deployment fail. This bug has been confirmed BEA support. They have filed a new CR (number is CR363182) to get this issue fixed.
I'll inform you when I've got a working patch.

Best regards,
Christian


lauerc [13/Mar/08 05:54 AM]
Hi Pete, Hi Jay,

as there's still no reliable solution for WebLogic 10 and varargs, I strongly suggest to move the timer components into an optional jar file (e.g. jboss-seam-timer.jar). We did this on our side to get seam 2.0.1 properly working on WebLogic 10 MP1.

Additionally we need my posted changes of the SessionBeanInterceptor class. How are your decisions regarding this issue?

Best regards,
Christian

Jay Balunas [13/Mar/08 09:26 AM]
Hi Christian,

I am going to try the patch (probably next week), and see what I can get working. We were going to create a special weblogic jar that did not contain the timer ejb because we did not want to restructure Seam core to work around a weblogic bug. Depending on what is found with my investigation and what BEA puts out for fixes it may not be needed.

Pete will have to comment on the SessionBeanInterceptor changes though.

Thanks,
-Jay

Pete Muir [13/Mar/08 10:27 AM]
Please post the SessionBeanInterceptor changes in unified diff format against trunk so I can review them.

lauerc [14/Mar/08 03:22 AM]
Hi Pete,

it's really only the change in method aroundInvoke, I've posted at February 8th.

If you really need it in 'unified diff format', please tell me how to create this.

Best regards,
Christian

Pete Muir [14/Mar/08 04:56 AM]
diff -u3 OLDFILE NEWFILE > JBSEAM-2592.txt, or use your IDE.

lauerc [14/Mar/08 10:50 PM]
Hi Pete,

finally here is the patch.
I've tested it with the head branch today.
You'll still need it to get Seam applications working on WebLogic 10.x

Best regards,
Christian

lauerc [14/Mar/08 11:11 PM]
Hi Pete,

here's a bundle of patches, needed to get the jee5 booking example build for weblogic.

Here my change descriptions:

build
  - core.pom.xml: Added dependency to oswego-concurrent, which is needed by weblogic server to run
  - root.pom.xml: Same as for core.pom.xml

examples/jee5/booking
  - build.xml: Added support for weblogic-application.xml + concurrent.jar

examples/jee5/booking/resources/META-INF
  - add weblogic-application.xml to solve a problem with antl.jar versions
  - persistence.xml: Changed configuration for weblogic

examples/jee5/booking/resources/WEB-INF
  - web.xml: Added missing listener com.sun.faces.config.ConfigureListener.

Hope these patches help you to build an officially working WebLogic 10 example soon.

Best regards,
Christian



Jay Balunas [24/Mar/08 09:20 AM]
Added a forum reference with more information on the BEA patch, and what is needed.

Jay Balunas [09/May/08 02:15 PM]
After reviewing the patches provided by Christian, and looking into the issue in depth I have found the root cause of the "lifecycle" issues described above.

As discussed in JBSEAM-2482 the user provided patch for sessionBeanInterceptor does seem to fix the issue. However this is handled by reinitializing the component interceptor for each "aroundInvoke" call. This patch also does not solve the same issue when a request uses the "ClientSideInterceptor" such as a text entry in the hotel search input box.

The root of the problem is that weblogic is only using a single instance of the sessionBeanInterceptor for all session beans. Seam's sessionBeanInterceptor caches and stores some component specific attributes. So when a call comes in - the interceptor is primed for a different component and the error is seen.

To solve this problem you must define a separate interceptor binding for each EJB you wish to use. When you do this weblogic will use a separate instance for each EJB. Below is the ejb-jar.xml file that I created and tested the seam jee5 booking example with.

There are still some changes to the deployment as commented on above, and found in my research. These are only seen after getting around the "varargs" issue. I will be updating the Seam reference guide with this information.

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
         version="3.0">
   
   
   <interceptors>
     <interceptor>
       <interceptor-class>org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
     </interceptor>
   </interceptors>
   
   <assembly-descriptor>
      <interceptor-binding>
         <ejb-name>AuthenticatorAction</ejb-name>
         <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
      <interceptor-binding>
         <ejb-name>BookingListAction</ejb-name>
         <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
      <interceptor-binding>
         <ejb-name>RegisterAction</ejb-name>
         <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
      <interceptor-binding>
         <ejb-name>ChangePasswordAction</ejb-name>
         <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
      <interceptor-binding>
         <ejb-name>HotelBookingAction</ejb-name>
         <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
      <interceptor-binding>
         <ejb-name>HotelSearchingAction</ejb-name>
         <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
      <interceptor-binding>
         <ejb-name>EjbSynchronizations</ejb-name>
         <interceptor-class >org.jboss.seam.ejb.SeamInterceptor</interceptor-class>
      </interceptor-binding>
   </assembly-descriptor>

</ejb-jar>

lauerc [12/May/08 01:17 PM]
Hi Jay,

your suggested change seems to fully solve this issue.
Thanks a lot for the good work so far!

Please consider to add the changes from the attached "examples-patch.zip" together with your latest change to help others to build a working WLS example easily.

Best regards,
Christian

Jay Balunas [12/May/08 03:39 PM]
This has been investigated, solved, and an updated weblogic reference guide chapter has been written.

The SessionBeanInterceptor patch is not needed with these updates The hsqldb.jar and concurrent.jar has been added to distribution because they are needed for several interop examples.

The other changes (weblogic-application.xml, etc...) are not going to be part of the jee5/booking example because it was written specifically for glassfish support. The reference guide provides detailed information for any changes that are needed.

When the BEA patch is available for the outstanding EJB issue with the EJB timer a new jira should be created and the chapter will be reviewed again.


Jay Balunas [12/May/08 04:47 PM]
Could you post this on seamframework.org forums with more information on steps you followed, when you get the error, and any other information. I did see an error similar to this while investigating, but when all changes were completed I did not see it.

Thanks,
Jay

Jay Balunas [13/May/08 11:38 AM]
I was able to reproduce this lockout exception, but it was sporadic. It seems to be a timing issue with the hotel search input box.

I was able to make it very hard to reproduce by modifying main.xhtml so that ajax4jsf uses an event queue and passes along the coversation ID - see below. I will most likely be adding this to the 2.0.2.GA release to help this issue. The various weblogic options did not seem to help.

<a:support event="onkeyup" actionListener="#{hotelSearch.find}" reRender="searchResults" eventsQueue="searchQueue">
            <s:conversationId/>
         </a:support>

If I really machine gunned the search I could still get it to happen. It will be looked at further some time after 2.0.2.GA.

Jay Balunas [14/May/08 08:33 AM]
This issue is related to JBSEAM-2964 - the final change in this jira fixed JBSEAM-2964.