Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

depoloying finder method in JBoss cmp?

  Asked By: Everett    Date: May 04    Category: Java    Views: 764
  

I have problem to deploy finder method findByUsernameAndPassword
(String, String)
This message is probably very long but I am clules what am I
missing. Please if somebody know I would highly apretiate.

created entity definition and all:
<entity>
<ejb-name>User</ejb-name>
<home>com.vmm.admin.UserHome</home>
<remote>com.vmm.admin.UserRemote</remote>
<ejb-class>com.vmm.admin.UserBean</ejb-class>

<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.Integer</prim-key-class>
<primkey-field>userid</primkey-field>
<reentrant>true</reentrant>
<cmp-version>2.x</cmp-version>
<abstract-schema-name>User</abstract-schema-name>
<cmp-field><field-name>userid</field-name></cmp-field>
<cmp-field><field-name>username</field-name></cmp-field>
<cmp-field><field-name>roleid</field-name></cmp-field>
<cmp-field><field-name>password</field-name></cmp-field>
<cmp-field><field-name>contactid</field-name></cmp-field>
<cmp-field><field-name>subscribeflag</field-name></cmp-field>
<cmp-field><field-name>activeflag</field-name></cmp-field>
<query>
<query-method>
<method-
name>findByUsernameAndPassword</method-name>
<method-params>
<method-
param>java.lang.String</method-param>
<method-
param>java.lang.String</method-param>
</method-params>
</query-method>
<ejb-ql><![CDATA[
SELECT u.userid
FROM users as u
WHERE u.username=?1
AND u.password=?2
]]></ejb-ql>
</query>
</entity>
then in
UserHome I have this:

package com.vmm.admin;
import java.rmi.RemoteException;
import javax.ejb.*;

public interface UserHome extends javax.ejb.EJBHome {

public UserRemote create(Integer id) throws CreateException,
RemoteException;
public UserRemote findByUsernameAndPassword(String username,
String password) throws FinderException, RemoteException;
public UserRemote findByPrimaryKey(Integer pk) throws
FinderException,
RemoteException;
}
then in EJBObject have this
package com.vmm.admin;

import java.rmi.RemoteException;
import java.util.*;

public interface UserRemote extends javax.ejb.EJBObject {
public void setUserid(Integer id) throws RemoteException;
public Integer getUserid() throws RemoteException;

public void setUsername(String userName) throws
RemoteException;
public String getUsername() throws RemoteException;

public void setRoleid(Integer roleId) throws
RemoteException;
public Integer getRoleid() throws RemoteException;

public void setPassword(String password) throws
RemoteException;
public String getPassword() throws RemoteException;

public void setContactid(Integer contactId) throws
RemoteException;
public Integer getContactid() throws RemoteException;

public void setSubscribeflag(String subscribeFlag) throws
RemoteException;
public String getSubscribeflag() throws RemoteException;

public void setActiveflag(String activeFlag) throws
RemoteException;
public String getActiveflag() throws RemoteException;

public Collection findByUsernameAndPassword(String username,
String password) throws RemoteException;


}
and in EntityBean this:
package com.vmm.admin;
import javax.ejb.*;
import java.util.*;

public abstract class UserBean implements javax.ejb.EntityBean {
private EntityContext ctx;

// public Integer ejbCreate(Integer id, String userName, String
password,
// String subscribeFlag, String activeFlag, Integer
contactId,
// Integer roleId) throws javax.ejb.CreateException {
public Integer ejbCreate(Integer id) throws
javax.ejb.CreateException {
this.setUserid(id);

this.setContactid(new Integer(1));
System.out.println("UserBean: ejbCreate called");
return null;
}

// public void ejbPostCreate(Integer id, String userName,
String password,
// String subscribeFlag, String activeFlag, Integer
contactId,
// Integer roleId){
public void ejbPostCreate(Integer id){
System.out.println("UserBean: postCreate called");
}

// business logic
public Collection ejbFindByUsernameAndPassword(String
username, String password){
System.out.println("UserBean:
findByUsernameAndPassword");
return null;
}

public abstract void setUserid(Integer id);
public abstract Integer getUserid();

public abstract void setUsername(String userName);
public abstract String getUsername();

public abstract void setRoleid(Integer roleId);
public abstract Integer getRoleid();

public abstract void setPassword(String password);
public abstract String getPassword();

public abstract void setContactid(Integer contactId);
public abstract Integer getContactid();

public abstract void setSubscribeflag(String subscribeFlag);
public abstract String getSubscribeflag();

public abstract void setActiveflag(String activeFlag);
public abstract String getActiveflag();

//
// interface methods
//
public void ejbActivate() {
System.out.println("[UserBean] ejbActivate called");
}

public void ejbPassivate() {
System.out.println("[UserBean] ejbPassivate called");
}

public void ejbLoad() {
System.out.println("[UserBean] ejbLoad called");
}

public void ejbStore() {
System.out.println("[UserBean] ejbStore called");
}

public void ejbRemove() {
System.out.println("[UserBean] ejbRemove called");
}

public void setEntityContext(EntityContext ctx) {
this.ctx = ctx;
}

public void unsetEntityContext() {
this.ctx =null;
}

}
It should work but still there is err log that JBoss gives:
2003-12-08 23:58:37,680 WARN [org.jboss.system.ServiceController]
Problem starting service jboss.j2ee:jndiName=admin.Role,service=EJB
org.jboss.deployment.DeploymentException: Query method not found:
findByUsernameAndPassword(java.lang.String,java.lang.String)
at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory.getQ
ueryMethods(JDBCQueryMetaDataFactory.java:282)
at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory.getQ
ueryMethods(JDBCQueryMetaDataFactory.java:229)
at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCQueryMetaDataFactory.crea
teJDBCQueryMetaData(JDBCQueryMetaDataFactory.java:40)
at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>
(JDBCEntityMetaData.java:366)
at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init
>(JDBCApplicationMetaData.java:139)
at
org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load
(JDBCXmlFileLoader.java:52)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaDat
a(JDBCStoreManager.java:676)
at
org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager
(JDBCStoreManager.java:372)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start
(JDBCStoreManager.java:320)
at org.jboss.ejb.plugins.CMPPersistenceManager.start
(CMPPersistenceManager.java:152)
at org.jboss.ejb.EntityContainer.startService
(EntityContainer.java:343)
at org.jboss.system.ServiceMBeanSupport.start
(ServiceMBeanSupport.java:192)
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.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke
(ServiceController.java:976)
at $Proxy14.start(Unknown Source)
at org.jboss.system.ServiceController.start
(ServiceController.java:394)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown
Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke
(MBeanProxyExt.java:177)
at $Proxy47.start(Unknown Source)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:331)
at org.jboss.system.ServiceMBeanSupport.start
(ServiceMBeanSupport.java:192)
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.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:546)
at org.jboss.system.ServiceController$ServiceProxy.invoke
(ServiceController.java:976)
at $Proxy14.start(Unknown Source)
at org.jboss.system.ServiceController.start
(ServiceController.java:394)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown
Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke
(MBeanProxyExt.java:177)
at $Proxy12.start(Unknown Source)
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:544)
at org.jboss.deployment.MainDeployer.start
(MainDeployer.java:832)
at org.jboss.deployment.MainDeployer.deploy
(MainDeployer.java:642)
at org.jboss.deployment.MainDeployer.deploy
(MainDeployer.java:605)
at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown
Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke
(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke
(MBeanServerImpl.java:546)
at org.jboss.mx.util.MBeanProxyExt.invoke
(MBeanProxyExt.java:177)
at $Proxy6.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy
(URLDeploymentScanner.java:302)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan
(URLDeploymentScanner.java:458)
at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
doScan(AbstractDeploymentScanner.java:201)
at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
loop(AbstractDeploymentScanner.java:212)
at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.
run(AbstractDeploymentScanner.java:191)
2003-12-08 23:58:37,690 INFO [org.jboss.ejb.EjbModule] Started
jboss.j2ee:module=ViewMyMovie.jar,service=EjbModule
2003-12-08 23:58:37,690 INFO [org.jboss.ejb.EJBDeployer] Deployed:
file:/C:/Apache/jboss-3.2.2/server/default/deploy/ViewMyMovie.jar
2003-12-08 23:58:37,740 INFO [org.jboss.deployment.MainDeployer]
Deployed package: file:/C:/Apache/jboss-
3.2.2/server/default/deploy/ViewMyMovie.jar
2003-12-08 23:58:37,750 ERROR
[org.jboss.deployment.scanner.URLDeploymentScanner] MBeanException:
Exception in MBean operation 'checkIncompleteDeployments()'
Cause: Incomplete Deployment listing:
Packages waiting for a deployer:
<none>
Incompletely deployed packages:
<none>
MBeans waiting for classes:
<none>
MBeans waiting for other MBeans:
[ObjectName: jboss.j2ee:jndiName=admin.User,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=admin.Contact,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=account.CreditCard,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=maintenance.Movie,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=MovieCategory,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=admin.State,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=account.CreditcardType,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=account.Account,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=maintenance.UserMovie,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=maintenance.RentHistory,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=admin.Privilege,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String), ObjectName:
jboss.j2ee:jndiName=admin.Role,service=EJB
state: FAILED
I Depend On:
Depends On Me: org.jboss.deployment.DeploymentException: Query
method not found: findByUsernameAndPassword
(java.lang.String,java.lang.String)]

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on depoloying finder method in JBoss cmp? Or get search suggestion and latest updates.




Tagged: