on 11-16-2006 1:05 PM
Hi,
We are developping a persistent application.
The code of our PersistenceMaster is:
We have got two class to store in persistence:
1. MaestroPersistencia.java (is our Persistence Master)
2. MetodosPersistencia.java (is the class with the write/read methods)
The code is:
1. MaestroPersistencia.java
class MaestroPersistencia implements PackagePersistenceMaster, EntityFactory {
static DescriptorRuntime PDR = DescriptorRuntime.getInstance();
static String[] CLASSTYPES = new String[] { Material.CLASSTYPE};
static AttributeDescriptor[] MATERIAL_ATRIBUTOS ;
static LinkDescriptor[] NO_LINK = new LinkDescriptor[] {};
static ClassDescriptor P_CLASS_MATERIAL;
static {
try {
MATERIAL_ATRIBUTOS = new AttributeDescriptor[] {
PDR.createAttributeDescriptor("mat",AttributeType.STRING,1,30) ,
PDR.createAttributeDescriptor("descripcion",AttributeType.STRING,1,40)
};
P_CLASS_MATERIAL = PDR.createClassDescriptor(Material.CLASSTYPE,MATERIAL_ATRIBUTOS);
} catch (Throwable t) {
t.printStackTrace();
System.exit(-1);
}// fin del catch
}// fin de static
MaestroPersistencia() {
}
public String getPackageName() {
return null;
}
public String[] getClasstypes() {
return CLASSTYPES;
}
public PersistableEntity createEntity(PersistenceContainer obj) {
return new Material(obj);
}
public ClassDescriptor getClassDescriptor(String classtype) {
}
public PackagePersistenceMaster getPersistenceMaster() {
return this;
}
}
2. MetodosPersistencia.java
public class MetodoPersistencia {
private static PersistenceRuntime persistence;
private static PersistenceManager perManager;
private static MaestroPersistencia master;
private static int idCount;
public static void setupPersistenceRuntime()
{
try {
persistence = PersistenceRuntime.getInstance();
master = new MaestroPersistencia();
persistence.registerPersistenceMaster(master);
perManager = persistence.getPersistenceManager(VisibilityType.SEPARATED);
perManager.registerEntityFactory(master);
perManager.beginTransaction(true);
} catch (Exception e) {
e.printStackTrace();
System.out.println("Error during startup");
System.exit(-1);
}
}
public static void writeEntity(PersistableEntity obj)
{
PersistenceException e = null;
try {
perManager.update(obj, TreeOptionType.SKELETON);
)catch (PersistenceException e1)
e = e1;
e1.printStackTrace();
}
}
public static void addEntity(String material, String descripcion)
{
PersistableEntity emat = null;
if (material.length() > 0)
{
emat = createMaterialEntity(Integer.toString(idCount));
idCount++;
}
setMaterialAtributos(emat,material,descripcion);
writeEntity(emat);
}
public static PersistableEntity createMaterialEntity(String mat)
{
PersistableEntity material = new
Material(perManager.getPersistedObjectFactory().createPersistedObject(MaestroPersistencia.P_CLASS_MATERIAL, mat));
return material;
}
public static void setMaterialAtributos(PersistableEntity material,String mate, String descripcion){
Material mat = (Material) material;
mat.setValues(mate,descripcion);
}
}
The problem is that when we call this instruction:
MetodosPersistencia.setupPersistenceRuntime();
MetodosPersistencia.addEntity("example","this is one example");
Throws this exception:
java.lang.RuntimeException: Failed calling event handler onSincronizar in
com.iberdrola.generacion.movilidad.almacenes.controladoras.SalidasDevoluciones.
java.lang.ArrayIndexOutOfBoundsException: 3
at com.sap.ip.me.persist.jdbc.DBTableMap.getClassDescriptor(DBTableMap.java:111)
at com.sap.ip.me.persist.jdbc.DBEntityStoreFactory.createEntityStore(DBEntityStoreFactory.java:98)
at com.sap.ip.me.persist.jdbc.DBEntityStoreFactory.getEntityStore(DBEntityStoreFactory.java:54)
at com.sap.ip.me.persist.jdbc.DBPersistenceManagerImpl.validate(DBPersistenceManagerImpl.java:376)
at com.sap.ip.me.persist.jdbc.DBPersistenceManagerImpl.update(DBPersistenceManagerImpl.java:107)
at com.sap.ip.me.persist.core.PersistenceManagerTXWrapper.update(PersistenceManagerTXWrapper.java:46)
at
com.iberdrola.generacion.movilidad.almacenes.persistencia.MetodosPersistencia.writeEntity(MetodosPersistencia.java:13
7)
at
com.iberdrola.generacion.movilidad.almacenes.persistencia.MetodosPersistencia.addEntity(MetodosPersistencia.java:187)
at
com.iberdrola.generacion.movilidad.almacenes.controladoras.SalidasDevoluciones.onSincronizar(SalidasDevoluciones.java
:158)
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 com.sap.mbs.core.control.AbstractViewController.process(AbstractViewController.java:117)
at com.sap.mbs.core.control.DefaultStateMachine.process(DefaultStateMachine.java:39)
at com.sap.mbs.core.web.FrontServlet.doHandleEvent(FrontServlet.java:142)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGetNotThreadSafe(AbstractMEHttpServlet.java:347)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGet(AbstractMEHttpServlet.java:689)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doPost(AbstractMEHttpServlet.java:706)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.service(AbstractMEHttpServlet.java:313)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:534)
at com.sap.mbs.core.control.AbstractViewController.process(AbstractViewController.java:121)
at com.sap.mbs.core.control.DefaultStateMachine.process(DefaultStateMachine.java:39)
at com.sap.mbs.core.web.FrontServlet.doHandleEvent(FrontServlet.java:142)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGetNotThreadSafe(AbstractMEHttpServlet.java:347)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doGet(AbstractMEHttpServlet.java:689)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.doPost(AbstractMEHttpServlet.java:706)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at com.sap.ip.me.api.runtime.jsp.AbstractMEHttpServlet.service(AbstractMEHttpServlet.java:313)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
at org.apache.tomcat.core.Handler.service(Handler.java:287)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:806)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:752)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
at java.lang.Thread.run(Thread.java:534)
We have debugged and the specify instruction which throws the exception is:
perManager.update(obj, TreeOptionType.SKELETON)
where perManager is our Persistence Manager
This code, which is developping in sp11, runs without problems in sp11 with db2e8282, now we are deploying this application in sp18 with the same version of db2e. Can it be the problem? Have we install a new version of it?
Best Regards,
SCZ
Hi,
Just now, we have tried to deploy in sp11 this code and the execution was ok.
SAP example about persistence for sp16 runs without problems in sp11 and sp18.
In the first execution (with re-installed client) the error is "table name is null". In next execution it throws the exception we have written in the first message.
Best regards,
SCZ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
We have installed the db2ev8.2.2 because we can´t find the 8.2.1 version and the problem don´t disappear.
Could you tell us where we can find it?
Do you have another idea about the problem?
Best regards,
SCZ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Satur,
The correct version for SP 18 is 8.2.1. It is different from what you are using.
Regards,
Karthik
Message was edited by:
Karthik V Setty
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.