[JBoss JIRA] Created: (JBPM-696) Field Instanciator problems
by Shai Bentin (JIRA)
Field Instanciator problems
---------------------------
Key: JBPM-696
URL: http://jira.jboss.com/jira/browse/JBPM-696
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM 3.1.1
Environment: WinXP, Linux running on JBoss Application Server 4.0.3SP1, JDK1.5.0_06
Reporter: Shai Bentin
Assigned To: Tom Baeyens
Priority: Minor
Fix For: jBPM 3.1.2
The method getValue() is see two problems, one is jdk5 related the other is just an idea.
In jdk5 doing if (type.isAssignableFrom(Set.class)) and such yields a 'false' even when it is supposed to be true...
if we would write the same if in reverse:
Set.class.isAssignableFrom(type) we will ge the desired reuslt.
The other issue is, if we know the super type why do we impose a specific implementation, i.e. if we have a Collection, why do we impose an ArrayList. We have the user's type and we know it is of type collection so why don't we instanciate the requested type....
Here is how I propose to write this method:
public static Object getValue(Class type, Element propertyElement) {
// parse the value
Object value = null;
try {
if ( type == String.class ) {
value = propertyElement.getText();
} else if ( (type==Integer.class) || (type==int.class) ) {
value = new Integer( propertyElement.getTextTrim() );
} else if ( (type==Long.class) || (type==long.class) ) {
value = new Long( propertyElement.getTextTrim() );
} else if ( (type==Float.class ) || (type==float.class) ) {
value = new Float( propertyElement.getTextTrim() );
} else if ( (type==Double.class ) || (type==double.class) ) {
value = new Double( propertyElement.getTextTrim() );
} else if ( (type==Boolean.class ) || (type==boolean.class) ) {
value = Boolean.valueOf( propertyElement.getTextTrim() );
} else if ( (type==Character.class ) || (type==char.class) ) {
value = new Character( propertyElement.getTextTrim().charAt(0) );
} else if ( (type==Short.class ) || (type==short.class) ) {
value = new Short( propertyElement.getTextTrim() );
} else if ( (type==Byte.class ) || (type==byte.class) ) {
value = new Byte( propertyElement.getTextTrim() );
} else if (List.class.isAssignableFrom(type)) {
value = getCollection(propertyElement, (List)type.newInstance());
} else if (Set.class.isAssignableFrom(type)) {
value = getCollection(propertyElement, (Set)type.newInstance());
} else if (Collection.class.isAssignableFrom(type)) {
value = getCollection(propertyElement, (Collection)type.newInstance());
} else if (Map.class.isAssignableFrom(type)) {
value = getMap(propertyElement, (Map)type.newInstance());
} else if ( type==Element.class ) {
value = propertyElement;
} else {
Constructor constructor = type.getConstructor(new Class[]{String.class});
if ( (propertyElement.isTextOnly())
&& (constructor!=null) ) {
value = constructor.newInstance(new Object[]{propertyElement.getTextTrim()});
}
}
} catch (Exception e) {
log.error("couldn't parse the bean property value '" + propertyElement.asXML() + "' to a '" + type.getName() + "'" );
throw new JbpmException( e );
}
return value;
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 8 months
[JBoss JIRA] Created: (JBSEAM-305) More sophisticated handling of request parameters
by Gavin King (JIRA)
More sophisticated handling of request parameters
-------------------------------------------------
Key: JBSEAM-305
URL: http://jira.jboss.com/jira/browse/JBSEAM-305
Project: JBoss Seam
Issue Type: Feature Request
Components: JSF
Reporter: Gavin King
Assigned To: Gavin King
Fix For: 1.1
Currently @RequestParameter does basic type conversion, but it would also be nice to support
(1) custom converters
(2) validation via Hibernate Validator
(3) validation via custom validators
eg.
@RequestParameter(required=true, converter="myConverterId", validator="myValidatorId")
@RequestParameter(converter="#{myComponent.myConverter}", validator="#{myComponent.myValidator}")
@RequestParameter @NotNull
<page view-id="/item.xhtml">
<parameter name="id" required="true">
<converter converterId="myConverterId"/>
<validator binding="#{myComponent.myValidator}"/>
</parameter>
</page>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 8 months
[JBoss JIRA] Created: (EJBTHREE-664) Injection using @Resource of SessionContext fails with NullPointerException while deploying the application
by jaikiran pai (JIRA)
Injection using @Resource of SessionContext fails with NullPointerException while deploying the application
-----------------------------------------------------------------------------------------------------------
Key: EJBTHREE-664
URL: http://jira.jboss.com/jira/browse/EJBTHREE-664
Project: EJB 3.0
Issue Type: Bug
Affects Versions: EJB 3.0 RC8 - FD
Environment: JBoss-4.0.4GCA, jboss-EJB-3.0_RC8-FD, Java: jdk1.5.0_07
Reporter: jaikiran pai
Attachments: Exception Stacktrace.txt, MyEJB3.ear, source.zip
I have StatelessSessionBean in which i am trying to inject the SessionContext. When i am trying to deploy the bean, server throws exceptions indicating a NullPointerException and subsequently the application is not deployed.
Here's a small extract from the exception stacktrace(The entire exception stacktrace is attached to this issue):
12:52:11,816 INFO [EARDeployer] Init J2EE application: file:/D:/JBoss4.0.4GCA/jboss-4.0.4.GA/server/default/deploy/MyEJB3.ear/
12:52:12,160 INFO [Ejb3Deployment] EJB3 deployment time took: 188
12:52:12,270 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3 with dependencies:
12:52:12,691 WARN [ServiceController] Problem starting service jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
java.lang.NullPointerException
at org.jboss.ejb3.injection.ResourceHandler.loadFieldInjectors(ResourceHandler.java:283) at org.jboss.ejb3.injection.ResourceHandler.loadInjectors(ResourceHandler.java:401)
at org.jboss.ejb3.injection.ResourceHandler.loadInjectors(ResourceHandler.java:381)
at org.jboss.ejb3.EJBContainer.resolveInjectors(EJBContainer.java:640)
at org.jboss.ejb3.EJBContainer.initializePool(EJBContainer.java:576)
at org.jboss.ejb3.EJBContainer.start(EJBContainer.java:507)
at org.jboss.ejb3.SessionContainer.start(SessionContainer.java:82)
at org.jboss.ejb3.stateless.StatelessContainer.start(StatelessContainer.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:99)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
12:52:13,785 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
State: FAILED
Reason: java.lang.NullPointerException
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:ear=MyEJB3.ear,jar=myapp_ejb.jar,name=TestEJB3,service=EJB3
State: FAILED
Reason: java.lang.NullPointerException
I am using JBoss - 4.0.4 GCA. I followed the following steps after installing the server:
1) I downloaded jboss-EJB-3.0_RC8-FD
2) Copied ejb3-persistence.jar in server/default/lib
3) Copied ejb3-interceptors-aop.xml in server/default/deploy
4) ejb3.deployer in server/default/deploy
Note that with the injection part commented out, everything works fine, the EJB gets deployed and i am able to invoke methods on the EJB.
I have attached the source code and the .ear file along with this issue for reference. Just place the MyEJB3.ear file in the %JBOSS_HOME%/server/default/deploy directory, after following the steps mentioned above, and start the server to reproduce the issue.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
17 years, 8 months