[Persistence, JBoss/CMP, Hibernate, Database] - JBoss 3.2.5/MySQL 4.0 ejbCreate throws NullPointer exception
by pintovc
I have created an EJB with CMP in JBoss 3.2.5. It deploys fine. When I try to create an EJB in the database table it gives me a NullPointerException error. Here is the trace
14:52:53,757 INFO [UserProfile] Table 'UserProfile' already exists
14:52:54,278 INFO [EJBDeployer] Deployed: file:/C:/devenv/jboss-3.2.5/server/default/tmp/deploy/tmp45702FiboApp.ear-contents/FiboEJB.jar
14:52:54,558 INFO [TomcatDeployer] deploy, ctxPath=/fibo, warUrl=file:/C:/devenv/jboss-3.2.5/server/default/tmp/deploy/tmp45702FiboApp.ear-contents/FiboWeb.war/
14:52:54,919 INFO [TomcatDeployer] ClusteredHTTPSessionService not found
14:52:54,919 ERROR [TomcatDeployer] Failed to setup clustering, clustering disabled
14:52:55,720 INFO [EARDeployer] Started J2EE application: file:/C:/devenv/jboss-3.2.5/server/default/deploy/FiboApp.ear
14:52:56,230 INFO [Server] JBoss (MX MicroKernel) [3.2.5 (build: CVSTag=JBoss_3_2_5 date=200406251954)] Started in 1m:15s:809ms
14:52:56,230 INFO [Tomcat5] Saw org.jboss.system.server.started notification, starting connectors
14:52:56,571 INFO [Http11Protocol] Starting Coyote HTTP/1.1 on http-0.0.0.0-8080
14:52:58,153 INFO [ChannelSocket] JK2: ajp13 listening on /0.0.0.0:8009
14:52:58,173 INFO [JkMain] Jk running ID=0 time=0/741 config=null
14:54:19,230 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract wonomi.identityManagement.interfaces.UserProfileLocal wonomi.identityManagement.interfaces.UserProfileLocalHome.create(java.lang.String,java.lang.String) throws javax.ejb.CreateException, causedBy:
java.lang.NullPointerException
at com.mysql.jdbc.PreparedStatement.asSql(PreparedStatement.java:562)
at com.mysql.jdbc.PreparedStatement.asSql(PreparedStatement.java:504)
at com.mysql.jdbc.PreparedStatement.toString(PreparedStatement.java:3228)
at java.lang.String.valueOf(String.java:2131)
at java.lang.StringBuffer.append(StringBuffer.java:370)
at com.mysql.jdbc.trace.Tracer.printParameters(Tracer.aj:240)
at com.mysql.jdbc.trace.Tracer.printEntering(Tracer.aj:167)
Here is the ejb Create method:
/**
* ejbCreate
*
* @ejb.create-method view-type="local"
*/
public java.lang.Integer ejbCreate(java.lang.String name, String password)
throws CreateException {
setId(new Integer(1));
setUserName(name);
setPassword(password);
return null;
}
Any help will be greatly appreciated.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983244#3983244
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983244
19Â years, 6Â months
[Persistence, JBoss/CMP, Hibernate, Database] - JBoss 3.2.5 MySQL 4.0 finder Method gives a Finder Exception
by pintovc
I have created an EJB with CMP in JBoss 3.2.5. It deploys fine. When I try to find a record in the database table it gives me a FinderException error.
However, I am able to see the record in the table. Here is the code in the EJB.
try{
home.create("test","password");
Collection col = home.findByUserName("test");
}catch(FinderException fe){
throw new EJBException("Cannot find user");
}
The database table has 3 columns: id, userName and password of type integer, varchar and varchar respectively. There is only one record in the database with field values of (1,"test", "junk")
Here is the error trace.
14:25:18,236 ERROR [LogInterceptor] EJBException:
javax.ejb.EJBException: Cannot find user
at wonomi.identityManagement.ejb.FiboBean.compute(FiboBean.java:126)
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:324)
at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:683)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983243#3983243
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983243
19Â years, 6Â months
[JBoss Seam] - fetchtype.LAZY results in JSF validation error
by roeber
I found out that setting fetchtype.LAZY on a manyToOne association results in a JSF validation error for an selectOneMenu component.
| @ManyToOne(fetch=FetchType.LAZY)
| public OrgUnit getOrgUnit() {
| return orgUnit;
| }
|
| <t:selectOneMenu id="orgunit" required="true" value="#{activity.orgUnit}" converter="orgunitconverter">
| <f:selectItems value="#{selectitemservice.orgUnitChoices}"/>
| </t:selectOneMenu>
|
| public Object getAsObject(FacesContext context, UIComponent comp,
| String value) throws ConverterException {
|
| if (!StringUtils.isNumeric(value))
| return null ;
|
| Long id = Long.valueOf(value);
| Object object = em.find(OrgUnit.class, id);
|
| return object ;
| }
|
| public String getAsString(FacesContext context, UIComponent component,
| Object object) throws ConverterException {
|
| if (object == null) {
| return null;
| }
| if (object instanceof OrgUnit) {
| OrgUnit orgUnit = (OrgUnit)object ;
| String returnString = orgUnit.getId().toString();
| return returnString;
| }
| return null ;
| }
|
The converter for OrgUnit seems to work: All units are displayed in the drop-down box and the current unit is also selected correctly in the box.
But submitting a page with this component shows a validation error saying: "orgunit": Value is not a valid option.
There are many things which could go wrong on my side but just removing the 'fetch=fetchtype.LAZY' (and therefore implicitly changing fetchtype to EAGER) results in a perfect working dialog. I suspect the use of a proxy for lazy fetching in Hibernate causing this, but debugging and tracing the converter and equals methods doesn't help me.
Any ideas would be appreciated.
--
Axel
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983241#3983241
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983241
19Â years, 6Â months
[JBoss Seam] - @Within and @Around...
by johnurban
I probably missed the forum post regarding... I can't compile with the latest CVS jboss-seam.jar:
| [javac] Compiling 52 source files to /Users/jurban/projects/checkin/build/classes
| [javac] /Users/jurban/projects/checkin/src/testSeam/LoggedInInterceptor.java:10: cannot find symbol
| [javac] symbol : class Around
| [javac] location: package org.jboss.seam.annotations
| [javac] import org.jboss.seam.annotations.Around;
| [javac] ^
| [javac] /Users/jurban/projects/checkin/src/testSeam/LoggedInInterceptor.java:11: cannot find symbol
| [javac] symbol : class Within
| [javac] location: package org.jboss.seam.annotations
| [javac] import org.jboss.seam.annotations.Within;
| [javac] ^
| [javac] /Users/jurban/projects/checkin/src/testSeam/LoggedInInterceptor.java:20: cannot find symbol
| [javac] symbol: class Around
| [javac] @Around({BijectionInterceptor.class, ValidationInterceptor.class,
| [javac] ^
| [javac] /Users/jurban/projects/checkin/src/testSeam/LoggedInInterceptor.java:22: cannot find symbol
| [javac] symbol: class Within
| [javac] @Within(RemoveInterceptor.class)
| [javac] ^
| [javac] Note: Some input files use or override a deprecated API.
| [javac] Note: Recompile with -Xlint:deprecation for details.
| [javac] Note: Some input files use unchecked or unsafe operations.
| [javac] Note: Recompile with -Xlint:unchecked for details.
| [javac] 4 errors
|
|
|
| Using that LoggedInInterceptor from the examples....
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983240#3983240
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983240
19Â years, 6Â months