Please let me understand what do we mean by optional methods in Collection interface.(e.g add, addAll etc)
If we write a class that implements the Collection interface are we required to provide implementations
for the optional methods?
When I try to execute the above spring example, it gives the following error
log4j:WARN No appenders could be found for logger (org.springframework.context.support.ClassPathXmlApplicationContext).
log4j:WARN Please initialize the log4j system properly.
Exception in thread "Main Thread" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employee' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.rajiv.Employee]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.rajiv.Employee.<init>()
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:946)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:892)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:479)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:562)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:84)
at com.rajiv.Test.main(Test.java:10)
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.rajiv.Employee]: No default constructor found; nested exception is java.lang.NoSuchMethodException: com.rajiv.Employee.<init>()
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:69)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:939)
... 13 more
Caused by: java.lang.NoSuchMethodException: com.rajiv.Employee.<init>()
at java.lang.Class.getConstructor0(Class.java:2706)
at java.lang.Class.getDeclaredConstructor(Class.java:1985)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:64)
... 14 more
Please help me understand why default constructor is needed when we are using the setter injection
Hi,
Can someone please tell me about some basic level good resources to learn "Annotations"
Also can I know why were annotations introduced in Java. What was the need for
them?
The above code shows error in subclass constructor with the following error message
"Implicit super constructor Test1() is undefined. Must implicitly invoke another constructor."
Please help me understand the cause of the error.
Thanks
Please help me understand what is happening in the above code and how is it happening.
Regarding the join() method, what is joined by what. I am confused by the name of the
method. What makes main thread wait for the child threads. Is it because the the 3 child
threads call join methods inside the main thread. And what changes would be required
if we want to ensure that threads finish in order
I mean like
Child thread One
Child thread Two
Child thread Three
Main thread
I have configured the datasource on Weblogic server 11g.
When I execute this code I get the following error
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.lookup(Unknown Source)
at Test4.main(Test4.java:33)