users@glassfish.java.net

Re: The context root of an EAR application

From: Michael Bouschen <Michael.Bouschen_at_Sun.COM>
Date: Mon, 03 Apr 2006 10:52:50 +0200

Hi Graf,

the error message "unexpected token: LIKE" is misleading.
Please remove the parenthesis around the LIKE argument:
   SELECT k FROM Kategoria k WHERE UPPER(k.megnevezes) LIKE :megnevezes

Regards Michael

> Hi Marina
>
> The exception that was throw:
>
> Exception Description: Error encountered when building the @NamedQuery
> [findKategoriakByNameCaseInsensitive] from entity class [class
> gl.exlybris.ejb.kategoria.Kategoria].
> Internal Exception: Exception [TOPLINK-8001] (Oracle TopLink Essentials
> - 10g release 4 (10.1.4.0.0) (Build 060104Dev)):
> oracle.toplink.essentials.exceptions.EJBQLException
> Exception Description: Syntax Recognition Problem parsing the EJBQL
> [SELECT k FROM Kategoria k WHERE UPPER(k.megnevezes) LIKE
> (:megnevezes)]. The parser returned the following [unexpected token: LIKE].
> Local Exception Stack:
> Exception [TOPLINK-7158] (Oracle TopLink Essentials - 10g release 4
> (10.1.4.0.0) (Build 060104Dev)):
> oracle.toplink.essentials.exceptions.ValidationException
> Exception Description: Error encountered when building the @NamedQuery
> [findKategoriakByNameCaseInsensitive] from entity class [class
> gl.exlybris.ejb.kategoria.Kategoria].
> Internal Exception: Exception [TOPLINK-8001] (Oracle TopLink Essentials
> - 10g release 4 (10.1.4.0.0) (Build 060104Dev)):
> oracle.toplink.essentials.exceptions.EJBQLException
> Exception Description: Syntax Recognition Problem parsing the EJBQL
> [SELECT k FROM Kategoria k WHERE UPPER(k.megnevezes) LIKE (:nev)]. The
> parser returned the following [unexpected token: LIKE].
>
> where 'megnevezes' stands for 'name.
>
> Graf László
>
>
>
> Marina Vatkina wrote:
>
>> Graf,
>>
>> UPPER is a supported Java Persistence Query language function.
>> But I don't think it's supported with LIKE:
>>
>> "string_expression [NOT] LIKE pattern_value [ESCAPE escape_character]
>> The string_expression must have a string value. The pattern_value is a
>> string literal or a string-valued
>> input parameter in which an underscore (_) stands for any single
>> character, a percent (%) character
>> stands for any sequence of characters (including the empty sequence),
>> and all other characters stand for
>> themselves."
>>
>> What exception do you get?
>>
>> thanks,
>> -marina
>>
>> Graf László wrote:
>>
>>> Hi Hong,
>>> You were right. There is an error in the server.log.
>>> I used two named queries which contain the UPPER SQL function.
>>> It seams that this is an illegal function for EBQL
>>>
>>> @NamedQueries({
>>> @NamedQuery(name="findKategoriakByNameCaseInsensitive",
>>> query="SELECT k FROM Kategoria k WHERE UPPER(k.megnevezes)
>>> LIKE UPPER(:nev)"),
>>> @NamedQuery(name="findKategoriakByNameCaseSensitive",
>>> query="SELECT k FROM Kategoria k WHERE k.megnevezes LIKE
>>> :nev")
>>> })
>>>
>>> Any suggestion?
>>>
>>> Thank you.
>>>
>>> Graf László
>>>
>>>
>>>
>>> Hong Zhang wrote:
>>>
>>>> Hi, Graf
>>>> Do you have a sun-application.xml packagd inside the ear and it
>>>> also specifies a context root? If that's the case, the context root
>>>> specified in the sun-application.xml takes high precedence.
>>>> Also did you look at the server.log to check if everything is
>>>> normal, no exceptions, and the web module is loaded at the context
>>>> root as expected?
>>>>
>>>> If you don't have a sun-application.xml and server.log looks all
>>>> normal to you, please attach you application and the server.log. I
>>>> will try it out for you see what I can find out.
>>>>
>>>> Thanks,
>>>>
>>>> - Hong
>>>>
>>>> Graf László wrote:
>>>>
>>>>> Hi all,
>>>>>
>>>>> Using a NetBeans 5.5 for Windows and Sun Java System Application
>>>>> Server Platform Edition 9.0 Beta (build b32g) for Linux, I did
>>>>> create an enterprise application named 'exlybris'.
>>>>>
>>>>> The server works fine, I did deploy the application without any
>>>>> problem. This EAR contains an EJB module, named
>>>>> 'exlybris-EJBModule.jar', and a web module, named
>>>>> 'exlybris-WebModule.war', as you can see in my application.xml below:
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <application version="5" 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/application_5.xsd">
>>>>> <display-name>exlybris</display-name>
>>>>> <module>
>>>>> <web>
>>>>> <web-uri>exlybris-WebModule.war</web-uri>
>>>>> <context-root>/exlybris-WebModule</context-root>
>>>>> </web>
>>>>> </module>
>>>>> <module>
>>>>> <ejb>exlybris-EJBModule.jar</ejb>
>>>>> </module>
>>>>> </application>
>>>>>
>>>>> The EJB module contains three container-managed EJB3 and the WEB
>>>>> module contains a simple index.html only. The server can be reached
>>>>> at the address 'http://ip-address:8080'. My question is, if the
>>>>> context root of my web module is '/exlybris-WebModule', why the
>>>>> server gives me the message
>>>>>
>>>>>
>>>>> HTTP Status 404 -
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> *type* Status report
>>>>>
>>>>> *message*
>>>>>
>>>>> *description* _The requested resource () is not available._
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>>
>>>>>
>>>>> Sun Java System Application Server Platform Edition 9.0 Beta
>>>>>
>>>>> when I access the URL 'http://ip-address:8080/exlybris-WebModule/' ?
>>>>> Please help me.
>>>>>
>>>>> Thank you,
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
>> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>>