Too many beans

Situation: I have a Weblogic container, an application, which I would like to deploy with an ant script and an error message saying:

[wlst] Exception in thread "main" java.lang.IllegalStateException: Traceback (innermost last):
[wlst]   File "/local/bmiklos/projects/.../build/container/weblogic12/weblogic_setup_server.py", line 28, in ?
[wlst]   File "/local/bmiklos/container/weblogic/12.1.1.0.4/server/wlserver/common/wlst/weblogic_base.py", line 328, in createDataSource
[wlst] weblogic.descriptor.BeanAlreadyExistsException: Bean already exists: "weblogic.j2ee.descriptor.wl.JDBCPropertyBeanImpl@8218c7([...]/JDBCDriverParams/Properties/Properties[user])"
[wlst]     at weblogic.descriptor.internal.ReferenceManager.registerBean(ReferenceManager.java:232)
[wlst]     at weblogic.j2ee.descriptor.wl.JDBCPropertiesBeanImpl.setProperties(JDBCPropertiesBeanImpl.java:133)
[wlst]     at weblogic.j2ee.descriptor.wl.JDBCPropertiesBeanImpl.addProperty(JDBCPropertiesBeanImpl.java:79)
[wlst]     at weblogic.j2ee.descriptor.wl.JDBCPropertiesBeanImpl.createProperty(JDBCPropertiesBeanImpl.java:152)
[wlst]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[wlst]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[wlst]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[wlst]     at java.lang.reflect.Method.invoke(Method.java:601)
[wlst]     at weblogic.management.jmx.modelmbean.WLSModelMBean.invoke(WLSModelMBean.java:437)
[wlst]     at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
[wlst]     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:792)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.management.mbeanservers.internal.JMXContextInterceptor.invoke(JMXContextInterceptor.java:263)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.management.mbeanservers.edit.internal.RecordingInterceptor.invoke(RecordingInterceptor.java:199)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.management.mbeanservers.internal.SecurityMBeanMgmtOpsInterceptor.invoke(SecurityMBeanMgmtOpsInterceptor.java:65)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogic.management.jmx.mbeanserverTraceback (innermost last):
[wlst]   File "/local/bmiklos/projects/.../build/container/weblogic12/we.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.management.mbeanservers.edit.internal.EditLockInterceptor.invoke(EditLockInterceptor.java:112)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$blogic_setup_server.py", line 28, in ?
[wlst]   File "/local/bmiklos/container/weblogic/12.1.1.0.4/server/wlserver/common/wlst/weblogic16.run(WLSMBeanServerInterceptorBase.java:449)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogic.manag_base.py", line 328, in createDataSource
[wlst] weblogic.descriptor.BeanAlreadyExistsException: Bean already exists: "weblogic.j2ee.desement.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.management.mbeancriptor.wl.JDBCPropertyBeanImpl@8218c7([MB-DS]/JDBCDriverParams/Properties/Properties[user])"
[wlst]     at weblogic.descriptor.inteservers.internal.SecurityInterceptor.invoke(SecurityInterceptor.java:444)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerrnal.ReferenceManager.registerBean(ReferenceManager.java:232)
[wlst]     at weblogic.j2ee.descriptor.wl.JDBCPropertiesBeanImpl.setProperti.invoke(WLSMBeanServer.java:323)
[wlst]     at weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder$11$1.run(JMXConnectoes(JDBCPropertiesBeanImpl.java:133)
[wlst]     at weblogic.j2ee.descriptor.wl.JDBCPropertiesBeanImpl.addProperty(JDBCPropertiesBeanImpl.jarSubjectForwarder.java:663)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogic.management.mbeanservers.va:79)
[wlst]     at weblogic.j2ee.descriptor.wl.JDBCPropertiesBeanImpl.createProperty(JDBCPropertiesBeanImpl.java:152)
[wlst]     at sun.reflect.Nainternal.JMXConnectorSubjectForwarder$11.run(JMXConnectorSubjectForwarder.java:661)
[wlst]     at weblogic.security.acl.internal.AuthentictiveMethodAccessorImpl.invoke0(Native Method)
[wlst]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[wlst] atedSubject.doAs(AuthenticatedSubject.java:363)
[wlst]     at weblogic.management.mbeanservers.internal.JMXConnectorSubjectForwarder.invok    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[wlst]     at java.lang.reflect.Method.invoke(Mee(JMXConnectorSubjectForwarder.java:654)
[wlst]     at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:14thod.java:601)
[wlst]     at weblogic.management.jmx.modelmbean.WLSModelMBean.invoke(WLSModelMBean.java:437)
[wlst]     at com.sun.jmx.interceptor.D86)
[wlst]     at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:96)
[wlst]     at javax.management.remote.rmi.RMICefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
[wlst]     at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmonnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1327)
[wlst]     at java.security.AccessController.doPrivileged(Native MethodxMBeanServer.java:792)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBas)
[wlst]     at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1426)
[wlst]     at javax.management.remoe.java:449)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServete.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:847)
[wlst]     at javax.management.remote.rmi.RMIConnectionImpl_WLSkel.invoke(UnknrInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.management.mbeanservers.internal.JMXContextIntercepown Source)
[wlst]     at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:693)
[wlst]     at weblogic.rmi.internal.BasicServerRef$1.tor.invoke(JMXContextInterceptor.java:263)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanrun(BasicServerRef.java:518)
[wlst]     at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
[wlst]     at webServerInterceptorBase.java:449)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogic.management.jmx.mbeanlogic.security.service.SecurityManager.runAs(SecurityManager.java:146)
[wlst]     at weblogic.rmi.internal.BasicServerRef.handleRequest(Baserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.management.mbeanservers.edit.insicServerRef.java:514)
[wlst]     at weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:118)
[wlst]     at weblogic.work.Executeternal.RecordingInterceptor.invoke(RecordingInterceptor.java:199)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerIntercepThread.execute(ExecuteThread.java:256)
[wlst]     at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)
[wlst]
[wlst] weblogic.descriptor.BeanAlretorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
[wlst]     at java.security.AccessController.doPrivileged(Native Method)
[wlst]     at weblogadyExistsException: weblogic.descriptor.BeanAlreadyExistsException: Bean already exists: "weblogic.j2ee.descriptor.wl.JDBCProperic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.managemetyBeanImpl@8218c7([MB-DS]/JDBCDriverParams/Properties/Properties[user])"
[wlst]
[wlst]     at weblogic.management.scripting.WLSTInterpretent.mbeanservers.internal.SecurityMBeanMgmtOpsInterceptor.invoke(SecurityMBeanMgmtOpsInterceptor.java:65)
[wlst]     at weblogic.managementrInvoker.printError(WLSTInterpreterInvoker.java:146)
[wlst]     at weblogic.management.scripting.WLSTInterpreterInvoker.executePyScript(WL.jmx.mbeanserver.WLSMBeanServerInterceptorBase$16.run(WLSMBeanServerInterceptorBase.java:449)
[wlst]     at java.security.AccessControllerSTInterpreterInvoker.java:111)
[wlst]     at weblogic.management.scripting.WLSTInterpreterInvoker.main(WLSTInterpreterInvoker.java:30)
[wlst] .doPrivileged(Native Method)
[wlst]     at weblogic.management.jmx.mbeanserver.WLSMBeanServerInterceptorBase.invoke(WLSMBeanServerInterceptorBase.java:447)
[wlst]     at weblogic.management.mbeanservers.edit

The problem in my case is that the container gets corrupt somehow, so I need to delete the directory containing it and re-create the whole thing. After that deploying my application works again.

Velocity template not showing results from Java method call

We can call methods of any Java class from Apache Velocity. Now if that method happens to return a List<String>, and then process that list with #foreach, then we should be aware that in Velocity the result will be something like [foo, bar] instead of ["foo", "bar"]. We will get an array of texts and not an array of strings. If we assume that we get strings and try to manipulate them that way, let’s say by calling toUpperCase() on them Velocity may just decide to ignore that method call on a thing that doesn’t have that method and show nothing as a result. No error messages either. Making it quite hard to figure out what went wrong. At least this happened in my case.