crazyitguy
IS-IT--Management
I am using the latest versions of Jboss(4.0.5.GA) and Lomboz(R-3.2-200610201336) along with SQL Server 2005 and Microsoft's SQL Server 2005 JDBC driver.
Lomboz used xdoclet to create the java files based on the SQL table but it did not put anything in the DoctorBean.java file telling it that the primary key was auto-incremented.
Using the JSP files, I can retreive data out of the database fine so I know the connection and drivers are set up properly.
Here is the error:
Simple Doctor table:
Most of DoctorBean.java was createded automatically with xdoclet, I created these items manually but with no success:
DoctorBean.java:
JSP client page snippet:
thanks
Lomboz used xdoclet to create the java files based on the SQL table but it did not put anything in the DoctorBean.java file telling it that the primary key was auto-incremented.
Using the JSP files, I can retreive data out of the database fine so I know the connection and drivers are set up properly.
Here is the error:
Code:
09:16:46,815 WARN [ServiceController] Problem starting service jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:197)
at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClassFromClassLoader(UnifiedLoaderRepository3.java:277)
at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:284)
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:511)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
at org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:90)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityCommandMetaData.<init>(JDBCEntityCommandMetaData.java:73)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:952)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:378)
at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:89)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:736)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:424)
at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:368)
at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:172)
at org.jboss.ejb.EjbModule.startService(EjbModule.java:414)
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(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy25.start(Unknown Source)
at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:662)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy26.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy8.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
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(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
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.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:490)
at java.lang.Thread.run(Unknown Source)
09:16:46,862 INFO [EJBDeployer] Deployed: file:/C:/java/jboss-4.0.5.GA/server/default/deploy/MedicalEJB.jar
09:16:46,987 INFO [TomcatDeployer] deploy, ctxPath=/MedicalWeb, warUrl=.../tmp/deploy/tmp63256MedicalWeb-exp.war/
09:16:47,315 INFO [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
09:16:47,503 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
--- MBeans waiting for other MBeans ---
ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
State: FAILED
Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
State: FAILED
Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
Simple Doctor table:
Code:
CREATE TABLE [dbo].[Doctors](
[DoctorId] [int] IDENTITY(1,1) NOT NULL,
[firstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[lastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
CONSTRAINT [PK_Doctors] PRIMARY KEY CLUSTERED
(
[DoctorId] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
Most of DoctorBean.java was createded automatically with xdoclet, I created these items manually but with no success:
Code:
* @jboss.entity-command
* name="mssql-get-generated-keys"
*
* @jboss.unknown-pk
* class="java.lang.Integer"
* column-name="doctorid"
* field-name="doctorid"
* jdbc-type="INTEGER"
* sql-type="int"
* auto-increment="true"
DoctorBean.java:
Code:
/**
*
*/
package com.bdintegrations.MedicalApp.EJB;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.EntityContext;
import javax.ejb.RemoveException;
/**
* <!-- begin-xdoclet-definition -->
* @ejb.bean name="Doctor"
* jndi-name="Doctor"
* type="CMP"
* primkey-field="doctorid"
* schema="DoctorSCHEMA"
* cmp-version="2.x"
*
* @ejb.persistence
* table-name="dbo.Doctors"
*
* @ejb.finder
* query="SELECT OBJECT(a) FROM DoctorSCHEMA as a"
* signature="java.util.Collection findAll()"
*
* @ejb.pk
* class="java.lang.Object"
* generate="false"
*
* @jboss.entity-command
* name="mssql-get-generated-keys"
*
* @jboss.unknown-pk
* class="java.lang.Integer"
* column-name="doctorid"
* field-name="doctorid"
* jdbc-type="INTEGER"
* sql-type="int"
* auto-increment="true"
*
* @jboss.persistence
* datasource="java:/MSSQLDS"
* datasource-mapping="MS SQLSERVER2005"
* table-name="dbo.Doctors"
* create-table="false" remove-table="false"
* alter-table="false"
*
* <!-- end-xdoclet-definition -->
* @generated
**/
public abstract class DoctorBean implements javax.ejb.EntityBean {
/**
*
* <!-- begin-user-doc -->
* The ejbCreate method.
* <!-- end-user-doc -->
*
* <!-- begin-xdoclet-definition -->
* @ejb.create-method
* <!-- end-xdoclet-definition -->
* @generated
*/
public java.lang.Object ejbCreate(String firstName, String lastName) throws javax.ejb.CreateException {
setFirstname(firstName);
setLastname(lastName);
return null;
// end-user-code
}
/**
* <!-- begin-user-doc -->
* The container invokes this method immediately after it calls ejbCreate.
* <!-- end-user-doc -->
*
* @generated
*/
public void ejbPostCreate() throws javax.ejb.CreateException {
// begin-user-code
// end-user-code
}
/**
*
*
* <!-- begin-user-doc -->
* CMP Field doctorid
*
* Returns the doctorid
* @return the doctorid
*
* <!-- end-user-doc -->
*
* <!-- begin-xdoclet-definition -->
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="DoctorId"
* jdbc-type="INTEGER"
* sql-type="int identity"
* read-only="false"
* @ejb.pk-field
*
* @ejb.interface-method
*
* <!-- end-xdoclet-definition -->
* @generated
*/
public abstract java.lang.Integer getDoctorid();
/**
* <!-- begin-user-doc -->
* Sets the doctorid
*
* @param java.lang.Integer the new doctorid value
* <!-- end-user-doc -->
*
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
*/
public abstract void setDoctorid(java.lang.Integer doctorid);
/**
*
*
* <!-- begin-user-doc -->
* CMP Field firstname
*
* Returns the firstname
* @return the firstname
*
* <!-- end-user-doc -->
*
* <!-- begin-xdoclet-definition -->
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="firstName"
* jdbc-type="VARCHAR"
* sql-type="varchar"
* read-only="false"
*
*
* @ejb.interface-method
*
* <!-- end-xdoclet-definition -->
* @generated
*/
public abstract java.lang.String getFirstname();
/**
* <!-- begin-user-doc -->
* Sets the firstname
*
* @param java.lang.String the new firstname value
* <!-- end-user-doc -->
*
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
*/
public abstract void setFirstname(java.lang.String firstname);
/**
*
*
* <!-- begin-user-doc -->
* CMP Field lastname
*
* Returns the lastname
* @return the lastname
*
* <!-- end-user-doc -->
*
* <!-- begin-xdoclet-definition -->
*
* @ejb.persistent-field
* @ejb.persistence
* column-name="lastName"
* jdbc-type="VARCHAR"
* sql-type="varchar"
* read-only="false"
*
*
* @ejb.interface-method
*
* <!-- end-xdoclet-definition -->
* @generated
*/
public abstract java.lang.String getLastname();
/**
* <!-- begin-user-doc -->
* Sets the lastname
*
* @param java.lang.String the new lastname value
* <!-- end-user-doc -->
*
* <!-- begin-xdoclet-definition -->
* @ejb.interface-method
* <!-- end-xdoclet-definition -->
* @generated
*/
public abstract void setLastname(java.lang.String lastname);
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbActivate()
*/
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbLoad()
*/
public void ejbLoad() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbPassivate()
*/
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbRemove()
*/
public void ejbRemove() throws RemoveException, EJBException,
RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#ejbStore()
*/
public void ejbStore() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
*/
public void setEntityContext(EntityContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see javax.ejb.EntityBean#unsetEntityContext()
*/
public void unsetEntityContext() throws EJBException, RemoteException {
// TODO Auto-generated method stub
}
/**
*
*/
public DoctorBean() {
// TODO Auto-generated constructor stub
}
}
JSP client page snippet:
Code:
<%
DoctorHome home = DoctorUtil.getHome();
Doctor doctor = home.create("Jon","Smith");
%>
<%=doctor.getDoctorid() %>
thanks