Hi all,
I hope that someone of you got my same problem.
I'm trying to interact with a mysql database throught hibernate. When I open
hibernate session I cant' compile my web service with "run as tuscany". I get
the following error (this is just a little part):
AVVERTENZA: Exception while generating WSDL for calcolaTracciato/localizzaPallet
25-nov-2008 17.06.43
org.apache.tuscany.sca.binding.ws.wsdlgen.BindingWSDLGenerator
GRAVE: Exception thrown was: org.osoa.sca.ServiceRuntimeException:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
this problem is related to the following location:
at java.lang.StackTraceElement
at public java.lang.StackTraceElement[]
java.lang.Throwable.getStackTrace()
at java.lang.Throwable
at java.lang.Exception
at java.sql.SQLException
at protected java.sql.SQLException
tuscany.jaxws.SQLExceptionBean.nextException
at tuscany.jaxws.SQLExceptionBean
25-nov-2008 17.06.43
org.apache.tuscany.sca.assembly.builder.impl.ComponentReferenceWireBuilderImpl
AVVERTENZA: No targets for reference: Composite =
{http://localizzazionePallet}localizzazionePallet Reference = interfaccia
25-nov-2008 17.06.43 org.apache.tuscany.sca.node.launcher.NodeLauncherUtil node
GRAVE: SCA Node could not be created
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at
org.apache.tuscany.sca.node.launcher.NodeLauncherUtil.node(NodeLauncherUtil.java:340)
at
org.apache.tuscany.sca.node.launcher.NodeLauncher.createNode(NodeLauncher.java:60)
at
org.apache.tuscany.sca.node.launcher.NodeLauncher.main(NodeLauncher.java:122)
Caused by: org.osoa.sca.ServiceRuntimeException:
org.osoa.sca.ServiceRuntimeException:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
IllegalAnnotationExceptions
java.lang.StackTraceElement does not have a no-arg default constructor.
this problem is related to the following location:
at java.lang.StackTraceElement
at public java.lang.StackTraceElement[]
java.lang.Throwable.getStackTrace()
at java.lang.Throwable
at java.lang.Exception
at java.sql.SQLException
at protected java.sql.SQLException
tuscany.jaxws.SQLExceptionBean.nextException
at tuscany.jaxws.SQLExceptionBean
If I try to delete the class the interact with DB though hibernate my web
service run coorectly; the same is if I use the class in a classical web
application.
The code I use in the class is as follow:
package webservice;
import java.util.List;
import hibernateMapping.*;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class interfacciaImpl implements interfaccia {
private SessionFactory sessionFactory;
private Session session;
public Transaction creaSessione() {
sessionFactory = new
Configuration().configure().buildSessionFactory();
session = sessionFactory.openSession();
return session.beginTransaction();
}
public String esegui() {
String HQLQuery="select m.codMagazzino from Magazzino m";
List<?> a = null;
Transaction tx = creaSessione();
if(!session.isOpen())
session = sessionFactory.openSession();
try {
//tx = session.beginTransaction();
Query q = session.createQuery(HQLQuery);
a = q.list();
tx.commit();
// return a;
}
catch (HibernateException he) {
if (tx!=null)
tx.rollback();
System.out.println("Exception : " + he);
// return null;
}
Magazzino mag =new Magazzino();
mag=(Magazzino) a.get(0);
String esito=mag.getCodMagazzino().toString();
return esito;
}
}
Hoping some of you could fine an answer.
Greetings
Marco Piccinni