AOSP : How to add service in service manager after removal of android:sharedUserId="android.uid.system" from manifest - android-source

Unable to start service . Line is added in onCreate of service.
<pre>ServiceManager.addService(ACTION_REMOTE_SERVICE, (IBinder) new xxxRemoteservice(this));</pre>
Changes we removed android:sharedUserId="android.uid.system" from manifest . But the application is signed with platform certificate And LOCAL_VENDOR_MODULE := true
Getting error below
Caused by: java.lang.SecurityException
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(Binder.java:764)
at android.os.ServiceManagerProxy.addService(ServiceManagerNative.java:150)
at android.os.ServiceManager.addService(ServiceManager.java:88)

Related

Scala play framework - convert Rest API to HTTPS using .JKS file using organizational CA

Currently I am running scala play application, now it's HTTP APIs are working fine in my Angular UI application locally. But in our organization for higher environment we need to convert it to SSL HTTPS API.
We use our own organizational root CA and I got the myCA_trust.jks certificate file with me.
I added following properties in application.conf file,
play.server.https.keyStore.path="./myCA_trust.jks"
play.server.https.keyStore.password="change_me"
And for deploying the code I am creating the dist, and using following command to deploy it on linux server
./scala-rest-api -Dplay.http.secret.key="application_secreate_key" -Dhttps.port=8094 -Dplay.server.https.keyStore.path=./myCA_trust.jks -Dplay.server.https.keyStore.password=change_me
After doing this I can hit to the HTTPS URL using server address, but getting errors in server console like,
[error] a.a.OneForOneStrategy - ./myCA_trust.jks
akka.actor.ActorInitializationException: akka://application/system/StreamSupervisor-0/flow-2-1: exception during creation
at akka.actor.ActorInitializationException$.apply(Actor.scala:202)
at akka.actor.ActorCell.create(ActorCell.scala:698)
at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:549)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:571)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:293)
at akka.dispatch.Mailbox.run(Mailbox.scala:228)
at akka.dispatch.Mailbox.exec(Mailbox.scala:241)
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
Caused by: java.lang.reflect.InvocationTargetException: null
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:116)
at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:39)
at play.core.server.AkkaHttpServer$$anon$4$$anon$5.sslEngineProvider$lzycompute(AkkaHttpServer.scala:527)
at play.core.server.AkkaHttpServer$$anon$4$$anon$5.sslEngineProvider(AkkaHttpServer.scala:526)
at play.core.server.AkkaHttpServer$$anon$4$$anon$5.engineCreateSSLEngine(AkkaHttpServer.scala:528)
at javax.net.ssl.SSLContext.createSSLEngine(SSLContext.java:329)
Caused by: java.nio.file.NoSuchFileException: ./myCA_trust.jks
Please help me to configure HTTPS rest API URL, do let me know if there is anything else I need to add in the code and where.
Thanks and in advance.

Exception deploying SCDF App with Docker Compose

I am running SCDF with Docker Compose in Ubuntu 20.04 on WSL. I can create and deploy streams using starter sources/sinks without issue but when trying to deploy a custom Spring Cloud Stream app the following happens and I am not sure how to resolve it:
dataflow:>app register --name order-source --type source --uri docker://*******/****:order-producer
Successfully registered application 'source:order-source'
dataflow:>stream create ordering-stream --definition "order-source | log"
Created new stream 'ordering-stream'
dataflow:>stream deploy ordering-stream
Command failed org.springframework.cloud.dataflow.rest.client.DataFlowClientException: SkipperException
SkipperException
org.springframework.cloud.dataflow.rest.client.DataFlowClientException: SkipperException
at org.springframework.cloud.dataflow.rest.client.VndErrorResponseErrorHandler.handleError(VndErrorResponseErrorHandler.java:65)
at org.springframework.web.client.ResponseErrorHandler.handleError(ResponseErrorHandler.java:63)
at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:780)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:738)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:672)
at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:416)
at org.springframework.cloud.dataflow.rest.client.StreamTemplate.deploy(StreamTemplate.java:141)
at org.springframework.cloud.dataflow.shell.command.StreamCommands.deployStream(StreamCommands.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282)
at org.springframework.shell.core.SimpleExecutionStrategy.invoke(SimpleExecutionStrategy.java:68)
at org.springframework.shell.core.SimpleExecutionStrategy.execute(SimpleExecutionStrategy.java:59)
at org.springframework.shell.core.AbstractShell.executeCommand(AbstractShell.java:134)
at org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:533)
at org.springframework.shell.core.JLineShell.run(JLineShell.java:179)
at java.lang.Thread.run(Thread.java:748)
This skipper server exception includes this:
Caused by: java.io.IOException: Cannot run program "docker" (in directory "/tmp/1627185411996/ordering-stream.order-source-v1"): error=2, No such file or directory
I can include the verbose server output if that would be helpful.
I was able to resolve the problem by referencing the application's jar file locally with Uri = file:///root/scdf/order-service-0.0.1-SNAPSHOT.jar. The docker-compose.yml file also needs to be inside the same directory as the jar file (~/scdf in this case). I'm still unsure why the Docker Hub Uri reference fails since docker is working for SCDF, all of the other services within Docker Compose, and elsewhere.

JBoss service failure

I get the following exception when I run JBoss:
Failed to start service org.wildfly.network.interface.cluster:
org.jboss.msc.service.StartException in service org.wildfly.network.interface.cluster:
WFLYSRV0082: failed to resolve interface cluster at
org.jboss.as.server.services.net.NetworkInterfaceService.start(NetworkInterfaceService.java:96)
This is rather generic. Does anyone know how to get more details about the root cause?
Any idea which jar file contains org.jboss.as.server.services.net.NetworkInterfaceService class?

Openshift pod complains about missing directories for image

I tested my ApachedMQ image on Ubuntu and it works fine with Docker.
On Openshift deploying the same image does not work.
It should work out of the box, just like Ubuntu, but it always complains about missing directories in the pod, or lack of permissions on directories in the pod. Below you will see errors regarding the former.
I am using the FREE edition of Openshift online v3.x
I am only using the console to deploy from the image.
Below just a sample of the log messages when the pod is ramping up for the deployment.
java.io.FileNotFoundException: /opt/activemq/data/activemq.log (Permission denied)
Caused by: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
Any help would be much appreciated, as this image should IMO, be deployable from the console without any YAML and oc CLI necessary.
Some log trace information:
INFO: Loading '/opt/activemq/bin/env'
INFO: Using java '/docker-java-home/jre/bin/java'
INFO: Starting in foreground, this is just for debugging purposes (stop process by pressing CTRL+C)
INFO: Creating pidfile /opt/activemq/data/activemq.pid
bin/activemq: 484: bin/activemq: cannot create /opt/activemq/data/activemq.pid: Permission denied
Java Runtime: Oracle Corporation 1.8.0_141 /usr/lib/jvm/java-8-openjdk-amd64/jre
Heap sizes: current=62976k free=58714k max=932352k
JVM args: -Xms64M -Xmx1G -Djava.util.logging.config.file=logging.properties -Djava.security.auth.login.config=/opt/activemq/conf/login.config -Dcom.sun.management.jmxremote -Djava.awt.headless=true -Djava.io.tmpdir=/opt/activemq/tmp -Dactivemq.classpath=/opt/activemq/conf:/opt/activemq/../lib/: -Dactivemq.home=/opt/activemq -Dactivemq.base=/opt/activemq -Dactivemq.conf=/opt/activemq/conf -Dactivemq.data=/opt/activemq/data
Extensions classpath:
[/opt/activemq/lib,/opt/activemq/lib/camel,/opt/activemq/lib/optional,/opt/activemq/lib/web,/opt/activemq/lib/extra]
ACTIVEMQ_HOME: /opt/activemq
ACTIVEMQ_BASE: /opt/activemq
ACTIVEMQ_CONF: /opt/activemq/conf
ACTIVEMQ_DATA: /opt/activemq/data
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /opt/activemq/data/activemq.log (Permission denied)
...
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: /opt/activemq/data/audit.log (Permission denied)
...
Loading message broker from: xbean:activemq.xml
INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1#5bcab519: startup date [Fri Mar 16 21:10:18 UTC 2018]; root of context hierarchy
WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
ERROR | Failed to load: class path resource [activemq.xml], reason: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.lang.RuntimeException: java.io.IOException: Failed to create directory '/opt/activemq/data/kahadb'
SOLVED proof::
In order for the image to successfully be deployed, the following have to be done on the cluster:
oc adm policy add-scc-to-user anyuid -z default -n myproject --as system:admin
When deploying set the ACTIVEMQ_DATA environment variable to /tmp
I will continue to find other alternatives including a rebuild of the image, creating a pod with the requisite permissions for the $APACHEMQ_DATA directory.
Below proof of the route working on the playground instance.
It is o.k. to paste it as the playground will expire in the next 10 minutes.
I corrected the image.
The docker file can be found here on my fork:
https://github.com/beezerbt/docker-activemq/tree/master/5.14.5-openshift-v3.9.14
The image for the above can be found here:
https://hub.docker.com/r/beezer/openshift-ready-mq/tags/
Tag::[5.14.5-3.9.14]
Finally, since the image has an ephemeral persistence, a volume can be mapped to /app within the openshift cluster quite easily; however do remember that you must set the volume mount point as something OTHER than /app and then further down in the volume definition on Openshift console, specify where in the container it should be mapped to...which is then /app.
I have created a activemq image which can be deployed in Openshift
https://hub.docker.com/r/rangareddyv/activemq-openshift
Created an image with latest version of activemq and amzn-corretto-jdk-11 as bas image because openjdk has lot of CVE's and alpine does not support the jdk-11

Upgrade xwiki (2.5 to 4.4)

Im using XWIKI ENTERPRISE 2.5 and want to upgrade it to 4.4 or 4.3 (stable)
I found this upgrade documentation for XWiki. Following the guide, I backed up the important files in WEB-INF.
After that, I copied all the files from the new .war to my wiki directory (/var/lib/tomcat6/webapps/xwiki). Then, I moved back the important files and overwrote the new files.
I get this error message, when I visit my wiki page:
HTTP Status 404 - type Status report
message description
The requested resource () is not available.
Apache Tomcat/6.0.28
Here is the logfile:
SCHWERWIEGEND: Exception sending context initialized event to listener instance of class org.xwiki.container.servlet.XWikiServletContextListener
java.lang.RuntimeException: Failed to find the Observation Manager component
at org.xwiki.container.servlet.XWikiServletContextListener.contextInitialized(XWikiServletContextListener.java:101)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1041)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:964)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:502)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: org.xwiki.component.manager.ComponentLookupException: Failed to lookup component [org.xwiki.observation.internal.DefaultObservationManager] identifier by [role = [interface org.xwiki.observation.ObservationManager] hint = [default]]
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:348)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:155)
at org.xwiki.container.servlet.XWikiServletContextListener.contextInitialized(XWikiServletContextListener.java:99)
... 24 more
Caused by: org.xwiki.component.phase.InitializationException: Failed to lookup Event Listeners
at org.xwiki.observation.internal.DefaultObservationManager.initialize(DefaultObservationManager.java:139)
at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:323)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:378)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:346)
... 26 more
Caused by: org.xwiki.component.manager.ComponentLookupException: Failed to lookup component [role = [interface org.xwiki.observation.EventListener] hint = [default]]
at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceMap(EmbeddableComponentManager.java:187)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceList(EmbeddableComponentManager.java:169)
at org.xwiki.observation.internal.DefaultObservationManager.initialize(DefaultObservationManager.java:135)
... 30 more
Caused by: org.xwiki.component.manager.ComponentLookupException: Failed to lookup component [org.xwiki.security.authorization.cache.internal.DefaultSecurityCache] identifier by [role = [interface org.xwiki.security.authorization.cache.SecurityCache] hint = [default]]
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:348)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:161)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:312)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:378)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstanceMap(EmbeddableComponentManager.java:185)
... 32 more
Caused by: org.xwiki.component.phase.InitializationException: Unable to create the security cache with a capacity of 500
at org.xwiki.security.authorization.cache.internal.DefaultSecurityCache.newCache(DefaultSecurityCache.java:104)
at org.xwiki.security.authorization.cache.internal.DefaultSecurityCache.initialize(DefaultSecurityCache.java:112)
at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:323)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:378)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:346)
... 36 more
Caused by: org.xwiki.cache.CacheException: Failed to get cache factory for role hint [infinispan]
at org.xwiki.cache.internal.DefaultCacheManager.createNewCache(DefaultCacheManager.java:109)
at org.xwiki.cache.internal.DefaultCacheManager.createNewCache(DefaultCacheManager.java:85)
at org.xwiki.security.authorization.cache.internal.DefaultSecurityCache.newCache(DefaultSecurityCache.java:102)
... 41 more
Caused by: org.xwiki.component.manager.ComponentLookupException: Failed to lookup component [org.xwiki.cache.infinispan.internal.InfinispanCacheFactory] identifier by [role = [interface org.xwiki.cache.CacheFactory] hint = [infinispan]]
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:348)
at org.xwiki.component.embed.EmbeddableComponentManager.getInstance(EmbeddableComponentManager.java:161)
at org.xwiki.cache.internal.DefaultCacheManager.createNewCache(DefaultCacheManager.java:107)
... 43 more
Caused by: org.infinispan.jmx.JmxDomainConflictException: Domain already registered org.xwiki.infinispan
at org.infinispan.jmx.JmxUtil.buildJmxDomain(JmxUtil.java:73)
at org.infinispan.jmx.CacheManagerJmxRegistration.updateDomain(CacheManagerJmxRegistration.java:92)
at org.infinispan.jmx.CacheManagerJmxRegistration.buildRegistrar(CacheManagerJmxRegistration.java:86)
at org.infinispan.jmx.AbstractJmxRegistration.registerMBeans(AbstractJmxRegistration.java:46)
at org.infinispan.jmx.CacheManagerJmxRegistration.start(CacheManagerJmxRegistration.java:62)
at org.infinispan.manager.DefaultCacheManager.start(DefaultCacheManager.java:720)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:388)
at org.infinispan.manager.DefaultCacheManager.<init>(DefaultCacheManager.java:353)
at org.xwiki.cache.infinispan.internal.InfinispanCacheFactory.initialize(InfinispanCacheFactory.java:104)
at org.xwiki.component.embed.InitializableLifecycleHandler.handle(InitializableLifecycleHandler.java:39)
at org.xwiki.component.embed.EmbeddableComponentManager.createInstance(EmbeddableComponentManager.java:323)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:378)
at org.xwiki.component.embed.EmbeddableComponentManager.getComponentInstance(EmbeddableComponentManager.java:346)
... 45 more
When you say that
I copied all the files from the new .war to my wiki directory
Did you copy the new files over the existing directory? You're supposed to delete everything from the old version and use only the files from the new version, and only copy from the backup the essential configuration files. Also, note that you're not supposed to just copy the old configuration, but merge your custom settings into the default new configuration.
The root error in the stack trace:
Caused by: org.infinispan.jmx.JmxDomainConflictException: Domain already registered org.xwiki.infinispan
suggest a duplicate jar. The other case when this could occur is when you have more than one instance of XWiki in the same container, in which case you should edit WEB-INF/cache/infinispan/config.xml, and replace the line jmxDomain="org.xwiki.infinispan" with a unique value, like jmxDomain="org.xwiki.infinispan.wiki1" and jmxDomain="org.xwiki.infinispan.wiki2" for the two instances.
I've been having the same problem when upgrading from 4.0-rc-1 to 4.4 or 4.5. I have no duplicate jars nor am I running several instances of XWiki. It may be there is an issue either in infinispan or in XWiki's cache implementation.
A temporary workaround is to allow duplicate domains explicitly in config.xml :
<globalJmxStatistics
[...]
allowDuplicateDomains="true" />