Bundle 0 does export javax.annotation;version=1.3.0 but is missing 
javax.annotation.security.  

Adding  javax.annotation.security;version="1.3" to  etc/jre.properties appears 
to resolve this issue.

***
* Current etc/jre.properties
***
jre-9= \
...
 javax.annotation;version="1.3", \
 javax.annotation.processing;version="1.0", \
...

***
* Patached etc/jre.properties
***
jre-9= \
...
 javax.annotation;version="1.3", \
 javax.annotation.security;version="1.3", \ 
 javax.annotation.processing;version="1.0", \
...


I have reported this as KARAF-7802

Paul Spencer

> On Jan 22, 2024, at 7:59 AM, Łukasz Dywicki <[email protected]> wrote:
> 
> Hello Paul,
> I believe you might face issues with jakarta vs javax namespaces. There is a 
> ongoing move from javax to jakarta and some of well known annotations might 
> be missing at runtime.
> Please double check if your runtime consist of javax.annotation.security 
> package.
> 
> Best,
> Łukasz
> 
> On 19.01.2024 20:41, Paul Spencer wrote:
>> Karaf 4.4.5
>> I am looking to implement security on a REST endpoint
>> @DeclareRoles("message-view")
>> @RolesAllowed("message-view")
>> @Path("/messageLog")
>> @Component(service = MessageLog.class)
>> @JaxrsResource
>> @JaxrsApplicationSelect("(osgi.jaxrs.name=myApi)")
>> public class MessageLog {
>>     private static final Logger LOGGER = 
>> LoggerFactory.getLogger(MessageLog.class);
>>     @GET
>>     @Produces(MediaType.APPLICATION_JSON)
>>     @Path("/")
>>     public Response getMessageLog() {
>> ...
>> }
>> When I added @DeclareRoles("message-view") @RolesAllowed("message-view") 
>> installing the bundle results in
>> Error executing command: Unable to resolve com.foo.msg-rest [162](R 162.1): 
>> missing requirement [foo.bar.msg-rest [162](R 162.1)] osgi.wiring.package; 
>> (&(osgi.wiring.package=javax.annotation.security)(version>=1.3.0)(!(version>=2.0.0)))
>>  Unresolved requirements: [[foo.bar.msg-rest [162](R 162.1)] 
>> osgi.wiring.package; 
>> (&(osgi.wiring.package=javax.annotation.security)(version>=1.3.0)(!(version>=2.0.0)))]
>> I suspect this because I have not installed a required feature or bundle.  
>> What is the the required feature or bundle?
>> Paul Spencer

Reply via email to