This repository has been archived by the owner on Nov 10, 2017. It is now read-only.
forked from VaclavDedik/jboss-seam
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Weblogic.xml
executable file
·1493 lines (1416 loc) · 69.3 KB
/
Weblogic.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<chapter id="weblogic">
<title>Seam on BEA's Weblogic</title>
<para> Weblogic 10.3 is BEA's latest stable JEE5 server offering. Seam
applications can be deployed and developed on Weblogic servers, and
this chapter will show you how. There are some known issues with the
Weblogic servers that will need to be worked around, and configuration
changes that are needed specific to Weblogic. </para>
<para> First step is to get Weblogic downloaded, installed and running. Then
we'll talk about Seam's JEE5 example and the hurdles to
getting it running. After that, the JPA example will
be deployed to the server. Then finally we will create a
<literal>seam-gen</literal> application and get it up and running to
provide a jump start to your own application. </para>
<section>
<title>Installation and operation of Weblogic</title>
<para> First things first we need to get the server installed. There are
some outstanding issues that were not addressed in 10.3, but it does
solve some of the issues discussed below without the need for BEA
patches. The previous release 10.0.MP1 is also available, but
requires some BEA patches to function correctly. </para>
<itemizedlist>
<listitem>
<para><literal>Weblogic 10.0.MP1</literal>
— <ulink
url="http://www.oracle.com/technology/software/products/ias/htdocs/wls_main.html">
Download page </ulink></para>
<para> 10.0.MP1 has some known issues with EJBs that use
<literal>varargs</literal> in their methods (it confuses them
as <literal>transient</literal> ), as well as some others.
See <xref linkend="weblogic-ejb-issues" /> for full details on
the issues and the work around.</para>
</listitem>
<listitem>
<para><literal>Weblogic 10.3</literal>
— <ulink
url="http://www.oracle.com/technology/software/products/ias/htdocs/wls_main.html">
Download page </ulink></para>
<para> This is the latest stable release of the Weblogic server,
and the one that will be used with the examples below. This
version has addressed some of the issues with EJBs that were in
10.0.MP1. However one of the changes did not make it into this
release. See <xref linkend="weblogic-ejb-issues" /> for the
details, but because of this we still need to use the special
Weblogic seam jar discussed below.
</para>
</listitem>
</itemizedlist>
<note>
<title>Special <literal>jboss-seam.jar</literal> for Weblogic EJB
Support</title>
<para> Starting with Seam 2.0.2.CR2 a special Weblogic specific jar has
been created that does not contain the <literal>TimerServiceDispatcher
</literal>. This is the EJB that uses <literal>varargs</literal> and
exposes the second EJB issue. We will be using this jar for the
<literal>jee5/booking</literal> example, as it avoids the known BEA
issues.
</para>
</note>
<section>
<title>Installing 10.3</title>
<para>
Here are the quick steps to installing Weblogic 10.3.
For more details or if you are having any issues please
check with the BEA docs at the
<ulink url="http://edocs.bea.com/wls/docs103/">
Weblogic 10.3 Doc Center
</ulink>
. Here we install the RHEL 5 version using the graphical
installer:
</para>
<orderedlist>
<listitem>
<para> Follow the link given above for 10.3 and download the
correct version for your environment. You will need to sign up
for an account with Oracle in order to do this. </para>
</listitem>
<listitem>
<para> You may need to change the
<literal>server103_XX.bin</literal> file to be
executable: </para>
<programlisting>chmod a+x server103_XX.bin</programlisting>
</listitem>
<listitem>
<para> Execute the install: </para>
<programlisting>./server103_XX.bin</programlisting>
</listitem>
<listitem>
<para> When the graphical install loads, you need to set the BEA
home location. This is where all BEA applications are
installed. This location will be known as
<literal>$BEA_HOME</literal> in this document e.g.:
</para>
<programlisting>/jboss/apps/bea</programlisting>
</listitem>
<listitem>
<para> Select <literal>Complete</literal> as the
installation type. You do not need all the extras of the
complete install (such as struts and beehive libraries), but
it will not hurt. </para>
</listitem>
<listitem>
<para> You can leave the defaults for the component installation
locations on the next page.</para>
</listitem>
</orderedlist>
</section>
<section id="weblogic-domain">
<title>Creating your Weblogic domain</title>
<para> A Weblogic domain is similar to a JBoss server configuration - it
is a self contained server instance. The Weblogic server you just
installed has some example domains, but we are going to create one
just for the seam examples. You can use the existing domains if you
wish (modify the instructions as needed). </para>
<orderedlist>
<listitem>
<para> Start up the Weblogic configuration wizard:</para>
<programlisting>$BEA_HOME/wlserver_10.3/common/bin/config.sh
</programlisting>
</listitem>
<listitem>
<para> Choose to create a new domain, configured to support
<literal>Weblogic Server</literal>. Note that this is
the default domain option. </para>
</listitem>
<listitem>
<para>Set a username and password for this domain.</para>
</listitem>
<listitem>
<para> Next choose <literal>Development Mode</literal> and
the default JDK when given the option. </para>
</listitem>
<listitem>
<para> The next screen asks if you want to customize any setting.
Select <literal>No</literal>. </para>
</listitem>
<listitem>
<para> Finally set the name of the domain to
<literal>seam_examples</literal> and leave the default
domain location. </para>
</listitem>
</orderedlist>
</section>
<section id="bea_start_stop_access">
<title>How to Start/Stop/Access your domain</title>
<para>
Now that the server is installed and the domain is created
you need to know how to start and stop it, plus how to
access its configuration console.
</para>
<itemizedlist>
<listitem>
<para> Starting the domain:</para>
<para> This is the easy part - go to the <literal>
$BEA_HOME/user_projects/domains/seam_examples/bin
</literal> directory and run the
<literal>./startWeblogic.sh</literal> script. </para>
</listitem>
<listitem>
<para> Accessing the configuration console:</para>
<para> Launch
<literal>http://127.0.0.1:7001/console</literal> in
your web browser. It will ask for your username and password
that you entered before. We won't get into this much now, but
this is the starting point for a lot of the various
configurations that are needed later. </para>
</listitem>
<listitem>
<para> Stopping the domain:</para>
<para> There are a couple of options here: </para>
<itemizedlist>
<listitem>
<para> The recommended way is through the configuration
console:
<orderedlist>
<listitem>
<para> Select
<literal>seam_examples</literal> on the
left hand side of the console. </para>
</listitem>
<listitem>
<para> Choose the
<literal>Control</literal> tab in the
middle of the page. </para>
</listitem>
<listitem>
<para> Select the check box
<literal>AdminServer</literal> in the
table. </para>
</listitem>
<listitem>
<para> Choose <literal>Shutdown</literal>
just above the table, and select either
<literal>When work completes</literal>
or <literal>Force shutdown now</literal>
as appropriate. </para>
</listitem>
</orderedlist> </para>
</listitem>
<listitem>
<para> Hitting <literal>Ctrl-C</literal> in the
terminal where you started the domain.</para>
<para> No negative effects have been seen, but we would not
recommend doing this while in the middle of
configuration changes in the console. </para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para><note>
<title>A note on Weblogic classloading</title>
<para>When using the
<literal>/autodeploy</literal> directory as
described in this chapter you may see
<literal>NoClassDefFound</literal> exceptions during
redeployment's. If you see this try restarting the Weblogic
server. If you still see it remove the auto-deployed
EAR/WAR files, restart the server, and redeploy. We could
not find a specific reason for this, but others seem to be
having this issue as well. </para> </note></para>
</listitem>
</itemizedlist>
</section>
<section id="weblogic-jsf-deploy">
<title>Setting up Weblogic's JSF Support</title>
<para>These are the instructions to deploy and configure Weblogic's
JSF 1.2 libraries. Out of the box Weblogic does not come with its
own JSF libraries active. For complete details see
<ulink url="http://edocs.bea.com/wls/docs103/webapp/configurejsfandjtsl.html">
Weblogic 10.3 Configuring JSF and JSTL Libraries
</ulink></para>
<orderedlist>
<listitem>
<para>In the administration console navigate to the
<literal>Deployments</literal> page using the left hand
menu.</para>
</listitem>
<listitem>
<para>Then select the <literal>Install</literal>
button at the top of the deployments table</para>
</listitem>
<listitem>
<para>Using the directory browser navigate to the
<literal>$BEA_HOME/wlserver_10.3/common/deployable-libraries
</literal>
directory. Then select the <literal>jsf-1.2.war</literal>
archive, and click the <literal>Next</literal> button.</para>
</listitem>
<listitem>
<para>Make sure that the <literal>Install this deployment
as a library</literal> is selected. Click the <literal>
Next </literal> button on the <literal>Install Application
Assistant</literal> page.</para>
</listitem>
<listitem>
<para>Click the <literal>Next</literal> button on the
<literal> Optional Settings</literal> page.</para>
</listitem>
<listitem>
<para>Make sure that the <literal>Yes, take me to the
deployment's configuration screen.</literal> is selected.
Click the <literal>Finish</literal> button on the <literal>
Review your choices and click Finish</literal> page.</para>
</listitem>
<listitem>
<para>On the <literal>Settings for jsf(1.2,1.2.3.1)</literal>
page set the <literal>Deployment Order</literal> to
<literal>99</literal> so that it is deployed prior to
auto deployed applications. Then click the <literal>
Save</literal> button.</para>
</listitem>
</orderedlist>
<para>There is another step that is needed for this to work. For
some reason, even with the steps above classes in the <literal>
jsf-api.jar</literal> are not found during application deployment.
The only way for this to work is to put the <literal>
javax.jsf_1.2.0.0.jar</literal> (the jsf-api.jar) from
<literal>jsf-1.2.war</literal> in the domains shared library.
This requires a restart of the server.
</para>
</section>
</section>
<section>
<title> The <literal>jee5/booking</literal> Example </title>
<para>
Do you want to run Seam using EJB's on Weblogic? If so there
are some obstacles that you will have to avoid, or some patches that
are needed from BEA. This section describes those obstacles and what
changes are needed to the <literal>jee5/booking</literal>
example to get it deployed and functioning.
</para>
<section id="weblogic-ejb-issues">
<title>EJB3 Issues with Weblogic</title>
<para>
For several releases of Weblogic there has been an issue
with how Weblogic generates stubs and compiles EJB's that use
variable arguments in their methods. This is confirmed in the
Weblogic 9.X and 10.0.MP1 versions. Unfortunately the 10.3 version
only partially addresses the issue as detailed below.
</para>
<section>
<title>The <literal>varargs</literal> Issue</title>
<para>
The basic explanation of the issue is that the Weblogic EJB
compiler mistakes methods that use <literal>varargs</literal>
as having the <literal>transient</literal> modifier. When
BEA generates its own stub class from those classes during
deployment it fails and the deployment does not succeed. Seam uses
variable arguments in one of its internal EJB's (
<literal>TimerServiceDispatcher</literal>). If you see exceptions
like below during deployment you are running an unpatched version
of 10.0.MP1.
</para>
<programlisting><![CDATA[java.io.IOException: Compiler failed executable.exec:
/jboss/apps/bea/wlserver_10.0/user_projects/domains/seam_examples/servers/AdminServer
/cache/EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/
TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:194: modifier transient
not allowed here
public transient javax.ejb.Timer scheduleAsynchronousEvent(java.lang.String arg0,
java.lang.Object[] arg1)
^
/jboss/apps/bea/wlserver_10.0/user_projects/domains/seam_examples/servers/AdminServer
/cache/EJBCompilerCache/5yo5dk9ti3yo/org/jboss/seam/async/
TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java:275: modifier transient
not allowed here
public transient javax.ejb.Timer scheduleTimedEvent(java.lang.String arg0,
org.jboss.seam.async.TimerSchedule arg1, java.lang.Object[] arg2)]]></programlisting>
<para>
This issue has been fixed in Weblogic 10.3, and BEA has created
a patch for Weblogic 10.0.MP1 (
<literal>CR327275</literal>
) for this issue that can be requested from their
support.
</para>
<para>
Unfortunately a second issue has been reported and
verified by BEA.
</para>
</section>
<section>
<title>Missing EJB Methods Issue</title>
<para>
This issue was only found once the <literal>CR327275</literal>
patch had been applied to 10.0.MP1. This new issue has been
confirmed by BEA and they created a patch for 10.0.MP1 that
addresses this issue. This patch has been referred to as both
<literal>CR370259</literal> and <literal>CR363182</literal>. As
with the other patch this can be requested through the BEA support.
</para>
<para>
This issue causes certain EJB methods to be
incorrectly left out of Weblogic's generated internal stub
classes. This results in the following error messages during
deployment.
</para>
<programlisting><![CDATA[<<Error> <EJB> <BEA-012036> <Compiling generated EJB classes produced the following Java compiler error message:
<Compilation Error> TimerServiceDispatcher_qzt5w2_Impl.java: The type TimerServiceDispatcher_qzt5w2_Impl must implement the inherited abstract method TimerServiceDispatcher_qzt5w2_Intf.scheduleTimedEvent(String, Schedule, Object[])
<Compilation Error> TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java: Type mismatch: cannot convert from Object to Timer
<Compilation Error> TimerServiceDispatcher_qzt5w2_LocalTimerServiceDispatcherImpl.java: Type mismatch: cannot convert from Object to Timer>
<Error> <Deployer> <BEA-149265> <Failure occurred in the execution of deployment request with ID '1223409267344' for task '0'. Error is: 'weblogic.application.ModuleException: Exception preparing module: EJBModule(jboss-seam.jar)]]></programlisting>
<para>
It appears that when Weblogic 10.3 was released the neglected to
include this fix!! This means that Weblogic 10.0.MP1 with patches
will function correctly, but 10.3 will still require the special
Seam jar described below. Not all users have seen this and there
may be certain combinations of OS/JRE that do not see this,
however is has been seen many times. Hopefully Oracle/BEA will
release an updated patch for this issue on 10.3. When they do we
will update this reference guide as needed.
</para>
</section>
<para>
So that Seam's users can deploy an EJB application to
Weblogic a special Weblogic specific jar has been
created, starting with Seam 2.0.2.CR2. It is located in
the
<literal>$SEAM/lib/interop</literal>
directory and is called
<literal>jboss-seam-wls-compatible.jar</literal>
. The only difference between this jar and the
<literal>jboss-seam.jar</literal>
is that it does not contain the
<literal>TimerServiceDispatcher</literal>
EJB. To use this jar simply rename the
<literal>jboss-seam-wls-compatible.jar</literal>
to
<literal>jboss-seam.jar</literal>
and replace the original in your applications
<literal>EAR</literal>
file. The
<literal>jee5/booking</literal>
example demonstrates this. Obviously with this jar you will not
be able to use the <literal>TimerServiceDispatcher</literal>
functionality.
</para>
</section>
<section>
<title>Getting the <literal>jee5/booking</literal> Working</title>
<para>In this section we will go over the steps needed to get
the <literal>jee5/booking</literal> example to up and running.</para>
<section id="weblogic-hsql-jee5-ds">
<title>Setting up the hsql datasource</title>
<para>This example uses the in memory hypersonic database, and the
correct data source needs to be set up. The admin console uses a
wizard like set of pages to configure it.
<orderedlist>
<listitem>
<para>Copy <literal>hsqldb.jar</literal> to the Weblogic
domain's shared library directory: <literal> cp
$SEAM_HOME/lib/hsqldb.jar
$BEA_HOME/user_projects/domains/seam_examples/lib
</literal>
</para>
</listitem>
<listitem>
<para>Start up the server and navigate to the
administration console following <xref
linkend="bea_start_stop_access"/></para>
</listitem>
<listitem>
<para>On the left side tree navigate
<literal>seam_examples - Services- JDBC - Data
Sources</literal>.</para>
</listitem>
<listitem>
<para>Then select the <literal>New</literal>
button at the top of the data source table</para>
</listitem>
<listitem>
<para>Fill in the following:
<orderedlist>
<listitem>
<para>Name:
<literal>seam-jee5-ds</literal>
</para>
</listitem>
<listitem>
<para>JNDI Name:
<literal>seam-jee5-ds</literal>
</para>
</listitem>
<listitem>
<para>Database Type and Driver:
<literal>other</literal></para>
</listitem>
<listitem>
<para>Select <literal>Next</literal>
button</para>
</listitem>
</orderedlist></para>
</listitem>
<listitem>
<para>Select <literal>Next</literal> button on the
<literal>Transaction Options</literal>
page</para>
</listitem>
<listitem>
<para>Fill in the following on the <literal>Connection
Properties</literal> page:
<orderedlist>
<listitem>
<para>Database Name:
<literal>hsqldb</literal></para>
</listitem>
<listitem>
<para>Host Name:
<literal>127.0.0.1</literal></para>
</listitem>
<listitem>
<para>Port: <literal>9001</literal>
</para>
</listitem>
<listitem>
<para>Username: <literal>sa</literal> will
empty password fields.</para>
</listitem>
<listitem>
<para>Password: leave empty.</para>
</listitem>
<listitem>
<para>Select <literal>Next</literal>
button</para>
</listitem>
</orderedlist></para>
</listitem>
<listitem>
<para>Fill in the following on the <literal>Connection
Properties</literal> page:
<orderedlist>
<listitem>
<para>Driver Class Name:
<literal>org.hsqldb.jdbcDriver</literal>
</para>
</listitem>
<listitem>
<para>URL:
<literal>jdbc:hsqldb:.</literal>
</para>
</listitem>
<listitem>
<para>Username: <literal>sa</literal></para>
</listitem>
<listitem>
<para>Password: leave empty.</para>
</listitem>
<listitem>
<para>Leave the rest of the fields
as is.</para>
</listitem>
<listitem>
<para>Select <literal>Next</literal>
button</para>
</listitem>
</orderedlist></para>
</listitem>
<listitem>
<para>Choose the target domain for the data source in our
case the only one <literal>AdminServer</literal>.
Click <literal>Next</literal>.</para>
</listitem>
</orderedlist> </para>
</section>
<section>
<title>Configuration and Build changes</title>
<para>
OK - now we are ready to finally begin adjusting the seam
application for deployment to the Weblogic server.
</para>
<variablelist>
<varlistentry>
<term>
<literal>
resources/META-INF/persistence.xml
</literal>
</term>
<listitem>
<itemizedlist>
<listitem>
<para>
Change the
<literal>jta-data-source</literal>
to what you entered above :
</para>
<programlisting role="XML"><![CDATA[
<jta-data-source>seam-jee5-ds</jta-data-source>]]></programlisting>
</listitem>
<listitem>
<para>
Then comment out the glassfish properties.
</para>
</listitem>
<listitem>
<para>
Then add these two properties for weblogic
support.
</para>
<programlisting role="XML"><![CDATA[
<property name="hibernate.dialect"
value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.transaction.manager_lookup_class"
value="org.hibernate.transaction.WeblogicTransactionManagerLookup"/>
]]></programlisting>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>
resources/META-INF/weblogic-application.xml
</literal>
</term>
<listitem>
<itemizedlist>
<listitem>
<para>
This file needs to be created and should
contain the following:
</para>
<programlisting role="XML"><![CDATA[
<?xml version="1.0" encoding="ISO-8859-1"?>
<weblogic-application>
<library-ref>
<library-name>jsf</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<prefer-application-packages>
<package-name>antlr.*</package-name>
</prefer-application-packages>
</weblogic-application>
]]></programlisting>
</listitem>
<listitem>
<para>
These changes do two two different things.
The first element
<literal>library-ref</literal>
tells weblogic that this application will
be using the deployed JSF libraries. The
second element
<literal>
prefer-application-packages
</literal>
tells weblogic that the
<literal>antlr</literal>
jars take precedence. This avoids a
conflict with hibernate.
</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>resources/META-INF/ejb-jar.xml</literal>
</term>
<listitem>
<itemizedlist>
<listitem>
<para>
The changes described here work around an
issue where Weblogic is only using a
single instance of the
<literal>sessionBeanInterceptor</literal>
for all session beans. Seam's interceptor
caches and stores some component specific
attributes, so when a call comes in - the
interceptor is primed for a different
component and an 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.
</para>
<para>
Modify the
<literal>assembly-descriptor</literal>
element to look like this:
</para>
<programlisting role="XML"><![CDATA[
<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>]]></programlisting>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>resources/WEB-INF/weblogic.xml</literal>
</term>
<listitem>
<itemizedlist>
<listitem>
<para>
This file needs to be created and should
contain the following:
</para>
<programlisting role="XML"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app>
<library-ref>
<library-name>jsf</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
</weblogic-web-app>
]]></programlisting>
</listitem>
<listitem>
<para>
This file and the element
<literal>library-ref</literal>
tells Weblogic that this application will
using the deployed JSF libraries. This is
needed in both this file and the
<literal>
weblogic-application.xml
</literal>
file because both applications require
access.
</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
</section>
<section>
<title>Building and Deploying the Application</title>
<para>
There are some changes needed to the build script and the
<literal>jboss-seam.jar</literal>
then we can deploy the app.
</para>
<variablelist>
<varlistentry>
<term>
<literal>build.xml</literal>
</term>
<listitem>
<itemizedlist>
<listitem>
<para>
We need to add the follow so that the
<literal>
weblogic-application.xml
</literal>
will be packaged.
</para>
<programlisting role="XML"><![CDATA[
<!-- Resources to go in the ear -->
<fileset id="ear.resources" dir="${resources.dir}">
<include name="META-INF/application.xml" />
<include name="META-INF/weblogic-application.xml" />
<include name="META-INF/*-service.xml" />
<include name="META-INF/*-xmbean.xml" />
<include name="treecache.xml" />
<include name="*.jpdl.xml" />
<exclude name=".gpd.*" />
<include name="*.cfg.xml" />
<include name="*.xsd" />
</fileset>]]></programlisting>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
<term>
<literal>
$SEAM/lib/interop/jboss-seam-wls-compatible.jar
</literal>
</term>
<listitem>
<itemizedlist>
<listitem>
<para>
This is the change discussed above in
<xref linkend="weblogic-ejb-issues" />
. There are really two options.
</para>
</listitem>
<listitem>
<para>
Rename this jar and replace the original
<literal>
$SEAM/lib/jboss-seam.jar
</literal>
file. This approach does not require any
changes to the packaged
<literal>EAR</literal>
archive, but overwrites the original
<literal>jboss-seam.jar</literal>
</para>
</listitem>
<listitem>
<para>
The other option is the modify the
packaged
<literal>EAR</literal>
archive and replace the
<literal>jboss-seam.jar</literal>
in the archive manually. This leaves the
original jar alone, but requires a manual
step when ever the archive is packaged.
</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
<para>
Assuming that you choose the first option for handling
the
<literal>jboss-seam-wls-compatible.jar</literal>
we can build the application by running
<literal>ant archive</literal>
at the base of the
<literal>jee5/booking</literal>
example directory.
</para>
<para>
Because we chose to create our Weblogic domain in
development mode we can deploy the application by putting
the EAR file in the domains autodeploy directory.
<programlisting>
cp ./dist/jboss-seam-jee5.ear
$BEA_HOME/user_projects/domains/seam_examples/autodeploy
</programlisting>
</para>
<para>
Check out the application at
<literal>http://localhost:7001/seam-jee5/</literal>
</para>
</section>
</section>
</section>
<section>
<title> The <literal>jpa</literal> booking example </title>
<para>This is the Hotel Booking example implemented with Seam POJOs and
Hibernate JPA and does not require EJB3 support to run. The example
already has a breakout of configurations and build scripts for many of
the common containers including Weblogic 10.X </para>
<para> First we'll build the example for Weblogic 10.x and do the needed
steps to deploy. Then we'll talk about what is different between the
Weblogic versions, and with the JBoss AS version. </para>
<para>Note that this example assumes that Weblogic's JSF libraries have
been configured as described in <xref linkend="weblogic-jsf-deploy"/>.</para>
<section>
<title>
Building and deploying
<literal>jpa</literal>
booking example
</title>
<para>
Step one setup the datasource, step two build the app, step
three deploy.
</para>
<section>
<title>Setting up the datasource</title>
<para>
The Weblogic 10.X version of the example will use the in
memory hsql database instead of the built in PointBase
database. If you wish to use the PointBase database you
must setup a PointBase datasource, and adjust the
hibernate setting in
<literal>persistence.xml</literal>
to use the PointBase dialect. For reference the
<literal>jpa/weblogic92</literal>
example uses PointBase.
</para>
<para>
Configuring the datasource is very similar to the jee5
<xref linkend="weblogic-hsql-jee5-ds" />
. Follow the steps in that section, but use the following
entries where needed.
<itemizedlist>
<listitem>
<para>
DataSource Name:
<literal>seam-jpa-ds</literal>
</para>
</listitem>
<listitem>
<para>
JNDI Name:
<literal>seam-jpa-ds</literal>
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section>
<title>Building the example</title>
<para>
Building it only requires running the correct ant
command:
<programlisting>ant weblogic10</programlisting>
This will create a container specific distribution and
exploded archive directories.
</para>
</section>
<section>
<title>Deploying the example</title>
<para>
When we installed Weblogic following
<xref linkend="weblogic-domain" />
we chose to have the domain in development mode. This
means to deploy the application all we need to do is copy
it into the autodeploy directory.
</para>
<programlisting>cp ./dist-weblogic10/jpa-web.war
$BEA_HOME/user_projects/domains/seam_examples/autodeploy</programlisting>
<para>
Check out the application at the following
<literal>http://localhost:7001/jpa-web/</literal>
.
</para>
</section>
</section>
<section id="weblogic-jpa-diff">
<title>What's different with Weblogic 10.x</title>
<itemizedlist>
<listitem>
<para>Between the Weblogic 10.x and 9.2 examples there are
several differences:
</para>
<itemizedlist>
<listitem>
<para>
<literal>META-INF/persistence.xml</literal>
— The 9.2 version is configured to use the
<literal>PointBase</literal> database and a
pre-installed datasource. The 10.x version uses
the <literal>hsql</literal> database and a
custom datasource.</para>
</listitem>
<listitem>
<para id="weblogic.xml"
xreflabel="description of WEB-INF/weblogic.xml">
<literal>WEB-INF/weblogic.xml</literal>
— This file and its contents solve an issue
with an older version of the
<literal>ANTLR</literal> libraries that
Weblogic 10.x uses internally. OC4J have the same
issue as well. It also configures the application to
use the shared JSF libraries that were installed
above.</para>
<programlisting role="XML"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">
<library-ref>
<library-name>jsf</library-name>
<specification-version>1.2</specification-version>
<implementation-version>1.2</implementation-version>
<exact-match>false</exact-match>
</library-ref>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>]]></programlisting>
<para>This make Weblogic use classes and
libraries in the web application before other
libraries in the classpath. Without this change
hibernate is required to use a older, slower query