GetWindowRect() fails, but IsWindow() is not
I am trying to get the size of an external window:
POINT point;
point.x = 100;
point.y = 100;
HWND hwnd = WindowFromPoint(point);
LPRECT pRect = {0};
bool ret1 = IsWindow(hwnd);
bool ret = GetWindowRect(hwnd, pRect);
The return value of IsWindow is true, but GetWindowRect fails with the
following error:
1400: Invalid window handle
What can be wrong?
Buttimer
Sunday, 1 September 2013
How to generate filename appropiate to the list assigned "years"
How to generate filename appropiate to the list assigned "years"
How to generate filename appropiate to the list assigned "years". I need
to know how to generate the "calendar" name appropiate to the year_list. I
want to add 2000 to 2013 year_list at once, because right now I have to
edit and change every year number once I run the script to output
different year.
year_list = [2000]
FILENAME = "calendar_2000.txt"
What I need is year_list to be 2000, 2001, 2002.. up to 2013 and the
output file to be generated accordingly to the year_list numbers.
How to generate filename appropiate to the list assigned "years". I need
to know how to generate the "calendar" name appropiate to the year_list. I
want to add 2000 to 2013 year_list at once, because right now I have to
edit and change every year number once I run the script to output
different year.
year_list = [2000]
FILENAME = "calendar_2000.txt"
What I need is year_list to be 2000, 2001, 2002.. up to 2013 and the
output file to be generated accordingly to the year_list numbers.
Prepared PDO query returns 0 affected rows
Prepared PDO query returns 0 affected rows
I've literally spent hours Googling and searching and I have no idea what
I'm doing wrong. I'm using POST, and I tried the query myself in
phpMyAdmin, and it worked, but it's not working in PDO, and I don't know
why. It worked when I used mysql_query and what not, but I want to protect
myself from SQL injection.
Here's the code I'm using.
http://i.imgur.com/6U7A1tI.png
http://pastebin.com/raw.php?i=yfxL9FTR
Sorry for not posting the actual code on this site, but the formatting
here is terrible when I copy the code in.
I've literally spent hours Googling and searching and I have no idea what
I'm doing wrong. I'm using POST, and I tried the query myself in
phpMyAdmin, and it worked, but it's not working in PDO, and I don't know
why. It worked when I used mysql_query and what not, but I want to protect
myself from SQL injection.
Here's the code I'm using.
http://i.imgur.com/6U7A1tI.png
http://pastebin.com/raw.php?i=yfxL9FTR
Sorry for not posting the actual code on this site, but the formatting
here is terrible when I copy the code in.
Saturday, 31 August 2013
Using ConcurrentHashMap efficiently?
Using ConcurrentHashMap efficiently?
I have a Android Application whose core component is a
HashMap<String,float[]>. The System is having high concurrency. e.g here
are the following three situations I have which occur frequently and they
are highly overlapping in nature
Iterate through all the keys in the hashmap and do some operation on its
value(read only operations).
Add new key,value pairs in the Hashmap.
Remove Certain keys from the Hashmap.
I do all these operations in different threads and thus am using a
ConcurrentHashMap since some inconsistency in retrievals doesnt matter.
e.g While iterating the map,if new entries are added then it doesnt matter
to not read in those new values immediately as I ensure that next time
they are read .
Also while removing the entries I am recreating the iterator everytime to
avoid "ConcurrentModificationException"
Suppose , there is a following hashmap(i.e ConcurrentHashmap)
ConcurrentHashMap<String,float[]> test=new ConcurrentHashMap<String,
float[]>(200);
Now for Retrieval I do the following
Iterator<String> reader=test.keySet().iterator();
while(reader.hasNext())
{
String s=reader.next();
float[] temp=test.get(s);
//do some operation with float[] temp here(read only
operation)
}
and for removal I do the following
boolean temp = true;
while (temp) {
for (String key : test.keySet()) {
temp = false;
if (key.equals("abc")) {
test.remove(key);
temp = true;
break;
}
}
}
and when inserting in new values I simply do
test.put("temp value", new float[10]);
I am not sure if its a very efficient utilisation. Also it does matter not
to read in removed values(however I need efficiency ,and since the
iterator is again created during the function call,its guaranteed that in
the next time I don't get the removed values)so that much inconsistency
can be tolerated?
Could someone please tell me an efficient way to do it?
I have a Android Application whose core component is a
HashMap<String,float[]>. The System is having high concurrency. e.g here
are the following three situations I have which occur frequently and they
are highly overlapping in nature
Iterate through all the keys in the hashmap and do some operation on its
value(read only operations).
Add new key,value pairs in the Hashmap.
Remove Certain keys from the Hashmap.
I do all these operations in different threads and thus am using a
ConcurrentHashMap since some inconsistency in retrievals doesnt matter.
e.g While iterating the map,if new entries are added then it doesnt matter
to not read in those new values immediately as I ensure that next time
they are read .
Also while removing the entries I am recreating the iterator everytime to
avoid "ConcurrentModificationException"
Suppose , there is a following hashmap(i.e ConcurrentHashmap)
ConcurrentHashMap<String,float[]> test=new ConcurrentHashMap<String,
float[]>(200);
Now for Retrieval I do the following
Iterator<String> reader=test.keySet().iterator();
while(reader.hasNext())
{
String s=reader.next();
float[] temp=test.get(s);
//do some operation with float[] temp here(read only
operation)
}
and for removal I do the following
boolean temp = true;
while (temp) {
for (String key : test.keySet()) {
temp = false;
if (key.equals("abc")) {
test.remove(key);
temp = true;
break;
}
}
}
and when inserting in new values I simply do
test.put("temp value", new float[10]);
I am not sure if its a very efficient utilisation. Also it does matter not
to read in removed values(however I need efficiency ,and since the
iterator is again created during the function call,its guaranteed that in
the next time I don't get the removed values)so that much inconsistency
can be tolerated?
Could someone please tell me an efficient way to do it?
MetaController should Observe three objects
MetaController should Observe three objects
I'm caught in a mental loop, or at least a lack of understanding of how to
implement the observer pattern. My intended Controller implements Observer
because it's meant to, literally, observe the instances it, literally,
controls.
The observed objects extend Observable because they are meant to be
observed, literally, by the Controller. What do I invoke
.addObserver(responseHandler); on? Another class adds an observer to the
instance which, literally, implements the `Observer' interface? That can't
be right.
As an aside, is there a naming problem in this pattern as implemented in
Java, or just a lack of understanding on my part?
Here's the Controller, which has now morphed into a Controller of a
Controller:
public class MetaController implements Observer {
private final static Logger LOG =
Logger.getLogger(MetaController.class.getName());
private Printer telnetPrinter = new Printer();
private telnetDataProcessor telnetDataProcessor = new
telnetDataProcessor();
private StringReader stringReader = new StringReader();
private final ConcurrentLinkedQueue<Character> telnetData = new
ConcurrentLinkedQueue();
public MetaController() {
}
//the printer and processor each spawn their own thread so that they
don't
//block each other waiting for each other
public void readPrintParse(final InputStream inputStream) throws
SocketException, IOException {
telnetPrinter.print(inputStream, telnetData); //populate
telnetData in its own thread
telnetDataProcessor.read(telnetData); //process telnetData in its
own thread
}
//the StringReader just looks for particular keywords like "press
enter to continue"
//so that some phrases will trigger a response
//commands may also be typed manually by the user (not implemented yet)
@Override
public void update(Observable o, Object arg) {
//when telnetDataProcessor sends a String, send that String on to
stringReader
String cmd = stringReader.parse(null); //parse what and how?
//send the command string back to the telnetClient
}
}
Reading the API directly, unfortunately, is not illuminating for me.
This is an extension of an Apache WeatherTelnet example, a sort of
poor-mans Netty to allow concurrent scripted telnet and live telnet
responses for a simple MUD client, which requires live processing of a
non-terminated telnet data stream, as well as live output and user input.
I'm caught in a mental loop, or at least a lack of understanding of how to
implement the observer pattern. My intended Controller implements Observer
because it's meant to, literally, observe the instances it, literally,
controls.
The observed objects extend Observable because they are meant to be
observed, literally, by the Controller. What do I invoke
.addObserver(responseHandler); on? Another class adds an observer to the
instance which, literally, implements the `Observer' interface? That can't
be right.
As an aside, is there a naming problem in this pattern as implemented in
Java, or just a lack of understanding on my part?
Here's the Controller, which has now morphed into a Controller of a
Controller:
public class MetaController implements Observer {
private final static Logger LOG =
Logger.getLogger(MetaController.class.getName());
private Printer telnetPrinter = new Printer();
private telnetDataProcessor telnetDataProcessor = new
telnetDataProcessor();
private StringReader stringReader = new StringReader();
private final ConcurrentLinkedQueue<Character> telnetData = new
ConcurrentLinkedQueue();
public MetaController() {
}
//the printer and processor each spawn their own thread so that they
don't
//block each other waiting for each other
public void readPrintParse(final InputStream inputStream) throws
SocketException, IOException {
telnetPrinter.print(inputStream, telnetData); //populate
telnetData in its own thread
telnetDataProcessor.read(telnetData); //process telnetData in its
own thread
}
//the StringReader just looks for particular keywords like "press
enter to continue"
//so that some phrases will trigger a response
//commands may also be typed manually by the user (not implemented yet)
@Override
public void update(Observable o, Object arg) {
//when telnetDataProcessor sends a String, send that String on to
stringReader
String cmd = stringReader.parse(null); //parse what and how?
//send the command string back to the telnetClient
}
}
Reading the API directly, unfortunately, is not illuminating for me.
This is an extension of an Apache WeatherTelnet example, a sort of
poor-mans Netty to allow concurrent scripted telnet and live telnet
responses for a simple MUD client, which requires live processing of a
non-terminated telnet data stream, as well as live output and user input.
Android taking pictures asynchronously inside a broadcast receiver
Android taking pictures asynchronously inside a broadcast receiver
I have been struggling with the above for a while now, so would really
appreciate any answers.
Firstly, my main aim is to take a picture when I receive an intent (
inside a broadcast receiver). I have tried quite a few approaches to the
above but to no avail. The following (showing relevant code snippets for
visual clarity) code illustrates one approach:
public class ArduinoReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
takePictureUsingCamera();
} }
The function takePictureUsingCamera() calls a function in a class that
deals with the camera ( e.g displaying a camera preview in a FrameLayout).
The particular function calls the android takePicture function in android:
this.mPreview.mCamera.takePicture(null, null, this.mPicture);
However when I receive the intent, the app crashes. I felt that the reason
behind this was that taking a picture was perhaps asking for too much work
to be done inside the broadcast receiver. (I tested this functionality
using a simply picture capture using a button and it worked perfectly. )
So, the second approach that I tried was to create a Intentservice which
will deal with the taking of pictures ( and other relevant tasks like
storing pictures), when an intent is received.
The Service's onHandleIntent(Intent intent) method will now have the
this.mCameraView.takePicture(filename) function. However, I need to pass
my CameraView class as an object to this service using the intent for
which I created a Serializable class and tried passing this using the
intent's putExtra method. After a few crashes, I realized that the
CameraView Class was not serializable (it is displaying the camera preview
in a FrameLayout).
Another alternative way I thought of doing the above was to create the
cameraView object itself inside the new service but for this I need the
context and the reference to the main activity - which I don't think can
be passed using intents. This leaves the option of starting a new activity
to take the picture inside the broadcast receiver - again looks like doing
too much work. As I said before, I've tried a few approaches but haven't
achieved success in any of them. I personally didn't think its going to be
such a problem. I would really appreciate and be quite thankful to any
answerers.
I have been struggling with the above for a while now, so would really
appreciate any answers.
Firstly, my main aim is to take a picture when I receive an intent (
inside a broadcast receiver). I have tried quite a few approaches to the
above but to no avail. The following (showing relevant code snippets for
visual clarity) code illustrates one approach:
public class ArduinoReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
takePictureUsingCamera();
} }
The function takePictureUsingCamera() calls a function in a class that
deals with the camera ( e.g displaying a camera preview in a FrameLayout).
The particular function calls the android takePicture function in android:
this.mPreview.mCamera.takePicture(null, null, this.mPicture);
However when I receive the intent, the app crashes. I felt that the reason
behind this was that taking a picture was perhaps asking for too much work
to be done inside the broadcast receiver. (I tested this functionality
using a simply picture capture using a button and it worked perfectly. )
So, the second approach that I tried was to create a Intentservice which
will deal with the taking of pictures ( and other relevant tasks like
storing pictures), when an intent is received.
The Service's onHandleIntent(Intent intent) method will now have the
this.mCameraView.takePicture(filename) function. However, I need to pass
my CameraView class as an object to this service using the intent for
which I created a Serializable class and tried passing this using the
intent's putExtra method. After a few crashes, I realized that the
CameraView Class was not serializable (it is displaying the camera preview
in a FrameLayout).
Another alternative way I thought of doing the above was to create the
cameraView object itself inside the new service but for this I need the
context and the reference to the main activity - which I don't think can
be passed using intents. This leaves the option of starting a new activity
to take the picture inside the broadcast receiver - again looks like doing
too much work. As I said before, I've tried a few approaches but haven't
achieved success in any of them. I personally didn't think its going to be
such a problem. I would really appreciate and be quite thankful to any
answerers.
Bean Creation Exception with JBoss 5.1.2
Bean Creation Exception with JBoss 5.1.2
I am facing problem while Deploying my app in JBoss 5.1.2 . I am getting
the below exception.
2013-08-31 22:16:07,968 ERROR
[org.springframework.web.context.ContextLoader] (HDScanner) Context
initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class
[com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer]
for bean with name 'applicationPropertyConfigurer' defined in
ServletContext resource [/WEB-INF/spring-config/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1250)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1319)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:885)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389)
at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:313)
at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145)
at
org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:122)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
at
org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at
org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at
org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
at org.jboss.system.ServiceController.start(ServiceController.java:460)
at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
at
org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at
org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
at
org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789)
at
org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)
at
org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:409)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:294)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1271)
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1242)
... 73 more
Here is my bean creation code in applicationContext.xml file. Even if
create any bean apart from this i am getting the same Exception mention
above.
<bean id="applicationPropertyConfigurer"
class="com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
and web.xml contains below details.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-config/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
The Class for which i am getting exception is available in src folder and
it is in classpath of my application. Not sure what i am missing. here are
the jar file which i included for building the application in WEB-INF/lib.
spring-core, spring-beans, spring-context, spring-context.support,
spring-asm, spring-expression and i assume logging related jar not
required for the spring because in JBoss Server it will available.
But When i comment out the bean code creation in applicationContext.xml
application deployed successfully On the server. Please let me know what
exactly i am missing.
I am facing problem while Deploying my app in JBoss 5.1.2 . I am getting
the below exception.
2013-08-31 22:16:07,968 ERROR
[org.springframework.web.context.ContextLoader] (HDScanner) Context
initialization failed
org.springframework.beans.factory.CannotLoadBeanClassException: Cannot
find class
[com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer]
for bean with name 'applicationPropertyConfigurer' defined in
ServletContext resource [/WEB-INF/spring-config/applicationContext.xml];
nested exception is java.lang.ClassNotFoundException:
com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1250)
at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1319)
at
org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:885)
at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4389)
at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:313)
at
org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:145)
at
org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:122)
at org.jboss.web.deployers.WebModule.start(WebModule.java:97)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy38.start(Unknown Source)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:42)
at
org.jboss.system.microcontainer.StartStopLifecycleAction.installAction(StartStopLifecycleAction.java:37)
at
org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
at
org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
at
org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.system.microcontainer.ServiceControllerContext.install(ServiceControllerContext.java:297)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
at org.jboss.system.ServiceController.doChange(ServiceController.java:688)
at org.jboss.system.ServiceController.start(ServiceController.java:460)
at org.jboss.system.deployers.ServiceDeployer.start(ServiceDeployer.java:163)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:99)
at org.jboss.system.deployers.ServiceDeployer.deploy(ServiceDeployer.java:46)
at
org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:62)
at
org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:55)
at
org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:179)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1454)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1172)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1193)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1113)
at
org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at
org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1652)
at
org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:938)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at
org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:988)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:826)
at
org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:556)
at
org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:789)
at
org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:699)
at
org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:409)
at
org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:294)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(Unknown Source)
at java.util.concurrent.FutureTask.runAndReset(Unknown Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(Unknown
Source)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown
Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
at
org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
at
org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1271)
at
org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1242)
... 73 more
Here is my bean creation code in applicationContext.xml file. Even if
create any bean apart from this i am getting the same Exception mention
above.
<bean id="applicationPropertyConfigurer"
class="com.abc.myapp.cmc.infrastructure.util.CustomPropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:jdbc.properties</value>
</list>
</property>
<property name="ignoreUnresolvablePlaceholders" value="true" />
</bean>
and web.xml contains below details.
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-config/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
The Class for which i am getting exception is available in src folder and
it is in classpath of my application. Not sure what i am missing. here are
the jar file which i included for building the application in WEB-INF/lib.
spring-core, spring-beans, spring-context, spring-context.support,
spring-asm, spring-expression and i assume logging related jar not
required for the spring because in JBoss Server it will available.
But When i comment out the bean code creation in applicationContext.xml
application deployed successfully On the server. Please let me know what
exactly i am missing.
Subscribe to:
Comments (Atom)