I have been trying to develop a web-app which takes data through rest and inserts the same data in hbase using phoenix. I have tried to deploy my application on tomcat and it works fine. But is throws the following runtime exception while deploying it on jboss.
Caused by: java.lang.RuntimeException: hbase-default.xml file seems to be for and old version of HBase (null), this version is 0.94.7
at org.apache.hadoop.hbase.HBaseConfiguration.checkDefaultsVersion(HBaseConfiguration.java:68)
at org.apache.hadoop.hbase.HBaseConfiguration.addHbaseResources(HBaseConfiguration.java:100)
at org.apache.hadoop.hbase.HBaseConfiguration.create(HBaseConfiguration.java:111)
at com.salesforce.phoenix.query.ConfigurationFactory$ConfigurationFactoryImpl.getConfiguration(ConfigurationFactory.java:51)
at com.salesforce.phoenix.query.QueryServicesOptions.withDefaults(QueryServicesOptions.java:99)
at com.salesforce.phoenix.query.QueryServicesImpl.(QueryServicesImpl.java:44)
at com.salesforce.phoenix.jdbc.PhoenixDriver.(PhoenixDriver.java:67)
at com.salesforce.phoenix.jdbc.PhoenixDriver.(PhoenixDriver.java:58)
... 11 more
First i thought that class path has two default xmls and its throwing the error because one of the two is from some older version of hbase jar. But the class path has no hbase jar. It only has one phoenix-2.0.1-client.jar. I have tried the following things after that
Setting "hbase.default.for.version.skip" to true in hbase-site.xml and adding that to class path
Setting "hbase.default.for.version.skip" to true in hbase-default.xml
Just for experiment's sake i also tried deleting the hbase-default.xml.
Nothing has worked so far. The result being constant. I am using cloudera hbase cdh 4.4 .
Any help would be extremely appreciated.
Thanks in advance.
Related: https://groups.google.com/forum/#!topic/phoenix-hbase-user/GpeGDDjEH_g
the solution seems to be to remove META-INF/services/java.sql.Driver from the phoenix--client.jar (or phoenix-core-.jar ) and instead use Class.forName("com.salesforce.phoenix.jdbc.PhoenixDriver") in your code somewhere (before trying to open a connection) as Jboss seems to reorder the jars differently from tomcat.
this worked for me (assuming phoenix is installed in a local maven repository):
mkdir /tmp/myjar
cd /tmp/myjar
cp ~/.m2/repository/com/salesforce/phoenix-core/3.0.0-SNAPSHOT/phoenix-core-3.0.0-SNAPSHOT.jar ./
jar -xvf phoenix-core-3.0.0-SNAPSHOT.jar
rm META-INF/services/java.sql.Driver
rm phoenix-core-3.0.0-SNAPSHOT.jar
jar -cvf phoenix-core-3.0.0-SNAPSHOT.jar ./
cp phoenix-core-3.0.0-SNAPSHOT.jar ~/.m2/repository/com/salesforce/phoenix-core/3.0.0-SNAPSHOT/
re-build the webapp and deploy to Jboss:
cd ~/phoenix-restservice
mvn clean install
additional trick for JBoss/Phoenix integration - Jboss throws this error as it includes Resteasy JAX-RS implementation by default and Hbase uses Jersey JAX-RS jars which causes a collision ( as in Deploying a Jersey webapp on Jboss AS 7):
"org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011232: Only one JAX-RS Application Class allowed"
to fix add to ~/your_phoenix_restservice/src/main/webapp/WEB-INF/web.xml:
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.providers</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.resources</param-name>
<param-value>false</param-value>
</context-param>
also it's a good idea to initialize hbase connection on startup, this can be done using InitServlet as described in JBoss at Work: A Practical Guide, p.260
as a side note do you mind open-sourcing your version of rest api for phoenix? this would be helpful for us and a bunch of other people.
Related
I am migration Java Web Application from jboss 6.0 to wildfly 11. I am getting
"java.lang.ClassCastException: __redirected.__XMLInputFactory cannot
be cast to org.codehaus.stax2.XMLInputFactory2" while running the code
on wildfly 11.0.0.Final. Junit tests are working without error.
Looks like there is some dependency issue in wildfly but unable to find any solution. Appreciate any help to resolve this issue..
I have included following woodstox dependencies in pom.
woodstox-core-asl 4.4.1
stax2-api 3.1.4
Thanks
Sanjay
This is caused by duplicate classes in the classpath.
Wildfly ships stax2-api as part of the woodstocks module, see modules/system/layers/base/org/codehaus/woodstox/main/ in the wildfly dist folder.
If you also have it in your application's lib folder, this will cause issues.
The solution is to either set the dependency to <scope>provided</scope> (or build) in pom.xml, or if you really need a special version, exclude wildfly's module via jboss-deployment-structure.xml.
See https://docs.jboss.org/author/display/WFLY10/Class+Loading+in+WildFly for more information on classloading in Wildfly.
I am trying to deploy my kjar to KIE execution server but getting an exception while creating a solver 'taskPlanningSolver' using PUT on URL:
http://localhost:8080/kie-server/services/rest/server/containers/taskplanning1/solvers/taskPlanningSolver
Here's what I have:
A. I have a KIE execution server running on tomcat(windows). It supports BRMS and BPM.
B. I have a maven project (that uses optaplanner) and it's installed to my local maven repo.
C. I successfully created a container in KIE server using PUT on:
http://localhost:8080/kie-server/services/rest/server/containers/taskplanning1
with body:
<kie-container container-id="taskplanning1">
<release-id>
<group-id>com.kairos.planning</group-id>
<artifact-id>task-planning</artifact-id>
<version>1.0.1-SNAPSHOT</version>
</release-id>
</kie-container>
I need help with creating a solver which is throwing exception:
"Unexpected error during processing: sun.reflect.annotation.TypeNotPresentExceptionProxy"
Notes:
I do have kmodule.xml in jar installed in maven repo and its inside META-INF and it's content is only:
2017-08-30 11:56:07,977 ERROR [org.kie.server.remote.rest.optaplanner.SolverResource] (default task-3) Unexpected error creating solver 'taskPlanningSolver' on container 'taskplanning2': sun.reflect.annotation.TypeNotPresentExceptionProxy: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
at java.lang.Class.createAnnotationData(Class.java:3521)
at java.lang.Class.annotationData(Class.java:3510)
at java.lang.Class.getAnnotation(Class.java:3415)
at com.thoughtworks.xstream.mapper.AnnotationMapper$UnprocessedTypesSet.add(AnnotationMapper.java:614)
at com.thoughtworks.xstream.mapper.AnnotationMapper$UnprocessedTypesSet.add(AnnotationMapper.java:599)
at com.thoughtworks.xstream.mapper.AnnotationMapper.processAnnotations(AnnotationMapper.java:162)
at com.thoughtworks.xstream.XStream.processAnnotations(XStream.java:2036)
at com.thoughtworks.xstream.XStream.processAnnotations(XStream.java:2047)
at org.kie.server.api.marshalling.xstream.XStreamMarshaller.configureMarshaller(XStreamMarshaller.java:186)
at org.kie.server.api.marshalling.xstream.XStreamMarshaller.<init>(XStreamMarshaller.java:103)
at org.kie.server.api.marshalling.BaseMarshallerBuilder.build(BaseMarshallerBuilder.java:37)
at org.kie.server.api.marshalling.MarshallerFactory.getMarshaller(MarshallerFactory.java:52)
at org.kie.server.services.impl.KieContainerInstanceImpl.getMarshaller(KieContainerInstanceImpl.java:175)
I also see a lot of exceptions while creating container but container gets created successfully. All the errors are NoClassDefFoundError and even though I added all the dependencies to my project's pom I still get a new class that causes NoClassDefFoundError.
I also dont have a good guide to deploy kjar to kie execution server. I'll be creating one after successfully testing it. Please help if possible. Thanks in advance.
The Kie execution server already has optaplanner jars and it has all the dependencies that will ever be need including all logging dependencies. So, you need to make sure your project's pom has zero runtime dependencies. All the dependencies you require in your project should be marked provided scope like:
<dependency>
<groupId>org.optaplanner</groupId>
<artifactId>optaplanner-persistence-common</artifactId>
<version>${version.optaplanner.bom}</version>
<scope>provided</scope>
</dependency>
I am on Hortonworks Distribution 2.4 (effectively hadoop 2.7.1 and spark 1.6.1)
I am packaging my own version of spark in the uber jar (2.1.0) while cluster is on 1.6.1. In the process, i am sending all required libraries through a fat jar (built using maven - uber jar concept).
However, spark submit (through spark 2.1.0 client) fails citing NoClassFound Error on jersey client. Upon listing my uber jar contents, i can see the exact class file in the jar, still spark/yarn cant find it.
here goes -
The error message -
Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/api/client/config/ClientConfig
at org.apache.hadoop.yarn.client.api.TimelineClient.createTimelineClient(TimelineClient.java:55)
at org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.createTimelineClient(YarnClientImpl.java:181)
at org.apache.hadoop.yarn.client.api.impl.YarnClientImpl.serviceInit(YarnClientImpl.java:168)
at org.apache.hadoop.service.AbstractService.init(AbstractService.java:163)
at org.apache.spark.deploy.yarn.Client.submitApplication(Client.scala:151)
at org.apache.spark.scheduler.cluster.YarnClientSchedulerBackend.start(YarnClientSchedulerBackend.scala:56)
at org.apache.spark.scheduler.TaskSchedulerImpl.start(TaskSchedulerImpl.scala:156)
at org.apache.spark.SparkContext.<init>(SparkContext.scala:509)
at org.apache.spark.SparkContext$.getOrCreate(SparkContext.scala:2313)
at org.apache.spark.sql.SparkSession$Builder$$anonfun$6.apply(SparkSession.scala:868)
at org.apache.spark.sql.SparkSession$Builder$$anonfun$6.apply(SparkSession.scala:860)
at scala.Option.getOrElse(Option.scala:121)
at org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:860)
And here is my attempt to find the class in jar file -
jar -tf uber-xxxxx-something.jar | grep jersey | grep ClientCon
com/sun/jersey/api/client/ComponentsClientConfig.class
com/sun/jersey/api/client/config/ClientConfig.class
... Other files
what could be going on here ? Suggestions ? ideas please..
EDIT
the jersey client section of the pom goes here -
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.3</version>
</dependency>
EDIT
I also wanted to indicate this, that my code is compiled with Scala 2.12 with compatibility level set to 2.11. However, the cluster is perhaps on 2.10. I am saying perhaps since I believe that cluster nodes dont necessarily have to have Scala binaries installed; YARN just launches the components' jar/class files without using Scala binaries. wonder if thats playing a role here !!!
I am trying to upgrade an old project from Spring 2.5.6 to Spring 3.1.0. The project is not built with Maven so I had to add the jars manually to the build path.
The application uses Eclipse RAP as well as Spring.
I added all the Spring 3.1 jars in my build path:
lib/org.springframework.aop-3.1.0.RELEASE.jar
lib/org.springframework.asm-3.1.0.RELEASE.jar
lib/org.springframework.aspects-3.1.0.RELEASE.jar
lib/org.springframework.beans-3.1.0.RELEASE.jar
lib/org.springframework.context-3.1.0.RELEASE.jar
lib/org.springframework.context.support-3.1.0.RELEASE.jar
lib/org.springframework.core-3.1.0.RELEASE.jar
lib/org.springframework.expression-3.1.0.RELEASE.jar
lib/org.springframework.instrument-3.1.0.RELEASE.jar
lib/org.springframework.instrument.tomcat-3.1.0.RELEASE.jar
lib/org.springframework.jdbc-3.1.0.RELEASE.jar
lib/org.springframework.jms-3.1.0.RELEASE.jar
lib/org.springframework.orm-3.1.0.RELEASE.jar
lib/org.springframework.oxm-3.1.0.RELEASE.jar
lib/org.springframework.test-3.1.0.RELEASE.jar
lib/org.springframework.transaction-3.1.0.RELEASE.jar
lib/org.springframework.web-3.1.0.RELEASE.jar
lib/org.springframework.web.portlet-3.1.0.RELEASE.jar
lib/org.springframework.web.servlet-3.1.0.RELEASE.jar
lib/org.springframework.web.struts-3.1.0.RELEASE.jar
and I also listed them in the MANIFEST.MF.
The project builds fine, but at runtime when trying to login it gives me the following error:
java.lang.NoClassDefFoundError: org/springframework/beans/factory/ListableBeanFactory
I looked in the beans jar and the class is definitely there. I also searched through the project and the class is not used explicitly anywhere.
What could cause this? Thank you in advance.
This class does not exist in Spring 3.1.0. See http://www.jarfinder.com/index.php/java/info/org.springframework.beans.factory.ListableBeanFactory
I have prepared my ejb jars and war using weblogic.appc
weblogic 11g R1, all compilations were fine, I have prepared ear and deployed in weblogi server .I am getting belows erorr. afte deployment and ear status went to failed state.
I am not att all using this oracle.help.OHW file. don't know it is refered
Can any suggest how comeout of this problem.
[HTTP:101216]Servlet: "OHW" failed to preload on startup in Web application: "cbcm". javax.servlet.ServletException: [HTTP:101249][ServletContext#13514259[app:cbcm module:cbcm path:/cbcm spec-version:null]]: Servlet class oracle.help.OHW for servlet OHW could not be loaded because the requested class was not found in the classpath . java.lang.ClassNotFoundException: oracle.help.OHW. at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:551) at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppServletContext.java:1985) at weblogic.servlet.internal.WebAppServletContext.loadServletsOnStartup(WebAppServletContext.java:1959) at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1878) at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3153) at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1508) at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:482) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119) at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200) at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247) at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119) at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27) at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:636) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52) at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:205) at weblogic.application.internal.EarDeployment.activate(EarDeployment.java:58) at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:161) at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:79) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.activate(AbstractOperation.java:569) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.activateDeployment(ActivateOperation.java:150) at weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCommit(ActivateOperation.java:116) at weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit(StartOperation.java:140) at weblogic.deploy.internal.targetserver.operations.AbstractOperation.commit(AbstractOperation.java:323) at weblogic.deploy.internal.targetserver.DeploymentManager.handleDeploymentCommit(DeploymentManager.java:844) at weblogic.deploy.internal.targetserver.DeploymentManager.activateDeploymentList(DeploymentManager.java:1253) at weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(DeploymentManager.java:440) at weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit(DeploymentServiceDispatcher.java:163) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:195) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer.access$100(DeploymentReceiverCallbackDeliverer.java:13) at weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallbackDeliverer$2.run(DeploymentReceiverCallbackDeliverer.java:68) at weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWorkManagerImpl.java:528) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Check your web.xml within your WAR, there is a servlet and servlet-mapping for the Oracle help files and this servlet most likely.
Comment out those.
I received the same error as "failed to preload on startup in Web application:".
Below is how I am able to resolve the error.
in your web.xml, check if following property is present
<load-on-startup>0</load-on-startup>
this property is to load your bundled artifacts during the server restart itself. This was the cause of the issue because there were some jar file which weblogic server required to load before the loading of our bundled artifacts. Now since server is not yet started completely and all the libraries required to our application is not yet loaded, hence server is throwing "failed to preload on startup in Web application:".
The solution to this is remove load-on-startup from web.xml and That's it!!