I´m using JBoss AS 7.1.1.
I need some jobs to run in a specific date and time, so instead of using Quartz, I´m trying to use the #Schedule annotation. When I was testing, it worked just fine, but when I started implementing my real business, my real problems started. so, that´s my scenario:
I have 1 component, for loggin and utils porposes, I use it in a lot of projects and it works fine, that would be something like it:
My log ejb (it works fine in a lot of other components, basically all of them):
package com.ejb.utils;
#Stateless
public class LogBean implements LogRemote { // => that´s the remote interface
public void log(LogParameters params) {
doTheLogginThings();
}
}
so, I have this other project where I´m using the #Schedule. In this example I´m using the #Stateless annotation, but I have also tried by using #Singleton as well.
The problem is: the Schedule is working just fine, but the log EJB is can´t get an instance of the object, only when using the #Schedule. in any other ways, it works fine. The entitymanager is injecting as expected. Can someone help me out?
package com.batch.jobs;
#Stateless
public class MyBatchJobsBean implements MyBatchJobsRemote { // => that´s my remote interface
#PersistenceContext
private EntityManager em;
#EJB( lookup = LogRemote.JNDI_NAME )
private LogRemote log;
private someDAO dao;
#PostConstruct
private void init(){
dao = new someDAO(em);
}
#Schedule( minute = "*/3", dayOfWeek = "Mon , Tue , Wed , Thu , Fri", hour = "7,8,9,10,11,12,13,14,15,16,17,18,19,20" )
private void executeBatchJob() {
executeSomeJob();
log.log("Log this things");
}
}
Edit 2: The new stacktrace:
16:09:01,066 ERROR [org.jboss.ejb3.invocation] (EJB default - 1) JBAS014134: EJB Invocation failed on component PSLogBean for method public abstract br.com.pvs.pscorepersistence.model.coreframework.PSLog br.com.pvs.pscoreservices.interfaces.PSLogRemote.iniciarLog(java.lang.String,java.lang.String): javax.ejb.EJBException: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:166) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:230) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.requiresNew(CMTTxInterceptor.java:328) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:192) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:80) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:32) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.remote.LocalEjbReceiver.processInvocation(LocalEjbReceiver.java:179) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:179) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.TransactionInterceptor.handleInvocation(TransactionInterceptor.java:43) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:128) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:181) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:136) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:121) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:104) [jboss-ejb-client-1.0.5.Final.jar:1.0.5.Final]
at $Proxy72.iniciarLog(Unknown Source) at br.com.pvs.reports.business.ExecucaoRelatorioBusiness.executarDashboardPerfil(ExecucaoRelatorioBusiness.java:89)
at br.com.pvs.reports.business.ExecucaoRelatorioBusiness.executarDashboardPerfil3Minutos(ExecucaoRelatorioBusiness.java:51)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.doMethodInterception(Jsr299BindingsInterceptor.java:127) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.weld.ejb.Jsr299BindingsInterceptor.processInvocation(Jsr299BindingsInterceptor.java:137) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:34) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:34) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.jpa.interceptor.SBInvocationInterceptor.processInvocation(SBInvocationInterceptor.java:47) [jboss-as-jpa-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.weld.ejb.EjbRequestScopeActivationInterceptor.processInvocation(EjbRequestScopeActivationInterceptor.java:101) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:304) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.timerservice.TimedObjectInvokerImpl.callTimeout(TimedObjectInvokerImpl.java:101) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.timerservice.task.CalendarTimerTask.callTimeout(CalendarTimerTask.java:60) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.timerservice.task.TimerTask.retryTimeout(TimerTask.java:184) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.timerservice.task.TimerTask.run(TimerTask.java:140) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) [rt.jar:1.6.0_31]
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) [rt.jar:1.6.0_31]
at java.util.concurrent.FutureTask.run(FutureTask.java:138) [rt.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_31]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:163) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.component.stateless.StatelessSessionComponent$1.create(StatelessSessionComponent.java:66) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.component.stateless.StatelessSessionComponent$1.create(StatelessSessionComponent.java:63) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.pool.AbstractPool.create(AbstractPool.java:60) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.pool.strictmax.StrictMaxPool.get(StrictMaxPool.java:123) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:47) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:228) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
... 78 more
Caused by: java.lang.NullPointerException
at br.com.pvs.pscoreservices.services.PSLogBean.init(PSLogBean.java:49) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_31]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_31]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_31]
at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_31]
at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:73) [jboss-as-weld-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]
at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]
... 86 more
Related
When I call the following reproducible doce:
install.packages("h2o", type = "source", repos =
"http://h2o-release.s3.amazonaws.com/h2o/rel-ueno/8/R")
library(rsparkling)
library(h2o)
library(sparklyr)
library(dplyr)
library(DBI)
library(readr)
library(stringr)
conf <- spark_config()
conf$'sparklyr.shell.executor-memory' <- "460G"
conf$'sparklyr.shell.driver-memory' <- "460G"
conf$spark.executor.cores <- 32
conf$spark.executor.memory <- "460G"
conf$spark.executor.instances <- 8
conf$spark.dynamicAllocation.enabled <- "false"
conf$maximizeResourceAllocation <- "true"
conf$spark.default.parallelism <- 32
sc <- spark_connect(master = "local", config = conf, version = "2.0.2")
h2o_context(sc ,strict_version_check = T)
h2o.init(nthreads = -1)
NFLPlayers <- c('Von Miller','Christian McCaffrey','Joe Thomas')
salary <- c(21000, 23400, 26800)
Valuable = c(1,1,1)
Rdata <- data.frame(NFLPlayers, salary, Valuable)
system.time(Test <- copy_to(sc, Rdata, "Rdata"))
Test1 = as_h2o_frame(sc, Test, strict_version_check = FALSE)
Test1$Valuable<-as.factor(Test1$Valuable)
On an H2O dataframe I get the following error.
ERROR: Unexpected HTTP Status code: 500 Server Error (url = http://127.0.0.1:54321/99/Rapids)
Error: lexical error: invalid char in json text.
<html> <head> <meta http-equiv=
(right here) ------^
This is brand new and it is not only happening in my computer but also on that of a colleague. I have restarted the cluster. Reinstalled sparklyr and Rsparkling. I have also changed versions and am constantly getting the same error. Any ideas?
Some of the logs:
06-19 22:46:24.991 127.0.0.1:54321 2158 #2868-244 INFO: POST /99/Rapids, parms: {ast=(tmp= RTMP_sid_8db5_1 (:= frame_rdd_58_b5fd354222706e76381948c109884d05 (as.factor (cols frame_rdd_58_b5fd354222706e76381948c109884d05 [8])) [8] [])), session_id=_sid_8db5}
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: java.lang.NoClassDefFoundError: no/priv/garshol/duke/Comparator
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.rapids.Env.<clinit>(Env.java:278)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.rapids.Session.exec(Session.java:86)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.rapids.Rapids.exec(Rapids.java:93)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.api.RapidsHandler.exec(RapidsHandler.java:41)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at java.lang.reflect.Method.invoke(Method.java:498)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.api.Handler.handle(Handler.java:63)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.api.RequestServer.serve(RequestServer.java:448)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.api.RequestServer.doGeneric(RequestServer.java:297)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.api.RequestServer.doPost(RequestServer.java:223)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at water.JettyHTTPD$LoginHandler.handle(JettyHTTPD.java:183)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.Server.handle(Server.java:370)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.BlockingHttpConnection.handleRequest(BlockingHttpConnection.java:53)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.BlockingHttpConnection.handle(BlockingHttpConnection.java:72)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:264)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at java.lang.Thread.run(Thread.java:748)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: Caused by: java.lang.ClassNotFoundException: no.priv.garshol.duke.Comparator
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
06-19 22:46:25.081 127.0.0.1:54321 2158 #2868-244 ERRR: ... 37 more
This was a bug and is fixed in latest Sparkling Water versions for Spark 2.0, Spark 2.1 and Spark 2.2
public class Maincontroll implements Controller {
Empdao dao;
public void setDao(Empdao dao) {
this.dao = dao;
}
public Empdao getDao() {
return dao;
}
#Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
Employee e = new Employee();
e.setName(request.getParameter("name"));
e.setEmail(request.getParameter("email"));
e.setMobile(request.getParameter("mobile"));
e.setAddress(request.getParameter("address"));
int i = dao.save(e);
System.out.println("ivalue is : "+i);
return new ModelAndView("sucess");
}
}
java.lang.NullPointerException
at nxt.Maincontroll.handleRequest(Maincontroll.java:30)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:771)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Where exactly are you injecting the dao object into your controller? The getter and setter don't constitute injection. They are simply what the container uses to inject beans. Do you have an xml configuration of this bean?
I have my service endpoint invoking get() method on my DAO, but fails with java.lang.NullPointerException. while debuging it seems Spring cannot find the implementation of my DAO
ContactEndoint
package com.spring.contacts;
#Endpoint
#Configuration
#ComponentScan(basePackages="com.spring.contacts")
#EnableWebMvc
public class ContactEndpoint {
private static final String NAMESPACE_URI = "http://spring.io/guides/gs-producing-web-service";
#Autowired
private ContactDAO contactDAO;
//Default constructor
public ContactEndpoint(){
}
#Autowired
public ContactEndpoint(ContactDAO contactDAO) {
this.contactDAO = contactDAO;
}
#Cacheable(cacheName="imageCache", keyGenerator=#KeyGenerator(name="StringKeyCache"))
#PayloadRoot(namespace = NAMESPACE_URI, localPart = "getContactRequest")
#RequestMapping(value = "/editContact", method = RequestMethod.GET)
#ResponsePayload
public GetContactResponse getContact(#RequestPayload GetContactRequest request){
GetContactResponse response = new GetContactResponse();
response.setContact(contactDAO.get(request.getId()));
return response;
}
ContactDAO
package com.spring.contacts.dao;
public interface ContactDAO {
public Contact get(int contactId);
ContactDAOImpl
package com.spring.contacts.dao;
#Repository("contactDAO")
public class ContactDAOImpl implements ContactDAO {
private JdbcTemplate jdbcTemplate;
//default constructor
public ContactDAOImpl(){
}
public ContactDAOImpl(DataSource dataSource) {
jdbcTemplate = new JdbcTemplate(dataSource);
}
#Override
public Contact get(int contactId) {
String sql = "SELECT * FROM contact WHERE contact_id=" + contactId;
return jdbcTemplate.query(sql, new ResultSetExtractor<Contact>() {
#Override
public Contact extractData(ResultSet rs) throws SQLException,
DataAccessException {
if (rs.next()) {
Contact contact = new Contact();
contact.setId(rs.getInt("contact_id"));
contact.setName(rs.getString("name"));
contact.setEmail(rs.getString("email"));
contact.setAdress(rs.getString("address"));
contact.setTelephone(rs.getString("telephone"));
return contact;
}
return null;
}
});
}
WebServiceConfig
package com.spring.contacts;
#EnableWs
#Configuration
#ComponentScan("com.spring")
public class WebServiceConfig extends WsConfigurerAdapter {
#Bean
public ServletRegistrationBean messageDispatcherServlet(ApplicationContext applicationContext) {
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
servlet.setApplicationContext(applicationContext);
servlet.setTransformWsdlLocations(true);
return new ServletRegistrationBean(servlet, "/ws/*");
}
#Bean(name = "countries")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema countriesSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("CountriesPort");
wsdl11Definition.setLocationUri("/ws");
wsdl11Definition.setTargetNamespace("http://spring.io/guides/gs-producing-web-service");
wsdl11Definition.setSchema(countriesSchema);
return wsdl11Definition;
}
#Bean(name = "contacts")
public DefaultWsdl11Definition defaultContactsWsdl11Definition(XsdSchema contactsSchema){
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("ContactsPort");
wsdl11Definition.setLocationUri("/ws/JDBC");
wsdl11Definition.setTargetNamespace("http://spring.io/guides/gs-producing-web-service");
wsdl11Definition.setSchema(contactsSchema);
return wsdl11Definition;
}
#Bean
public XsdSchema countriesSchema() {
return new SimpleXsdSchema(new ClassPathResource("countries/countries.xsd"));
}
#Bean
public XsdSchema contactsSchema(){
return new SimpleXsdSchema(new ClassPathResource("contacts/contact.xsd"));
}
StackTrace
java.lang.NullPointerException: null
at com.spring.contacts.dao.ContactDAOImpl.get(ContactDAOImpl.java:85) ~[ContactDAOImpl.class:na]
at com.spring.contacts.dao.ContactDAOImpl$$FastClassBySpringCGLIB$$f0feb335.invoke(<generated>) ~[spring-core-4.1.6.RELEASE.jar:na]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:717) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) ~[spring-tx-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:653) ~[spring-aop-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at com.spring.contacts.dao.ContactDAOImpl$$EnhancerBySpringCGLIB$$5f3048d3.get(<generated>) ~[spring-core-4.1.6.RELEASE.jar:na]
at com.spring.contacts.ContactEndpoint.getContact(ContactEndpoint.java:45) ~[ContactEndpoint.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
at org.springframework.ws.server.endpoint.MethodEndpoint.invoke(MethodEndpoint.java:134) ~[spring-ws-core-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.ws.server.endpoint.adapter.DefaultMethodEndpointAdapter.invokeInternal(DefaultMethodEndpointAdapter.java:291) ~[spring-ws-core-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.ws.server.endpoint.adapter.AbstractMethodEndpointAdapter.invoke(AbstractMethodEndpointAdapter.java:55) ~[spring-ws-core-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:236) [spring-ws-core-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:176) [spring-ws-core-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89) ~[spring-ws-core-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61) ~[spring-ws-core-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293) ~[spring-ws-core-2.2.1.RELEASE.jar:2.2.1.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) ~[servlet-api.jar:na]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) ~[spring-webmvc-4.1.6.RELEASE.jar:4.1.6.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) ~[servlet-api.jar:na]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) ~[catalina.jar:8.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina.jar:8.0.21]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) ~[tomcat-websocket.jar:8.0.21]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) ~[catalina.jar:8.0.21]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) ~[catalina.jar:8.0.21]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) ~[catalina.jar:8.0.21]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) ~[catalina.jar:8.0.21]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) ~[catalina.jar:8.0.21]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) ~[catalina.jar:8.0.21]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) ~[catalina.jar:8.0.21]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) ~[catalina.jar:8.0.21]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) ~[catalina.jar:8.0.21]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518) ~[catalina.jar:8.0.21]
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091) ~[tomcat-coyote.jar:8.0.21]
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668) ~[tomcat-coyote.jar:8.0.21]
at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223) ~[tomcat-coyote.jar:8.0.21]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517) ~[tomcat-coyote.jar:8.0.21]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474) ~[tomcat-coyote.jar:8.0.21]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_25]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:8.0.21]
at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
I fixed it by injecting datasource to DAOImpl using #Autowired
#Autowired
public ContactDAOImpl(DataSource dataSource) {
jdbcTemplate = new JdbcTemplate(dataSource);
}
i'm facing an issue when try to develop a fragemnt and fragment activity simple example.
this is my project code
Mainactivity.java
package com.example.fragment_test;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import com.example.fragment_test.MainFragment.UiListener;
public class MainActivity extends FragmentActivity implements UiListener{
private MainFragment fragment;
#Override
protected void onCreate(Bundle arg0) {
super.onCreate(arg0);
setContentView(R.layout.activity_main);
fragment = (MainFragment) getSupportFragmentManager().findFragmentById(R.id.main_fragment);
}
public void onButtonClicked(){
// handle button clicked
}
}
mainfragment.java
package com.example.fragment_test;
import android.app.Activity;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
public class MainFragment extends Fragment {
public interface UiListener{
public void onButtonClicked();
}
private UiListener uiCallback;
#Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try{
uiCallback = (UiListener) activity; // check if the interface is implemented
}catch(ClassCastException e){
e.printStackTrace();
}
}
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_main, container, false);
}
#Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
view.findViewById(R.id.button).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
uiCallback.onButtonClicked();
}
});
}
}
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment android:name="MainFragment"
android:id="#+id/main_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
fragment_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/linProgress"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="5dp" >
<Button
android:id="#+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
</RelativeLayout>
Logcat
06-14 05:06:49.771: I/Process(1563): Sending signal. PID: 1563 SIG: 9
06-14 05:06:50.761: D/AndroidRuntime(1617): Shutting down VM
06-14 05:06:50.761: W/dalvikvm(1617): threadid=1: thread exiting with uncaught exception (group=0xb4b02ba8)
06-14 05:06:50.791: E/AndroidRuntime(1617): FATAL EXCEPTION: main
06-14 05:06:50.791: E/AndroidRuntime(1617): Process: com.example.fragment_test, PID: 1617
06-14 05:06:50.791: E/AndroidRuntime(1617): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.fragment_test/com.example.fragment_test.MainActivity}: android.view.InflateException: Binary XML file line #5: Error inflating class fragment
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.ActivityThread.access$800(ActivityThread.java:135)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.os.Handler.dispatchMessage(Handler.java:102)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.os.Looper.loop(Looper.java:136)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.ActivityThread.main(ActivityThread.java:5017)
06-14 05:06:50.791: E/AndroidRuntime(1617): at java.lang.reflect.Method.invokeNative(Native Method)
06-14 05:06:50.791: E/AndroidRuntime(1617): at java.lang.reflect.Method.invoke(Method.java:515)
06-14 05:06:50.791: E/AndroidRuntime(1617): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
06-14 05:06:50.791: E/AndroidRuntime(1617): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
06-14 05:06:50.791: E/AndroidRuntime(1617): at dalvik.system.NativeStart.main(Native Method)
06-14 05:06:50.791: E/AndroidRuntime(1617): Caused by: android.view.InflateException: Binary XML file line #5: Error inflating class fragment
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:713)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
06-14 05:06:50.791: E/AndroidRuntime(1617): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:290)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.Activity.setContentView(Activity.java:1929)
06-14 05:06:50.791: E/AndroidRuntime(1617): at com.example.fragment_test.MainActivity.onCreate(MainActivity.java:13)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.Activity.performCreate(Activity.java:5231)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
06-14 05:06:50.791: E/AndroidRuntime(1617): ... 11 more
06-14 05:06:50.791: E/AndroidRuntime(1617): Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment MainFragment: make sure class name exists, is public, and has an empty constructor that is public
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.Fragment.instantiate(Fragment.java:597)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.Fragment.instantiate(Fragment.java:561)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.Activity.onCreateView(Activity.java:4778)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:689)
06-14 05:06:50.791: E/AndroidRuntime(1617): ... 21 more
06-14 05:06:50.791: E/AndroidRuntime(1617): Caused by: java.lang.ClassNotFoundException: Didn't find class "MainFragment" on path: DexPathList[[zip file "/data/app/com.example.fragment_test-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.fragment_test-1, /system/lib]]
06-14 05:06:50.791: E/AndroidRuntime(1617): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
06-14 05:06:50.791: E/AndroidRuntime(1617): at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
06-14 05:06:50.791: E/AndroidRuntime(1617): at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
06-14 05:06:50.791: E/AndroidRuntime(1617): at android.app.Fragment.instantiate(Fragment.java:583)
06-14 05:06:50.791: E/AndroidRuntime(1617): ... 24 more
06-14 05:06:53.331: I/Process(1617): Sending signal. PID: 1617 SIG: 9
I tried several proposed solution without any success. Would you please help me to run this exmaple
Please give fully qualified name of class in xml file
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<fragment
android:id="#+id/main_fragment"
android:name="com.example.fragment_test.MainFragment" // UPDATE HERE
android:layout_width="match_parent"
android:layout_height="match_parent" />
</RelativeLayout>
I am getting this error and i don't know how to fix:
java.io.NotSerializableException:
com.procc.dao.EJB31_Generated_AlertFacade_Intf_Bean_ at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1180)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at java.util.HashMap.writeObject(HashMap.java:1100) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601) at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at
java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1528)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1493)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at
java.io.ObjectOutputStream.writeArray(ObjectOutputStream.java:1362)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1170)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at java.util.HashMap.writeObject(HashMap.java:1100) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601) at
java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:975)
at
java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1480)
at
java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1416)
at
java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1174)
at
java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:346)
at
com.sun.faces.renderkit.ClientSideStateHelper.doWriteState(ClientSideStateHelper.java:325)
at
com.sun.faces.renderkit.ClientSideStateHelper.writeState(ClientSideStateHelper.java:173)
at
com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:122)
at
com.sun.faces.application.StateManagerImpl.writeState(StateManagerImpl.java:166)
at
com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225)
at
com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:419)
at
com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:131)
at
com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) at
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) at
org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at
org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at
com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at
com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at
com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at
com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at
com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at
com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at
com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at
com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at
com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at
com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at
com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71) at
com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at
com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)
this is AlertFacade:
#Stateless public class AlertFacade extends AbstractFacade {
#PersistenceContext(unitName = "flams_pu")
private EntityManager em;
#Override
protected EntityManager getEntityManager() {
return em;
}
public AlertFacade() {
super(Alert.class);
} }
which i use in a JSF Managed bean.
is the EJB supposed to be Serializable ? I don't get it.
Please help
I would try and add to the class signature implements Serializable. Since it's a marker interface, you don't have to implement any method.