SQLGrammarException with JBoss 4.0.3 SP1, MySQL 4.1.13
schacky Jan 27, 2006 9:41 AMHallo,
we have a problem creating tables using JBoss 4.0.3 SP1, MySQL 4.1.13 on Solaris .
Following exception occurs
Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
at $Proxy0.createStatus(Unknown Source)
at testclient.TestClient.createStatus(TestClient.java:124)
at testclient.TestClient.(TestClient.java:62)
at testclient.TestClient.main(TestClient.java:47)
Caused by: java.lang.ClassNotFoundException: org.hibernate.exception.SQLGrammarE
xception
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at java.io.ObjectInputStream.resolveClass(ObjectInputStream.java:574)
at org.jboss.remoting.loading.ObjectInputStreamWithClassLoader.resolveCl
ass(ObjectInputStreamWithClassLoader.java:102)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:153
8)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
693)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:19
12)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:19
12)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
713)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read
(SerializableUnMarshaller.java:73)
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(Soc
ketClientInvoker.java:242)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.jav
a:112)
at org.jboss.remoting.Client.invoke(Client.java:226)
at org.jboss.remoting.Client.invoke(Client.java:189)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemot
eInterceptor.java:41)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:98)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPr
opagationInterceptor.java:46)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:98)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityC
lientInterceptor.java:40)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:98)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.
java:41)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.
java:98)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteP
roxy.java:88)
... 4 more
Source of the called funktion
public int createStatus(StatusAdapter adapter) {
Query query = em.createQuery("SELECT OBJECT(s) FROM Status s WHERE s.name=?1")
.setParameter(1, adapter.getName())
.setMaxResults(1);
if (query.getResultList().size()>0) return JBFinals.STATUS_NAM_ERR;
Status status = new Status();
status.setName(adapter.getName());
em.persist(status);
adapter.setId(status.getId());
return JBFinals.PERSIST_OK;
}
Configuration in the persistence.xml file
<?xml version="1.0" encoding="UTF-8"?>
<entity-manager>
JobBoerseEM
org.hibernate.ejb.HibernatePersistence
<jta-data-source>java:/MySqlDS</jta-data-source>
... jbserver.jbbusiness.jbpersistence.Status
...
<!--create-drop--><!--org.hibernate.dialect.MySQLDialect-->
</entity-manager>
It is quite urgent to solve the problem and we have no idea.
Regards, schacky !