On 6/13/07, George Harley <[EMAIL PROTECTED]> wrote:
Hi Craig,

Thanks for the response and for kindly not drawing attention to the fact
that I claimed to be seeing a NPE but gave the stack trace for a
NoClassDefFoundError. It was late...

So, yes, as you point out it does seem to be a JSF 1.1/1.2 issue. The
application I am trying to test is 1.1 but even with the 1.1 server
runtime libraries available on the classpath I still kept on getting the
error (the server is WAS 6.1 incidentally). The shale-test JAR I was
using is the binary version shipped with the 1.0.4 release and you
prompted me to take a quick look through its contents where I saw a
number of what look to be JSF 1.2 mock classes (that's what the "12"
suffix on the class name means, right ?).

I rebuilt the JAR locally filtering out the "12" mock classes and now
the error has gone away.

<snip/>

You're correct that the "12" suffix is for JSF 1.2 mock classes, but
shale-test is designed to only use those classes if a JSF 1.2 runtime
is available, otherwise the factories fall back to the 1.1 variants
(ones without the suffix). So you shouldn't have to do that (atleast
in theory).

-Rahul




Many thanks for your help.

Best regards,
George


Craig McClanahan wrote:
> On 6/12/07, George Harley <[EMAIL PROTECTED]> wrote:
>> Hi,
>>
>> Please help.
>>
>> I am trying to run some unit tests of JSF classes using
>> AbstractJsfTestCase as my test case superclass. When I try and run the
>> tests there is a NPE from inside the AbstractJsfTestCase  setUp()
>> method. Trace is as follows...
>>
>> java.lang.NoClassDefFoundError: javax.el.ELContext
>>     at java.lang.J9VMInternals.verifyImpl(Native Method)
>>     at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
>>     at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
>>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
>> Method)
>>     at
>> 
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67)
>>
>>     at
>> 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>>
>>     at java.lang.reflect.Constructor.newInstance(Constructor.java:521)
>>     at
>> 
org.apache.shale.test.mock.MockFacesContextFactory.getFacesContext(MockFacesContextFactory.java:164)
>>
>>     at
>> 
org.apache.shale.test.base.AbstractJsfTestCase.setUp(AbstractJsfTestCase.java:131)
>>
>>     ........
>>
>> I have spent at least an hour trying to locate a JAR containing the
>> javax.el.ELContext class to put on the runtime classpath but with no
>> luck. This is the first time I have tried using the Shale test
>> framework. Please can someone help put me out ? This must be something
>> obvious.
>>
>
> Are you building a JSF 1.2 based application?  If so, you'll need to
> make sure you include the JSF api and implementation JARs, *and* all
> of their dependencies (which will include the EL implementation
> referenced by the error you are getting.  One simple way to do this is
> download Glassfish (https://glassfish.dev.java.net) and put the
> javaee.jar library from it into your classpath -- that includes the
> JSF 1.2 reference implementation and the associated EL machinery.
>
> On the other hand, if you're trying to build a JSF 1.1 application
> (javax.el.* did not exist then), be sure you are including a 1.1
> runtime instead of a 1.2 runtime.
>
>> Best regards,
>> George
>>
>
> Craig
>


Reply via email to