cancel
Showing results for 
Search instead for 
Did you mean: 

ClassCastException during deployment with more than one used entity

Former Member
0 Kudos

Hi,

i am still trying to get into NW development and got one more time stuck. I have a CE 7.1 SR5 project containing a dictionary, a bean module, an EAR project and a web dynpro project.

With the following two classes everything runs fine:


[AT]Entity
[AT]Table(name="TMP_USER")
[AT]NamedQueries(value={[AT]NamedQuery(name="doLogin", query="SELECT u FROM User u WHERE u.login = :login AND u.password = :password")})
public class User implements Serializable {
	[AT]Id
	private int id;
	private String login;
	private String password;
	private static final long serialVersionUID = 1L;
	public User() {
		super();
	}
// Omitted Accessors
}


[AT]Stateless(name="UserSessionBean")
[AT]WebService
public class UserSessionBean implements UserSessionLocal 
{
	[AT]PersistenceContext(unitName="DBAccess")
	private EntityManager em;
	
	public User doLogin(String login, String password)
	{
		Query query = em.createNamedQuery("doLogin");
		query.setParameter("login", login);
		query.setParameter("password", password);
		try
		{
			return (User) query.getSingleResult();			
		}
		catch(NoResultException e)
		{
			return null;
		}
	}			
}

build, deploy, run in webservice navigator -> ok

Then i created a new entity:


[AT]Entity
[AT]Table(name="TMP_PROJECT")
[AT]NamedQueries(value={[AT]NamedQuery(name="findAllProjects", query="SELECT p FROM Project p")})
public class Project implements Serializable {
	[AT]Id
	private int id;
	private int ownerid;
	private String name;
	private Timestamp creationtime;
	private String description;
	private int number;
	private short subnumber;
	private static final long serialVersionUID = 1L;
	
	public Project() {
		super();
	}
/*
  Omitted Accessors

*/
}

build, deploy, run in webservice navigator -> no problem.

Then i changed the UserSessionBean to:


[AT]Stateless(name="UserSessionBean")
[AT]WebService
public class UserSessionBean implements UserSessionLocal 
{
	[AT]PersistenceContext(unitName="DBAccess")
	private EntityManager em;
	
	public User doLogin(String login, String password)
	{
		Query query = em.createNamedQuery("doLogin");
		query.setParameter("login", login);
		query.setParameter("password", password);
		try
		{
			return (User) query.getSingleResult();			
		}
		catch(NoResultException e)
		{
			return null;
		}
	}			
	
	public Projecet testfunc()
	{
		return null;
	}
}

And now during deployment there is an warning (in reality it´s an exception) and the bean does not work any more.

The exception is


		1. Exception has been returned while the 'testproject.testcorp.de/testprojectear' was starting. Warning/Exception :
[ERROR CODE DPL.DS.6193] Error while ; nested exception is: 
	com.sap.engine.services.deploy.exceptions.ServerDeploymentException: [ERROR CODE DPL.DS.5030] Clusterwide exception: server ID 7707450:com.sap.engine.services.deploy.container.DeploymentException: 
	at com.sap.engine.services.webservices.server.deploy.WebServicesDeployManager.makeStartInitially(WebServicesDeployManager.java:693)
	at com.sap.engine.services.deploy.server.application.StartInitiallyTransaction.makeStartInitially(StartInitiallyTransaction.java:184)
	at com.sap.engine.services.deploy.server.application.StartInitiallyTransaction.prepare(StartInitiallyTransaction.java:145)
	at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:420)
	at com.sap.engine.services.deploy.server.application.StartTransaction.doStartInitiallyGlobal(StartTransaction.java:449)
	at com.sap.engine.services.deploy.server.application.StartTransaction.doStartInitially(StartTransaction.java:437)
	at com.sap.engine.services.deploy.server.application.StartTransaction.prepare(StartTransaction.java:178)
	at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhasesOnOneServer(ApplicationTransaction.java:420)
	at com.sap.engine.services.deploy.server.application.ApplicationTransaction.makeAllPhases(ApplicationTransaction.java:445)
	at com.sap.engine.services.deploy.server.application.ParallelAdapter.super_MakeAllPhases(ParallelAdapter.java:337)
	at com.sap.engine.services.deploy.server.application.StartTransaction.makeAllPhasesImpl(StartTransaction.java:550)
	at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:251)
	at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:392)
	at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3389)
	at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3375)
	at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3278)
	at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:3251)
	at com.sap.engine.services.dc.lcm.impl.J2EELCMProcessor.doStart(J2EELCMProcessor.java:99)
	at com.sap.engine.services.dc.lcm.impl.LifeCycleManagerImpl.start(LifeCycleManagerImpl.java:62)
	at com.sap.engine.services.dc.cm.deploy.impl.LifeCycleManagerStartVisitor.visit(LifeCycleManagerStartVisitor.java:34)
	at com.sap.engine.services.dc.cm.deploy.impl.DeploymentItemImpl.accept(DeploymentItemImpl.java:83)
	at com.sap.engine.services.dc.cm.deploy.impl.DefaultDeployPostProcessor.postProcessLCMDeplItem(DefaultDeployPostProcessor.java:80)
	at com.sap.engine.services.dc.cm.deploy.impl.DefaultDeployPostProcessor.postProcess(DefaultDeployPostProcessor.java:56)
	at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.doPostProcessing(DeployerImpl.java:741)
	at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.performDeploy(DeployerImpl.java:732)
	at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.doDeploy(DeployerImpl.java:576)
	at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.deploy(DeployerImpl.java:270)
	at com.sap.engine.services.dc.cm.deploy.impl.DeployerImpl.deploy(DeployerImpl.java:192)
	at com.sap.engine.services.dc.cm.deploy.impl.DeployerImplp4_Skel.dispatch(DeployerImplp4_Skel.java:875)
	at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:351)
	at com.sap.engine.services.rmi_p4.server.ServerDispatchImpl.run(ServerDispatchImpl.java:70)
	at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:62)
	at com.sap.engine.services.rmi_p4.P4Message.execute(P4Message.java:37)
	at com.sap.engine.services.cross.fca.FCAConnectorImpl.executeRequest(FCAConnectorImpl.java:877)
	at com.sap.engine.services.rmi_p4.P4Message.process(P4Message.java:53)
	at com.sap.engine.services.cross.fca.MessageReader.run(MessageReader.java:58)
	at com.sap.engine.core.thread.execution.Executable.run(Executable.java:108)
	at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:304)
Caused by: com.sap.engine.interfaces.webservices.server.deploy.WSDeploymentException: Exception occured during web services deployment. Unable to generate serialization framework for web service UserSessionBeanService, application testproject.testcorp.de/testprojectear.
	at com.sap.engine.services.webservices.server.deploy.ws.WSInitialStartProcess.generateJAXWSFramework(WSInitialStartProcess.java:360)
	at com.sap.engine.services.webservices.server.deploy.ws.WSInitialStartProcess.generateJAXWSFramework(WSInitialStartProcess.java:220)
	at com.sap.engine.services.webservices.server.deploy.ws.WSInitialStartProcess.execute(WSInitialStartProcess.java:140)
	at com.sap.engine.services.webservices.server.deploy.WSBaseAbstractDProcess.makeProcess(WSBaseAbstractDProcess.java:316)
	at com.sap.engine.services.webservices.server.deploy.WebServicesDeployManager.makeStartInitially(WebServicesDeployManager.java:688)
	... 37 more
Caused by: java.lang.ClassCastException: class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$5:library:jaxb20[AT]com.sap.engine.boot.loader.ResourceMultiParentClassLoader[AT]1489c06[AT]alive incompatible with class com.sun.xml.bind.v2.model.impl.ClassInfoImpl:library:jaxb20[AT]com.sap.engine.boot.loader.ResourceMultiParentClassLoader[AT]1489c06[AT]alive
	at com.sun.xml.bind.v2.model.impl.ClassInfoImpl.getBaseClass(ClassInfoImpl.java:170)
	at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getBaseClass(RuntimeClassInfoImpl.java:58)
	at com.sun.xml.bind.v2.model.impl.RuntimeClassInfoImpl.getBaseClass(RuntimeClassInfoImpl.java:38)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:142)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:48)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:40)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
	at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
	at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:33)
	at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:22)
	at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:15)
	at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:38)
	at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:41)
	at java.util.AbstractList$Itr.next(AbstractList.java:422)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:48)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:40)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
	at com.sun.xml.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:56)
	at com.sun.xml.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:33)
	at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:22)
	at com.sun.xml.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:15)
	at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:38)
	at com.sun.xml.bind.v2.model.impl.ElementPropertyInfoImpl$1.get(ElementPropertyInfoImpl.java:41)
	at java.util.AbstractList$Itr.next(AbstractList.java:422)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:139)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:48)
	at com.sun.xml.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:40)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:189)
	at com.sun.xml.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:204)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:356)
	at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:217)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
	at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
	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 javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:210)
	at javax.xml.bind.ContextFinder.find(ContextFinder.java:368)
	at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
	at com.sap.engine.services.webservices.jaxws.j2w.JaxWsSchemaGenerator.genJaxbMappings(JaxWsSchemaGenerator.java:274)
	at com.sap.engine.services.webservices.jaxws.j2w.JaxWsIMappingGenerator.generateWSDL(JaxWsIMappingGenerator.java:103)
	at com.sap.engine.services.webservices.server.deploy.ws.WSInitialStartProcess.generateJAXWSFramework(WSInitialStartProcess.java:286)
	... 41 more

I already downgraded my Java JRE/JDK to 1.5.0_15 as it was hinted here in the forum, but the problem persists. Any idea what is wrong?

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Finally i found the cause. As long as the entity bean Project uses a Timestamp the deployment fails. after removing the member variable and the accessor the deployment succeed.

Changing to a Date didn´t help, either. Will open another question tommorrow.

Former Member
0 Kudos

Some additional information:

When the JPA enitity generator generates entities from tables with timestamp fields, it uses java.sql.Timestamp, which causes this trouble.

The correct way is to use java.sql.Date an add a "@Temporal(TemporalType.TIMESTAMP)" annotation.

Former Member
0 Kudos

Does nobody know what causes this exception

java.lang.ClassCastException: class com.sun.xml.bind.v2.model.impl.RuntimeBuiltinLeafInfoImpl$5:library:jaxb20[AT]com.sap.engine.boot.loader.ResourceMultiParentClassLoader[AT]1489c06[AT]alive incompatible with class com.sun.xml.bind.v2.model.impl.ClassInfoImpl:library:jaxb20[AT]com.sap.engine.boot.loader.ResourceMultiParentClassLoader[AT]1489c06[AT]alive

or how to resolve this problem?

Former Member
0 Kudos

Thanks for the answer, but i am not using this wizard. Some how this project class must be flawed.


public User testfunc()
{
return null;
}

works, but changing to


public Project testfunc()
{
return null; 
}

immediately leads to the above deployment error.

This is the offending class, it compiles without warning


package de.testcorp.testproject.beans;

import java.io.Serializable;
import java.sql.Timestamp;
import javax.persistence.*;

@Entity
@Table(name="TMP_PROJECT")
@NamedQueries(value={@NamedQuery(name="findAllProjects", query="SELECT p FROM Project p")})
public class Project implements Serializable {
	@Id
	private int id;

	private int ownerid;

	private String name;

	private Timestamp creationtime;

	private String description;

	private int number;

	private short subnumber;

	private static final long serialVersionUID = 1L;
	
	public Project() {
		super();
	}

	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getOwnerid() {
		return this.ownerid;
	}

	public void setOwnerid(int ownerid) {
		this.ownerid = ownerid;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Timestamp getCreationtime() {
		return this.creationtime;
	}

	public void setCreationtime(Timestamp creationtime) {
		this.creationtime = creationtime;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public int getNumber() {
		return this.number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public short getSubnumber() {
		return this.subnumber;
	}

	public void setSubnumber(short subnumber) {
		this.subnumber = subnumber;
	}

}

0 Kudos

Hi,

Just a hint. Not sure if this would work. But as i can see you added a new method in session bean.

You may need to again run the webservice wizard on the session bean.

Regards

Sidharth