Apache ranger 2.1.0 - Installation failed - apache-ranger

I am trying to install the latest version of Apache ranger 2.1.0 and getting this error while installing ranger admin. [E] Ranger all admins default password change request failed and there is not much error logs.
2020-09-05 20:21:14,541 [JISQL] /usr/lib/jvm/jre-11-openjdk-11.0.8.10-0.el7_8.x86_64/bin/java -cp /usr/share/java/mysql-connector-java.jar:/opt/apache-ranger/ranger-2.1.0-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://localhost/ranger -u 'ranger' -p '********' -noheader -trim -c \; -query "insert into x_db_version_h (version, inst_at, inst_by, updated_at, updated_by,active) values ('DEFAULT_ALL_ADMIN_UPDATE', current_timestamp, 'Ranger 2.1.0', current_timestamp, 'pas-bifrostx0.myntra.com','N') ;"
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2020-09-05 20:21:15,219 [I] Ranger all admins default password change request is in process..
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.eclipse.persistence.internal.security.PrivilegedAccessHelper (file:/opt/apache-ranger/ranger-2.1.0-admin/ews/webapp/WEB-INF/lib/eclipselink-2.5.2.jar) to method com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.getXmlEncoding()
WARNING: Please consider reporting this to the maintainers of org.eclipse.persistence.internal.security.PrivilegedAccessHelper
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2020-09-05 20:21:19,448 [JISQL] /usr/lib/jvm/jre-11-openjdk-11.0.8.10-0.el7_8.x86_64/bin/java -cp /usr/share/java/mysql-connector-java.jar:/opt/apache-ranger/ranger-2.1.0-admin/jisql/lib/* org.apache.util.sql.Jisql -driver mysqlconj -cstring jdbc:mysql://localhost/ranger -u 'ranger' -p '********' -noheader -trim -c \; -query "delete from x_db_version_h where version = 'DEFAULT_ALL_ADMIN_UPDATE' and active = 'N' and updated_by='pas-bifrostx0.myntra.com';"
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2020-09-05 20:21:20,073 [E] Ranger all admins default password change request failed
Also, regardless of this error, I was able to start the service with sudo ranger-admin start and is able to do telnet localhost 6080 but web UI is not showing up.
Found the following error in ews/logs/catalina.out
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class org.apache.ranger.entity.XXAccessAuditV4] has no primary key specified. It should define either an #Id, #EmbeddedId or an #IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1619)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1082)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:857)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5128)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5653)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1689)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1679)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [defaultPU] failed.
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class org.apache.ranger.entity.XXAccessAuditV4] has no primary key specified. It should define either an #Id, #EmbeddedId or an #IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1954)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1945)
at org.eclipse.persistence.jpa.PersistenceProvider.createContainerEntityManagerFactory(PersistenceProvider.java:322)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:360)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:384)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:371)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1677)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1615)
... 21 more
Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [defaultPU] failed.
Internal Exception: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class org.apache.ranger.entity.XXAccessAuditV4] has no primary key specified. It should define either an #Id, #EmbeddedId or an #IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:230)
... 30 more
Caused by: Exception [EclipseLink-7161] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.ValidationException
Exception Description: Entity class [class org.apache.ranger.entity.XXAccessAuditV4] has no primary key specified. It should define either an #Id, #EmbeddedId or an #IdClass. If you have defined PK using any of these annotations then make sure that you do not have mixed access-type (both fields and properties annotated) in your entity class hierarchy.
at org.eclipse.persistence.exceptions.ValidationException.noPrimaryKeyAnnotationsFound(ValidationException.java:1422)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.validatePrimaryKey(EntityAccessor.java:1536)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.processMappingAccessors(EntityAccessor.java:1243)
at org.eclipse.persistence.internal.jpa.metadata.accessors.classes.EntityAccessor.process(EntityAccessor.java:697)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProject.processStage2(MetadataProject.java:1793)
at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processORMMetadata(MetadataProcessor.java:576)
at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:585)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1869)
... 28 more
Sep 05, 2020 2:56:32 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: One or more listeners failed to start. Full details will be found in the appropriate container log file
Sep 05, 2020 2:56:32 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [] startup failed due to previous errors
Sep 05, 2020 2:56:32 PM org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
Sep 05, 2020 2:56:32 PM org.apache.catalina.core.ApplicationContext log
INFO: Shutting down log4j
Sep 05, 2020 2:56:32 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [com.mysql.cj.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Sep 05, 2020 2:56:32 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [] registered the JDBC driver [org.apache.solr.client.solrj.io.sql.DriverImpl] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Sep 05, 2020 2:56:32 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [org.apache.hadoop.fs.FileSystem$Statistics$StatisticsDataReferenceCleaner] but has failed to stop it. This is very likely to create a memory leak.
Sep 05, 2020 2:56:32 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
SEVERE: The web application [] appears to have started a thread named [mysql-cj-abandoned-connection-cleanup] but has failed to stop it. This is very likely to create a memory leak.
Sep 05, 2020 2:56:32 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
SEVERE: The web application [] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal#2dfce76e]) and a value of type [org.apache.hadoop.fs.FileSystem.Statistics.StatisticsData] (value [9910 bytes read, 0 bytes written, 0 read ops, 0 large read ops, 0 write ops]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Sep 05, 2020 2:56:32 PM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks
SEVERE: The web application [] created a ThreadLocal with key of type [org.apache.htrace.core.Tracer.ThreadLocalContext] (value [org.apache.htrace.core.Tracer$ThreadLocalContext#4073a8a9]) and a value of type [org.apache.htrace.core.Tracer.ThreadContext] (value [org.apache.htrace.core.Tracer$ThreadContext#42aecda1]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Sep 05, 2020 2:56:32 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-6080"]
Sep 05, 2020 2:56:37 PM org.apache.catalina.loader.WebappClassLoaderBase findResourceInternal
INFO: Illegal access: this web application instance has been stopped already. Could not load []. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
Can someone please help here or redirect me to Ranger community so that I can reach out to someone for here.
Thanks in advance.

Issues were related to JAVA 11. I was trying to run ranger with JAVA 11
(https://issues.apache.org/jira/browse/RANGER-2575) but seems like it doesn't work. Building and running against java 8 worked.

Related

Struts startup failed due to logging errors

Struts application can not start with log4j.
What is wrong?
Here is log4j.properties:
# Direct to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Root logger option
log4j.rootLogger=INFO, stdout
# Good for troubleshooting
log4j.logger.org.hibernate=INFO
# Log JDBC parameters
log4j.logger.org.hibernate.type=ALL
Struts startup failed due to logging errors.
INFO: Starting Servlet Engine: Apache Tomcat/7.0.55
апр 28, 2015 3:42:01 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
java.lang.NoSuchMethodError: org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;Ljava/lang/Throwable;)V
at org.apache.commons.logging.impl.SLF4JLocationAwareLog.info(SLF4JLocationAwareLog.java:120)
at com.opensymphony.xwork2.util.logging.commons.CommonsLogger.info(CommonsLogger.java:42)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:175)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:234)
...
апр 28, 2015 3:42:01 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
апр 28, 2015 3:42:01 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/Struts2HiberQuize_last] startup failed due to previous errors
Your application server is failing to start due to problems with SLF4J (Simple Logging Facade for Java), not Log4j. You are probably:
including an old version of SLF4J, or
mixing multiple versions of SLF4J (one of which old), or
there is an old SLF4J version in the application server's shared libraries.
To fix this,
ensure you have the latest version of SLF4J, or a version higher than 1.6.0;
if not enough, check out which SLF4J classes are loaded ( and from where), as described here.

Spring Data Neo4j: using the Neo4j server with an embedded: JAR packaging

I was finally able to create a server instance within my java app that uses the embedded database as explained here. This works properly while I'm running it from Eclipse, but this is not actually my purpose (my app, between other things, feeds the database with new nodes and relationships). I have a Neo4j box which is supposed to be my server instance and I want to deploy my app there as a JAR file. In that way, I would like to access the web interface from there. I have already tested it: while running the java app in my development machine any machine in the same private network can access the interface without problems. The issue comes when trying to package everything into a JAR for server distribution.
The concrete error stack is as follows:
<!-- bean initialization stuff -->
Apr 11, 2013 1:14:30 PM org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog doInternalRecovery
INFO: Non clean shutdown detected on log [/data/production/graph.db/nioneo_logical.log.2]. Recovery started ...
Apr 11, 2013 1:14:32 PM org.neo4j.kernel.impl.transaction.xaframework.XaLogicalLog doInternalRecovery
INFO: Non clean shutdown detected on log [/data/production/graph.db/index/lucene.log.2]. Recovery started ...
2013-04-11 13:14:34,787 INFO [org.springframework.transaction.jta.JtaTransactionManager] - Using JTA UserTransaction: org.neo4j.kernel.impl.transaction.UserTransactionImpl#1b2fde11
2013-04-11 13:14:34,787 INFO [org.springframework.transaction.jta.JtaTransactionManager] - Using JTA TransactionManager: org.neo4j.kernel.impl.transaction.SpringTransactionManager#639c3c08
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Starting Neo Server on port [7474] with [40] threads available
Logger not configured, logging to std out instead: [FINE] Adding JAXRS packages [org.neo4j.server.rest.discovery] at [/]
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounted discovery module at [/]
Logger not configured, logging to std out instead: [FINE] Adding JAXRS packages [org.neo4j.server.rest.web] at [/db/data]
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounted REST API at [/db/data]
Logger not configured, logging to std out instead: [FINE] Adding JAXRS packages [org.neo4j.server.webadmin.rest] at [/db/manage]
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounted management API at [/db/manage]
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounted webadmin at [/webadmin]
2013-04-11 13:14:35,494 INFO [org.mortbay.log] - Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
Apr 11, 2013 1:14:35 PM org.neo4j.server.logging.Logger log
INFO: Mounting static content at [/webadmin] from [webadmin-html]
Logger not configured, logging to std out instead: [FINE] Found [jar:file:/home/jaranda/cicerone/cicerone-crawlers/target/cicerone-crawlers-0.0.1-SNAPSHOT.jar!/webadmin-html]
Logger not configured, logging to std out instead: [FINE] Mounting static content from [jar:file:/home/jaranda/cicerone/cicerone-crawlers/target/cicerone-crawlers-0.0.1-SNAPSHOT.jar!/webadmin-html] at [/webadmin]
Logger not configured, logging to std out instead: [FINE] Mounting servlet at [/db/manage]
Logger not configured, logging to std out instead: [FINE] Mounting servlet at [/db/data]
Logger not configured, logging to std out instead: [FINE] Mounting servlet at [/]
2013-04-11 13:14:35,556 INFO [org.mortbay.log] - jetty-6.1.x
2013-04-11 13:14:35,915 INFO [org.mortbay.log] - NO JSP Support for /webadmin, did not find org.apache.jasper.servlet.JspServlet
Apr 11, 2013 1:14:36 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
org.neo4j.server.webadmin.rest
Apr 11, 2013 1:14:39 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class org.neo4j.server.webadmin.rest.JmxService
class org.neo4j.server.webadmin.rest.ConsoleService
class org.neo4j.server.webadmin.rest.MonitorService
class org.neo4j.server.webadmin.rest.RootService
Apr 11, 2013 1:14:39 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 11, 2013 1:14:39 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
Apr 11, 2013 1:14:40 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
org.neo4j.server.rest.web
Apr 11, 2013 1:14:43 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class org.neo4j.server.rest.web.ResourcesService
class org.neo4j.server.rest.web.RestfulGraphDatabase
class org.neo4j.server.rest.web.DatabaseMetadataService
class org.neo4j.server.rest.web.ExtensionService
class org.neo4j.server.rest.web.CypherService
class org.neo4j.server.rest.web.BatchOperationService
Apr 11, 2013 1:14:43 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 11, 2013 1:14:43 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
Apr 11, 2013 1:14:43 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
org.neo4j.server.rest.discovery
Apr 11, 2013 1:14:46 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
class org.neo4j.server.rest.discovery.DiscoveryService
Apr 11, 2013 1:14:46 PM com.sun.jersey.api.core.ScanningResourceConfig init
INFO: No provider classes found.
Apr 11, 2013 1:14:46 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.9 09/02/2011 11:17 AM'
2013-04-11 13:14:46,751 INFO [org.mortbay.log] - Started SelectChannelConnector#172.20.100.33:7474
Apr 11, 2013 1:14:46 PM org.neo4j.server.logging.Logger log
INFO: Server started on [http://172.20.100.33:7474/]
2013-04-11 13:14:47,616 INFO [org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler] - Initializing ExecutorService 'taskScheduler'
2013-04-11 13:14:47,714 INFO [com.twitter.hbc.httpclient.BasicClient] - New connection executed: Hosebird-Client-02, endpoint: /1.1/statuses/filter.json?delimited=length&stall_warnings=true
2013-04-11 13:14:48,346 INFO [com.twitter.hbc.httpclient.ClientBase] - Hosebird-Client-02 Establishing a connection
Apr 11, 2013 1:14:48 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: A message body writer for Java class [B, and Java type class [B, and MIME media type application/json was not found
Apr 11, 2013 1:14:48 PM com.sun.jersey.spi.container.ContainerResponse write
SEVERE: The registered message body writers compatible with the MIME media type are:
*/* ->
com.sun.jersey.server.impl.template.ViewableMessageBodyWriter
Apr 11, 2013 1:14:48 PM com.sun.jersey.spi.container.ContainerResponse logException
SEVERE: Mapped exception to response: 500 (Internal Server Error)
javax.ws.rs.WebApplicationException: com.sun.jersey.api.MessageException: A message body writer for Java class [B, and Java type class [B, and MIME media type application/json was not found
at com.sun.jersey.spi.container.ContainerResponse.write(ContainerResponse.java:285)
at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1437)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1349)
at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1339)
at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:926)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
Caused by: com.sun.jersey.api.MessageException: A message body writer for Java class [B, and Java type class [B, and MIME media type application/json was not found
... 22 more
I must say I'm pretty new to Spring, Maven and Neo4j itself. I'm quite lost how to get rid of this issue. The web interface actually loads but without any kind of functionality. See attached shot:
.
The backend of my app works fine despite of this issue and actually new nodes/relationships are created.
I think this issue (or kind of) was discussed here but the answer is not clear to me.
Any suggestions? Thank you in advance!
I finally found a solution, which did the trick. I just share it, in case anyone else experiences the same issue. The problem was that some files under META-INF/services were being overwritten during the jar packaging process, since by default their content is not merged. According to the maven-shade plugin reference:
JAR files providing implementations of some interfaces often ship with
a META-INF/services/ directory that maps interfaces to their
implementation classes for lookup by the service locator. To merge
multiple implementations of the same interface into one service entry,
the ServicesResourceTransformer can be used.
So adding this transformer in my pom just worked, e.g.:
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
Hope it helps!

Sample Grails 2.14 app not working in Tomcat

Grails 2.1.4
Tomcat 7.0.37
Java 1.7
Window 7
I created Sample Grails app in eclipse, i run with run-app. it is working fine and able to open in brower also.
But for same application, i build .war file with grails:maven-install. And i am trying to deploy, But i am getting below error:
Mar 26, 2013 11:56:26 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/HelloGrails-0.1] startup failed due to previous errors
Mar 26, 2013 11:56:26 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/HelloGrails-0.1] created a ThreadLocal with key of type [org.codehaus.groovy.runtime.GroovyCategorySupport.MyThreadLocal] (value [org.codehaus.groovy.runtime.GroovyCategorySupport$MyThreadLocal#644aa32b]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference#601e8f7d]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Mar 26, 2013 11:56:26 PM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
SEVERE: The web application [/HelloGrails-0.1] created a ThreadLocal with key of type [org.codehaus.groovy.reflection.ClassInfo.ThreadLocalMapHandler] (value [org.codehaus.groovy.reflection.ClassInfo$ThreadLocalMapHandler#639ca35]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference#3c0a60c4]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.
Please help me..............
Thanks,
Ravi
create a file named logging.properties in WEB-INF/classes with following content:
org.apache.catalina.core.ContainerBase.[Catalina].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].handlers = java.util.logging.ConsoleHandler
Restart apache and look to the stacktrace

Failure to deploy grails app with cloudfoundry plugin

"grails cf-push" results in errors listed below. Is there a way using the cloudfoundry plugin to "start fresh". I would prefer not to lose my test data in a MySQL database and a MongoDB database.
May 18, 2012 6:31:26 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 18, 2012 6:31:26 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
May 18, 2012 6:31:26 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.codehaus.groovy.reflection.ClassInfo.ThreadLocalMapHandler] (value [org.codehaus.groovy.reflection.ClassInfo$ThreadLocalMapHandler#6434d75f]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference#4927d15e]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
2012-05-18 18:31:26,379 [main] ERROR context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsApplication' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: org/apache/http/conn/ClientConnectionManager
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:384)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:283)
at org.codehaus.groovy.grails.web.context.GrailsContextLoader.initWebApplicationContext(GrailsContextLoader.java:66)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4206)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4705)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1317)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1065)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
at org.apache.catalina.core.StandardService.start(StandardService.java:525)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
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: java.lang.NoClassDefFoundError: org/apache/http/conn/ClientConnectionManager
at java.lang.Class.forName(Class.java:169)
at java.lang.Class.forName(Class.java:247)
Caused by: java.lang.ClassNotFoundException: org.apache.http.conn.ClientConnectionManager
... 2 more
Stopping Tomcat because the context stopped.
stderr.log is :
May 18, 2012 6:41:00 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-31903
May 18, 2012 6:41:00 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 403 ms
May 18, 2012 6:41:00 PM org.apache.catalina.realm.JAASRealm setContainer
INFO: Set JAAS app name Catalina
May 18, 2012 6:41:00 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 18, 2012 6:41:00 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.35
May 18, 2012 6:41:00 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory ROOT
May 18, 2012 6:41:02 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
May 18, 2012 6:41:02 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [] startup failed due to previous errors
May 18, 2012 6:41:02 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [] created a ThreadLocal with key of type [org.codehaus.groovy.reflection.ClassInfo.ThreadLocalMapHandler] (value org.codehaus.groovy.reflection.ClassInfo$ThreadLocalMapHandler#6d1576d7]) and a value of type [java.lang.ref.SoftReference] (value [java.lang.ref.SoftReference#1c2d5534]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
If you do cf-update or delete the app and re-run cf-push, it will ask you if you want to use the existing MySQL and Mongo services. If you do there isn't any data loss - just don't delete the services along with the app before re-running cf-push.
Make sure you're using 'grails prod cf-push' since that will use the production configuration - there is a warning displayed if you run 'grails cf-push' to that effect.
The root cause is a CNFE from the HttpClient library. See if you can get it working locally and it should work fine on Cloud Foundry since you're just pushing a war file.
I found the problem. I added a service that used an external jar from a third party package. The third party package shipped with 2 jars: one with dependencies and one without dependencies. I extracted the 3rd party zip into my classpath, but only included the one without dependencies in my lib directory. When I switched to using the jar with dependencies, the app deployed.The following things made this simple problem difficult to resolve:the error logs simply stated that there was a problem with 'grailsApplication' and there was a class not foundthe app ran on my workstation using run-app,the app doesn't run on my workstation using run-war (regardless of whether the correct jars are supplied),lack of sleep!
On to the next issue!

Java SecurityManager with SpringSecurity

I try join Java Security Manager to project with SpringSecurity (SS). I have the goal: my project works with SS and has dataSource (db2 database) as authentication-manager. I added ScriptManager(ScriptEngine) to project. Now I tries to setup security of project, what deny untrusted code. I use NetBeans and in properties of Tomcat (6.0.20) setup "Use Security Manager". Next, I edited {catalina.base}/conf/catalina.police. I added next "grants":
grant codeBase "file:${catalina.base}/webapps/myapp/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${catalina.base}/webapps/myapp/WEB-INF/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${catalina.base}/webapps/myapp/WEB-INF/lib/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${catalina.base}/webapps/myapp/WEB-INF/classes/-" {
permission java.security.AllPermission;
};
grant codeBase "file:${catalina.base}/work/Catalina/localhost/myapp/" {
permission java.lang.RuntimePermission "defineClassInPackage.org.apache.jasper.runtim e";
permission java.lang.RuntimePermission "accessDeclaredMembers";
};
grant codeBase "file:${catalina.base}/webapps/myapp/-" {
permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
permission java.lang.reflect.ReflectPermission "accessDeclaredMembers";
permission java.io.FilePermission "${catalina.home}${file.separator}myapp${file.sepa rator}*", "read";
permission java.lang.RuntimePermission "accessDeclaredMembers";
permission java.lang.RuntimePermission "*";
permission java.util.PropertyPermission "*", "read";
};
And now problem. When I run my code under debuger I get next error:
07.12.2010 2:06:02 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
07.12.2010 2:06:04 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListe ner
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.config.http.UserDeta ilsServiceInjectionBeanPostProcessor#0': Initialization of bean failed; nested exception is java.security.AccessControlException: access denied (java.lang.RuntimePermission accessDeclaredMembers)
.................................................
and tomcat out:
Using CATALINA_BASE: /home/user/.netbeans/6.8/apache-tomcat-6.0.20_base
Using CATALINA_HOME: /usr/local/apache-tomcat-6.0.20
Using CATALINA_TMPDIR: /home/user/.netbeans/6.8/apache-tomcat-6.0.20_base/temp
Using JRE_HOME: /usr/lib/jvm/java
Using Security Manager
Listening for transport dt_socket at address: 11555
07.12.2010 2:04:43 org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/lib/i386/server:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/lib/i386:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/../lib/i386:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/lib/i386/client:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/lib/i386:/usr/lib/jvm/java-1.6.0-sun-1.6.0.u11/jre/../lib/i386:/usr/lib/mpi/gcc/openmpi/lib:/usr/java/packages/lib/i386:/lib:/usr/lib
07.12.2010 2:04:43 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8084
07.12.2010 2:04:43 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-9443
07.12.2010 2:04:43 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1536 ms
07.12.2010 2:04:43 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
07.12.2010 2:04:43 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.20
07.12.2010 2:04:45 org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(/home/deniz/NetBeansProjects/opensee/build/web/WEB-INF/lib/servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
07.12.2010 2:04:45 org.apache.juli.ClassLoaderLogManager readConfiguration
WARNING: Reading /home/deniz/NetBeansProjects/opensee/build/web/WEB-INF/classes/logging.properties is not permitted. See "per context logging" in the default catalina.policy file.
07.12.2010 2:04:45 org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "com.sun.faces.config.ConfigureListener" is already configured for this context. The duplicate definition has been ignored.
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
07.12.2010 2:04:47 com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.2 (FCS b10) for context '/opensee'
07.12.2010 2:04:47 org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
07.12.2010 2:04:47 org.apache.catalina.core.StandardContext start
SEVERE: Context [/opensee] startup failed due to previous errors
07.12.2010 2:04:47 com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactor y(FactoryFinder.java:804)
at javax.faces.FactoryFinder.getFactory(FactoryFinder .java:306)
at com.sun.faces.config.InitFacesContext.getApplicati on(InitFacesContext.java:104)
at com.sun.faces.config.ConfigureListener.contextDest royed(ConfigureListener.java:309)
at org.apache.catalina.core.StandardContext.listenerS top(StandardContext.java:3973)
at org.apache.catalina.core.StandardContext.stop(Stan dardContext.java:4577)
.................
Also, when I insert this grant:
grant {
permission java.security.AllPermission;
};
all ok.
OS: openSUSE 11.1
OpenJDK 1.6.0.0-b11
For setup used this tutorial: http://www.mikeski.net/site/node/18
Thanks all...

Resources