EJB 3.0 client problem
here is my Entity class :
package com.azry.employee;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity
@TableGenerator(name = "EMP_GENERATOR",
table = "EMPLOYEE",
pkColumnName = "EMPLOYEE_ID",
pkColumnValue = "EMPLOYEE_ID",
allocationSize = 10)
@Table(name = "EMPLOYEE")
public class Employee implements java.io.Serializable {
private int id;
private String name;
private String email;
private int money;
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "EMP_GENERATOR")
public int getId() {
return id;
public void setId(int id) {
this.id = id;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public String getEmail() {
return email;
public void setEmail(String email) {
this.email = email;
public int getMoney() {
return money;
public void setMoney(int money) {
this.money = money;
}i also have created database EmployeeDB in mysql and have also mysql-ds.xml :
and also have a client class:
package com.azry.employee.clients;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import com.azry.employee.*;
public class Client {
public static void main(String[] args) {
try {
Context jndContext=getInitialContext();
Object ref=jndContext.lookup("EmployeeSession/remote");
EmployeeRemote rem=(EmployeeRemote)PortableRemoteObject.narrow(ref,EmployeeRemote.class);
Employee emp=new Employee();
// emp.setId(1);
emp.setMoney(1000);
emp.setName("david");
emp.setEmail("email");
rem.insert(emp);
catch(Exception ex) {
ex.printStackTrace();
private static Context getInitialContext()throws NamingException{
Properties p=new Properties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
return new InitialContext(p);
}i also have remote interface and session bean that overrides remote interface but the real problem is that when i run server everything goes well but when i run client exception occurs :
javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get or update next value
at com.azry.employee.clients.Client.main(Client.java:24)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get or update next value
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:182)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:173)
Caused by: org.hibernate.exception.SQLGrammarException: could not get or update next value
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.engine.TransactionHelper$1Work.doWork(TransactionHelper.java:41)
at org.hibernate.engine.transaction.Isolater$JtaDelegate.delegateWork(Isolater.java:106)
at org.hibernate.engine.transaction.Isolater.doIsolatedWork(Isolater.java:40)
at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:51)
at org.hibernate.id.MultipleHiLoPerTableGenerator.generate(MultipleHiLoPerTableGenerator.java:191)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
... 37 more
can anyone tell me what i am doing wrong?_
here is my Entity class :
package com.azry.employee;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
@Entity
@TableGenerator(name = "EMP_GENERATOR",
table = "EMPLOYEE",
pkColumnName = "EMPLOYEE_ID",
pkColumnValue = "EMPLOYEE_ID",
allocationSize = 10)
@Table(name = "EMPLOYEE")
public class Employee implements java.io.Serializable {
private int id;
private String name;
private String email;
private int money;
@Id
@GeneratedValue(strategy = GenerationType.TABLE, generator = "EMP_GENERATOR")
public int getId() {
return id;
public void setId(int id) {
this.id = id;
public String getName() {
return name;
public void setName(String name) {
this.name = name;
public String getEmail() {
return email;
public void setEmail(String email) {
this.email = email;
public int getMoney() {
return money;
public void setMoney(int money) {
this.money = money;
}i also have created database EmployeeDB in mysql and have also mysql-ds.xml :
and also have a client class:
package com.azry.employee.clients;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import com.azry.employee.*;
public class Client {
public static void main(String[] args) {
try {
Context jndContext=getInitialContext();
Object ref=jndContext.lookup("EmployeeSession/remote");
EmployeeRemote rem=(EmployeeRemote)PortableRemoteObject.narrow(ref,EmployeeRemote.class);
Employee emp=new Employee();
// emp.setId(1);
emp.setMoney(1000);
emp.setName("david");
emp.setEmail("email");
rem.insert(emp);
catch(Exception ex) {
ex.printStackTrace();
private static Context getInitialContext()throws NamingException{
Properties p=new Properties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
return new InitialContext(p);
}i also have remote interface and session bean that overrides remote interface but the real problem is that when i run server everything goes well but when i run client exception occurs :
javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get or update next value
at com.azry.employee.clients.Client.main(Client.java:24)
Caused by: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not get or update next value
at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
at org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:182)
at org.jboss.remoting.transport.socket.ServerThread.run(ServerThread.java:173)
Caused by: org.hibernate.exception.SQLGrammarException: could not get or update next value
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.engine.TransactionHelper$1Work.doWork(TransactionHelper.java:41)
at org.hibernate.engine.transaction.Isolater$JtaDelegate.delegateWork(Isolater.java:106)
at org.hibernate.engine.transaction.Isolater.doIsolatedWork(Isolater.java:40)
at org.hibernate.engine.TransactionHelper.doWorkInNewTransaction(TransactionHelper.java:51)
at org.hibernate.id.MultipleHiLoPerTableGenerator.generate(MultipleHiLoPerTableGenerator.java:191)
at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:99)
at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
... 37 more
can anyone tell me what i am doing wrong?_
Similar Messages
-
EJB Entity transaction rollback problem
Hello,
I have created 2 beans one is a Stateless Session and the other a Bean Managed Entity Bean. The SS Bean has methods to retrieve an Oracle Connection from a DataSource defined connection pool, and to close a connection. The entity bean I have created is responsible for insterting a new record into one of the tables in my database.
I have a client app that calls the ejbCreate method on the entity bean at which point the Entity EJB takes control, gets a valid connection from the SS EJB, runs a simple working SQL SELECT statement (obtaining correct values), and then attempts to perform an insert into a table using a prepared statement. My problem is that the application runs fine without any errors and all calls are made and all calls seem to be working fine. I have checked to make sure that the Datasource I am using is AutoCommit= false and it is and there are no exceptions being thrown in my EJB's but yet it appears as though the SQL statements executeUpdate() command is not being committed as their is no rows created in the database. Does anyone know what I may be doing wrong. I have all ACL parameters set up correctly and as I stated before the entire app runs without errors and I do have a SELECT statment that is working properly within the same method as the INSERT statement which is not!!! Please send any suggestions!!
Justin
I am using CMT, it is activated by default on Entity Beans I believe. The bean itself is marked as TX_REQUIRED so I believe all the methods automatically are all TX_REQUIRED.
Here is my Bean ejbCreate Method, My PK class, and my ejb-jar.xml file-- I've pasted them below for convenience.
ejbCreate:
public CustomerPK ejbCreate(String aUserName, String aPassword, String aFirstName,
String aMiddleInit, String aLastName, String aEmailAddr)
throws javax.ejb.CreateException {
Connection conn=null;
long nextPrsnID;
long nextCustID;
if (verifyParams(aUserName, aPassword, aFirstName, aMiddleInit,
aLastName, aEmailAddr)) {
if (isUniqueUserName(aUserName)) {
try {
conn=getConnection();
conn.setAutoCommit(false);
nextPrsnID=addPerson(conn,aFirstName,aMiddleInit,aLastName); // adds a person to the person table consists of just simple SQL
nextCustID=addCustomer(conn,nextPrsnID, aUserName,aPassword, aEmailAddr); //adds a customer to the customer table
// SET THE BEAN MANAGED PUBLIC VARIABLES
this.userName=aUserName;
this.password=aPassword;
this.firstName=aFirstName;
this.middleInit=aMiddleInit;
this.lastName=aLastName;
this.emailAddr=aEmailAddr;
this.personID=nextPrsnID;
this.custID=nextCustID;
conn.commit(); // with this statement here the transaction goes through otherwise the DB will not be updated
catch (Exception e){
throw new javax.ejb.CreateException("Experiencing Database Problems-- Unrecoverable Error"); // rollback transaction
finally{
cleanup(conn,null); // close the connection
else { // UserName already exists
throw new javax.ejb.CreateException("Sorry username already exists please choose another one");
else { // Registration parameters were not verifiable
throw new javax.ejb.CreateException("Registration paramater rules were violated");
CustomerPK custPK=new CustomerPK(nextCustID);
return custPK;
EJB CUSTOMER PRIMARY KEY CLASS:
public class CustomerPK implements java.io.Serializable {
// PRIMARY KEY VARIABLES
public long CustomerID;
public CustomerPK(long aCustomerID) {
this.CustomerID=aCustomerID;
public CustomerPK() {
public String toString(){
return ((new Long(CustomerID)).toString());
public boolean equals(Object aComparePK){
if (this.CustomerID==((CustomerPK)aComparePK).CustomerID){
return true;
return false;
public int hashCode(){
return ((new Long(CustomerID).toString()).hashCode());
} // END-CLASS
CUSTOMER ejb-jar.xml
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<entity>
<ejb-name>Customer</ejb-name>
<home>CustomerHome</home>
<remote>Customer</remote>
<ejb-class>CustomerBean</ejb-class>
<persistence-type>Bean</persistence-type>
<prim-key-class>CustomerPK</prim-key-class>
<reentrant>False</reentrant>
<resource-ref>
<res-ref-name>jdbc/DeveloperPool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</entity>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>Customer</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
"Cameron Purdy" <[email protected]> wrote:
>Are you using CMT? Have you marked the methods as REQUIRED?
>
>Peace,
>
>--
>Cameron Purdy
>Tangosol, Inc.
>http://www.tangosol.com
>+1.617.623.5782
>WebLogic Consulting Available
>
>
>"Justin Jose" <[email protected]> wrote in message
>news:[email protected]...
>>
>> Hello,
>>
>> I have created 2 beans one is a Stateless Session and the other a Bean
>Managed Entity Bean. The SS Bean has methods to retrieve an Oracle
>Connection from a DataSource defined connection pool, and to close a
>connection. The entity bean I have created is responsible for insterting a
>new record into one of the tables in my database.
>> I have a client app that calls the ejbCreate method on the entity bean at
>which point the Entity EJB takes control, gets a valid connection from the
>SS EJB, runs a simple working SQL SELECT statement (obtaining correct
>values), and then attempts to perform an insert into a table using a
>prepared statement. My problem is that the application runs fine without
>any errors and all calls are made and all calls seem to be working fine. I
>have checked to make sure that the Datasource I am using is AutoCommit=
>false and it is and there are no exceptions being thrown in my EJB's but yet
>it appears as though the SQL statements executeUpdate() command is not being
>committed as their is no rows created in the database. Does anyone know
>what I may be doing wrong. I have all ACL parameters set up correctly and
>as I stated before the entire app runs without errors and I do have a SELECT
>statment that is working properly within the same method as the INSERT
>statement which is not!!! Please send any suggestions!!
>>
>> Justin
>
>
-
Error while running EJB from java client on JBOSS
Hi
As i am new to EJB i have created a helloworld application in ejb which is working fine when i try to call it from servlet but when i try to invoke the same ejb from java client (i.e from diff jvm) on jboss i got the following error:
javax.naming.CommunicationException: Could not obtain connection to any of these urls: localhost:1099 and discovery failed with error: javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out] [Root exception is javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]]
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1399)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:579)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at com.gl.TestClient.main(TestClient.java:39)
Caused by: javax.naming.CommunicationException: Failed to connect to server localhost:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:254)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1370)
... 4 more
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server localhost:1099 [Root exception is java.net.ConnectException: Connection refused]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:228)
... 5 more
Caused by: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at java.net.Socket.<init>(Socket.java:366)
at java.net.Socket.<init>(Socket.java:266)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:69)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:224)
... 5 more
Following is my code:
Home Interface:
package com.gl;
import javax.ejb.CreateException;
public interface testHome extends EJBHome {
String JNDI_NAME = "testBean";
public test create()
throws java.rmi.RemoteException,CreateException;
Remote Interface:
package com.gl;
import java.rmi.RemoteException;
import javax.ejb.EJBObject;
public interface test extends EJBObject {
public String welcomeMessage() throws RemoteException;
Bean:
package com.gl;
import java.rmi.RemoteException;
import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;
public class testbean implements SessionBean {
public void ejbActivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
public void ejbPassivate() throws EJBException, RemoteException {
// TODO Auto-generated method stub
public void ejbRemove() throws EJBException, RemoteException {
// TODO Auto-generated method stub
public void setSessionContext(SessionContext arg0) throws EJBException,
RemoteException {
// TODO Auto-generated method stub
public void ejbCreate(){}
public String welcomeMessage(){
return "Welcome to the World of EJB";
ejb-jar.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>testBean</ejb-name>
<home>com.gl.testHome</home>
<remote>com.gl.test</remote>
<ejb-class>com.gl.testbean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
jboss.xml:
<?xml version='1.0' ?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 3.2//EN" "http://www.jboss.org/j2ee/dtd/jboss_3_2.dtd">
<jboss>
<enterprise-beans>
<entity>
<ejb-name>testBean</ejb-name>
<jndi-name>testBean</jndi-name>
</entity>
</enterprise-beans>
</jboss>
Client code:
package com.gl;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
public class TestClient {
public static void main(String[] args) throws Exception{
try{
/* Properties props=new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
props.put(Context.PROVIDER_URL, "localhost:1099");
System.out.println("Properties ok");
//env.setProperty(Context.INITIAL_CONTEXT_FACTORY,"org.jboss.naming.HttpNamingContextFactory");
//env.put(Context.PROVIDER_URL,"http://localhost:8080");
//env.put(Context.SECURITY_PRINCIPAL, "");
//env.put(Context.SECURITY_CREDENTIALS, "");
Context ctx=new InitialContext(props);
System.out.println("context ok");
//testHome home = (testHome)ctx.lookup("testBean");
Object obj = ctx.lookup ("testBean");
System.out.println("ojb = " + obj);
testHome ejbHome = (testHome)PortableRemoteObject.narrow(obj,testHome.class);
test ejbObject = ejbHome.create();
String message = ejbObject.welcomeMessage();
System.out.println("home ok");
System.out.println("remote ok");
System.out.println(message);
catch(Exception e){e.printStackTrace();}
I am able to successfully deployed my ejb on JBOSS but i m getting above error when i am trying to invoke ejb from java client.
kindly suggest me something to solve this issue.
Regards
Gagan
Edited by: Gagan2914 on Aug 26, 2008 3:28 AMIs it a remote lookup? Then maybe this will help:
[http://wiki.jboss.org/wiki/JBoss42FAQ]
- Roy -
Test web service proxy using EJB session bean client...
Hello!
I am following this blog /people/abdelmorhit.elrhazi/blog/2009/10/30/how-to-consume-an-inbound-backend-web-service-in-nwdsjboss-environment to create a EJB session bean client to access the web service proxy...
The blog is not very clear. Where should I be deploying the web service proxy and the EJB session bean (web service client) ? on the PI 7.1 ?
How to find out the URL for the wsdl ?
Thanks> The blog is not very clear. Where should I be deploying the web service proxy and the EJB session bean (web service client) ? on the PI 7.1 ?
"To deploy your web service proxy and session bean, right click on your JBoss server in the Servers view, and click on Add Remove Projects, add you ear file and click finish."
You need a JBoss server. -
Question on EJB, JNDI and client jars
Hi,
This is a very fundamental question on EJBs and their clients - what
all should go into the client jar of an ejb?
I know for sure that just the remote and home interface classes of the
ejb are sufficient on the client's classpath to work with an EJB on a
totally different server, but I dont understand the logic behind it.
If the client has to pass its object parameters over the network to
the server where the ejb bean is located, should the container
generated stub not be present on the client's classpath? After the
client does the JNDI lookup of the ejb home on the server, how does it
serialize and pass the parameters over the network if the container
generated stub is not present?
Any help would be greatly appreciated. Pointers to material on the
internet which explain this/related things in detail would be a great
help.
Thank you,
Anoushka"Anoushka" <[email protected]> writes:
I know for sure that just the remote and home interface classes of the
ejb are sufficient on the client's classpath to work with an EJB on a
totally different server, but I dont understand the logic behind it.
If the client has to pass its object parameters over the network to
the server where the ejb bean is located, should the container
generated stub not be present on the client's classpath? After the
client does the JNDI lookup of the ejb home on the server, how does it
serialize and pass the parameters over the network if the container
generated stub is not present?Most protocols (IIOP, T3, JRMP) provide a slot for encoding a codebase
in RMI requests. The codebase is usually an http URL that specifies
where to get classes that are not currently available to the
client. This URL is used to construct a java.net.URLClassLoader which
then downloads classes on demand. These classes can include stubs,
object arguments - pretty much anything you like. There are certain
security restrictions on the URLClassLoader which is why you sometimes
have to specifiy a security manager in a client. T3 will for
preference generate stubs in the client rather than download them,
however this is not allowed in an applet - and so in this case T3 will
also download stubs from the server.
The net of this is that you don't have to put very much at all in a
client jar UNLESS you can't use the URLClassLoader. In that instance
you have to put EVERYTHING you need in the client jar.
HTH
andy -
Hi everybody,
I'm trying to program and run the simplest of EJB 3.0/Client examples using NB 5.5/Enterprise Pack 200612... . I've got a stateless session bean that contains one method which is exposed to the client via the remote interface. I've also created an EJB client, that has a reference to said EJB. When I try to call a method of the SSB, I end up with a NullPointerException. This applies to both trying to start the client from within NB or the command line. Can someone provide a solution? All classes have been created using the NB wizards, yet I can't get this simple example to work. The tutorial, unfortunately doesn't provide an example for creating an EJB client using NB. All relevant sources are attached.
Thanks, Michael
package example;
import javax.ejb.Stateless;
@Stateless
public class CurrencyCalculatorBean implements CurrencyCalculatorRemote {
/** Creates a new instance of CurrencyCalculatorBean */
public CurrencyCalculatorBean() {
public double calculate(double amount, double exchangeRate) {
return amount * exchangeRate;
package example;
import javax.ejb.Remote;
@Remote
public interface CurrencyCalculatorRemote {
public double calculate(double amount, double exchangeRate);
import javax.ejb.EJB;
import example.CurrencyCalculatorRemote;
public class Client {
@EJB
private static CurrencyCalculatorRemote currencyCalculatorBean;
/** Creates a new instance of Client */
public Client() {
* @param args the command line arguments
public static void main(String[] args) {
System.out.println("Calling EJB");
System.out.println(currencyCalculatorBean.calculate(0, 0));
}This kind of client is a Java EE component called an "Application Client". It needs to be run
using an Application Client container, otherwise injection will not take place.
In the Java EE SDK / Glassfish, the command to run an Application Client is called "appclient".
I don't know what the GUI option within NetBeans is for invoking your client using the appclient
command. However, you can invoke it explicitly from the command-line.
There's an example here that shows the difference betweeen an Application Client and
a plain java client :
https://glassfish.dev.java.net/javaee5/ejb/examples/Sless.html
The build.xml shows how the Application Client is invoked.
--ken -
I unable to run ejb with application client using oc4j j2ee container
Hi,
I have installe oracle9i (1.0.2.2) oc4j j2ee container.
I unable to run the ejbs . please help me how to run ejbs with application client and which files are shall configure.
See the client application is :
public static void main (String []args)
try {
//Hashtable env = new Hashtable();
//env.put("java.naming.provider.url", "ormi://localhost/Demo");
//env.put("java.naming.factory.initial", "com.evermind.server.ApplicationClientInitialContextFactory");
//env.put(Context.SECURITY_PRINCIPAL, "guest");
//env.put(Context.SECURITY_CREDENTIALS, "welcome");
//Context ic = new InitialContext (env);
System.out.println("\nBegin statelesssession DemoClient.\n");
Context context = new InitialContext();
Object homeObject = context.lookup("java:comp/env/DemoApplication");
DemoHome home= (DemoHome)PortableRemoteObject.narrow(homeObject, DemoHome.class);
System.out.println("Creating Demo\n");
Demo demo = home.create();
System.out.println("The result of demoSelect() is.. " +demo.sayHello());
}catch ( Exception e )
System.out.println("::::::Error:::::: ");
e.printStackTrace();
System.out.println("End DemoClient....\n");
When I am running client application I got this type of Exception
java.lang.SecurityException : No such domain/application: sampledemo
at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java : 2040)
at com.evermind.server.rmi.RMIConnection.connect(RMIConnection.java : 1884)
at com.evermind.server.rmi.RMIConnection.lookup(RMIConnection.java : 1491)
at com.evermind.server.rmi.RMIServer.lookup(RMIServer.java : 323)
at com.evermind.server.rmi.RMIContext.lookup(RMIConext.java : 106)
at com.evermind.server.administration.LazyResourceFinder.lookup(LazyResourceFinder.java : 59)
at com.evermind.server.administration.LazyResourceFinder.getEJBHome(LazyResourceFinder.java : 26)
at com.evermind.server.Application.createContext(Application.java: 653)
at com.evermind.server.ApplicationClientInitialContext.getInitialContext(ApplicationClientInitialContextFactory.java :179 )
at javax.naming.spi.NamingManager.getInitialContext(NamingManger.java : 246)
at javax.naming.InitialContext.getDefaultInitialCtx(InitialContext.java : 246)
at javax.naming.InitialContext.init(InitialContext.java : 222)
at javax.naming.InitialContext.<init>(InitialContext.java : 178)
at DemoClient.main(DemoClient.java : 23)
.ear file is copied into applications directory.
I have configured server.xml file like this
<application name="sampledemo" path="../applications/demos.ear" />
demos.ear file Contains following files
application.xml
demobean.jar
Manifest.mf
demobean.jar file contains following files
application-client.xml
Demo.class
DemoBean.class
DemoHome.class
ejb-jar.xml
jndi.properties
Mainifest.mf
Please give me your valuable suggestions. Which are shall i configure .
Thanks & Regards,
BadriHi Badri,
ApplicationClientInitialContextFactory is for clients which got deployed inside OC4J container..
For looking up EJB from a stand alone java client please use RMIInitialContextFactory..So please change ur code....
Also please check ur server.xml
Since you have specified your ejb domain as "sampledemo"
you have to use that domian only for look up..But it seems that you are looking up for "Demo" domain instead of "sampledemo" domain...So change your code to reflect that..
Code snippet for the same is :
Hashtable env = new Hashtable();
env.put("java.naming.provider.url", "ormi://localhost/sampledemo");
env.put("java.naming.factory.initial", "om.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "guest");
env.put(Context.SECURITY_CREDENTIALS, "welcome");
Context ic = new InitialContext (env);
Hope this helps
--Venky -
Fundamental question on EJB, JNDI and client jars
Hi,
This is a very fundamental question on EJBs and their clients - what
all should go into the client jar of an ejb?
I know for sure that just the remote and home interface classes of the
ejb are sufficient on the client's classpath to work with an EJB on a
totally different server, but I dont understand the logic behind it.
If the client has to pass its object parameters over the network to
the server where the ejb bean is located, should the container
generated stub not be present on the client's classpath? After the
client does the JNDI lookup of the ejb home on the server, how does it
serialize and pass the parameters over the network if the container
generated stub is not present?
Any help would be greatly appreciated. Pointers to material on the
internet which explain this/related things in detail would be a great
help.
Thank you,
Anoushkahello,
well, the process is fairly simple actually.. The client needn't necessarily have
the container generated stub. as a client u could contact what is known as a boot-strap
service to download the stub over the wire.. infact one of the advantages of RMI
is precisely that. and since RMI is the underlying architecture of EJBs, it all
becomes rather simple. when u 'lookup' a bean, what u are in essence doing is
asking the server to send down the stub to your JVM. well.. right now this is
what i got time for..i will try to post a lengthier explanation in a couple of
days at leisure..
Vijay
"Anoushka" <[email protected]> wrote:
>
Hi,
This is a very fundamental question on EJBs and their clients - what
all should go into the client jar of an ejb?
I know for sure that just the remote and home interface classes of the
ejb are sufficient on the client's classpath to work with an EJB on a
totally different server, but I dont understand the logic behind it.
If the client has to pass its object parameters over the network to
the server where the ejb bean is located, should the container
generated stub not be present on the client's classpath? After the
client does the JNDI lookup of the ejb home on the server, how does it
serialize and pass the parameters over the network if the container
generated stub is not present?
Any help would be greatly appreciated. Pointers to material on the
internet which explain this/related things in detail would be a great
help.
Thank you,
Anoushka -
New with 10.5 Server client problems finding files
I have some client problems searching for files (not via Spotlight, via our own program that uses PBCatSearch) that started with installation of OS X Server 10.5.
I convinced myself earlier today that Open Directory was the culprit so I posted in the Open Directory forum, but I'm still having the issues now with OD out of the picture. Can anyone following this forum comment on my post?
http://discussions.apple.com/thread.jspa?threadID=1779541&tstart=0Tonight we tried a test to see if it was possible the files were somehow getting "locked" by one client so that another couldn't access the files it was looking for.
We restarted AFP then went connected one client and did our test, the first client succeeded. Then we connected the next client, did the test and it failed. Then we tried a third client, it succeeded.
Then we restarted AFP again and tried a different order of clients. In the three rounds we did it was always the second client that ran the test that failed.
Is it possible that Leopard server is more strict with multiple clients accessing the same files than Tiger server was? -
Hello, everybody,
I'm very new at EJB and I'm trying to learn it.
I have created Enterprise Application using Netbeans IDE, I have EJB and APP client. What I want is to connect to my MySql database and get some info from table.
For e.g. Login and Password.
How can I call EJB from my client app which connects to my database and gets information I need?What server you are using?
if you use jboss AS ,here is a simple Main class how to connect EJB and access ejb methods:
package com.david.ejb.client;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;
import com.david.ejb.domain.Person;
import com.david.ejb.domain.PersonRemote;
public class Main {
public static void main(String[] args) {
try {
Context ctx = getInitialContext();
Object obj = ctx.lookup("PersonSessionRemote/remote");
PersonRemote pr=(PersonRemote)PortableRemoteObject.narrow(obj, PersonRemote.class);
Person p=new Person();
p.setName("david");
pr.addPerson(p);
pr.findPerson(1);
// System.out.print(br.find(pk).getAuthor_name());
} catch (Exception ex) {
ex.printStackTrace();
private static Context getInitialContext() throws NamingException {
Properties p = new Properties();
p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
p.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
return new InitialContext(p);
}Person is ant @Entity and PersonRemote is remote interfaces, to connect database you have to make datasource file at jboss-4.2.3.GA\server\default\deploy
simle mysql-ds.xml looks like this:
datasources>
<local-tx-datasource>
<jndi-name>some name</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>root</user-name>
<password>root password</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<idle-timeout-minutes>15</idle-timeout-minutes>
<exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
<valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
</local-tx-datasource>
</datasources>also at resources/META-INF directory you must have persistence.xml like this
<persistence>
<persistence-unit name="SimpleEjb">
<jta-data-source>java:/some name</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update" />
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.format_sql" value="true"/>
</properties>
</persistence-unit>
</persistence> -
Using JDev 10g I create an EJB and a test client for it. Everything is fine.
However when I try to run the client outside of JDeveloper (deployed to a jar file) I get
java -jar client.jar
java.lang.NoClassDefFoundError: javax/management/MBeanRegistrationException
at com.evermind.server.ThreadState.getCurrentState(ThreadState.java:206)
at com.evermind.server.rmi.RMIConnection.checkServletCaller(RMIConnection.java:3336)
at com.evermind.server.rmi.RMIConnection.<init>(RMIConnection.java:181)
at com.evermind.server.rmi.RMIServer.addNode(RMIServer.java:858)
at com.evermind.server.rmi.RMIServer.getConnection(RMIServer.java:923)
at com.evermind.server.rmi.RMIInitialContextFactory.getInitialContext(RMIInitialContextFactory.java:30
9)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:662)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:243)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at buslogic.MemberSearchEJBClient.getInitialContext(MemberSearchEJBClient.java:60)
at buslogic.MemberSearchEJBClient.main(MemberSearchEJBClient.java:22)Looks like the classpath doesn't have the jar which contains MBeanRegistrationException class.
Make sure the jar file (looks like jmxri.jar has it) containing is part of the classpath used by the client application.
raghu
JDev Team -
EJB 3.0 deployment problem
I just started learning EJB3.0. I created a slsb application very similar to the converter available in the tutorial sample. However when i build and deploy the app I am getting this error ->This application client has no ejb refernce by the name simpleSessionRemote. This happens when I have app-client jar inside the ear. For only jar and war inside the ear there is no deployement problems. I am using NetBeans 5.5 and Sun App server. Anyone has come across similar issue?
How are you looking up the remote ejb dependency in the app client -- via @EJB or InitialContext()?
Please post the source code for the app client, the full error message/stack trace, and any of the following files that exist in the .ear : sun-ejb-jar.xml, application-client.xml, sun-application-client.xml, ejb-jar.xml .
--ken -
Ejb wl5.1 client talking to ejb wl6.1 server?
I have a session ejb running in wl 5.1 that must act as a client of a wl6.1
ejb (wl 6.1 running on another host). Since the RMI layer is incompatible
between 5.1 and 6.1 I must jump through some hoops to get this to work. I've
considered packaging the wl6.1 classes together with the 6.1 client classes
in a separate jar, along with a helper class to use a separate classloader
to load classes from that jar (in the hopes of keeping the common rmi
classes in a separate namespace). Does this sound like the best approach?
Has anyone else faced this problem? What other solutions are there?
Thanks. - MilesYou can use direct socket communication (custom impl) or URLs to do
web-service style integration.
Peace,
Cameron Purdy
Tangosol, Inc.
Clustering Weblogic? You're either using Coherence, or you should be!
Download a Tangosol Coherence eval today at http://www.tangosol.com/
"Miles Krivoshia" <[email protected]> wrote in message
news:[email protected]..
I have a session ejb running in wl 5.1 that must act as a client of awl6.1
ejb (wl 6.1 running on another host). Since the RMI layer is incompatible
between 5.1 and 6.1 I must jump through some hoops to get this to work.I've
considered packaging the wl6.1 classes together with the 6.1 clientclasses
in a separate jar, along with a helper class to use a separate classloader
to load classes from that jar (in the hopes of keeping the common rmi
classes in a separate namespace). Does this sound like the best approach?
Has anyone else faced this problem? What other solutions are there?
Thanks. - Miles -
I modified the EchoDom example (http://webservice.bea.com/dom.zip) client to be
dynamic (with WSDL) and deployed the service as a document type service. The ear
file is deployed correctly and I am able to execute the service from the URL without
any errors. However when I run the dynamic client, I see the following exception
trace. I see a similar error (serialization fails on class weblogic.apache.xerces.dom.DocumentImpl)
when I deploy the service as rpc. What am I doing incorrectly? Please help.
Sriram
run:
[java] javax.xml.rpc.JAXRPCException: failed to invoke operation 'echoDom
' due to an error in the soap layer (SAAJ); nested exception is: Message[ failed
to serialize interface javax.xml.soap.SOAPElementweblogic.xml.schema.binding.Se
rializationException: mapping lookup failure. class=interface javax.xml.soap.SOA
PElement class context=TypedClassContext{schemaType=['http://examples.org']:echo
Dom}]StackTrace[
[java]
[java] javax.xml.soap.SOAPException: failed to serialize interface javax.x
ml.soap.SOAPElementweblogic.xml.schema.binding.SerializationException: mapping
l
ookup failure. class=interface javax.xml.soap.SOAPElement class context=TypedCla
ssContext{schemaType=['http://examples.org']:echoDom}
[java] at weblogic.webservice.core.DefaultPart.invokeSerializer(Default
Part.java:328)
[java] at weblogic.webservice.core.DefaultPart.toXML(DefaultPart.java:2
97)
[java] at weblogic.webservice.core.DefaultMessage.toXML(DefaultMessage.
java:619)
[java] at weblogic.webservice.core.ClientDispatcher.send(ClientDispatch
er.java:206)
[java] at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDisp
atcher.java:143)
[java] at weblogic.webservice.core.DefaultOperation.invoke(DefaultOpera
tion.java:444)
[java] at weblogic.webservice.core.DefaultOperation.invoke(DefaultOpera
tion.java:430)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:53
9)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:39
2)
[java] at examples.dom.Client.diiCall(Client.java:132)
[java] at examples.dom.Client.main(Client.java:164)
[java] Caused by: weblogic.xml.schema.binding.SerializationException: mappi
ng lookup failure. class=interface javax.xml.soap.SOAPElement class context=Type
dClassContext{schemaType=['http://examples.org']:echoDom}
[java] at weblogic.xml.schema.binding.RuntimeUtils.lookup_serializer(Ru
ntimeUtils.java:151)
[java] at weblogic.xml.schema.binding.RuntimeUtils.invoke_serializer(Ru
ntimeUtils.java:187)
[java] at weblogic.xml.schema.binding.RuntimeUtils.invoke_serializer(Ru
ntimeUtils.java:174)
[java] at weblogic.webservice.core.DefaultPart.invokeSerializer(Default
Part.java:324)
[java] ... 10 more
[java] ]
[java]
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:55
9)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:39
2)
[java] at examples.dom.Client.diiCall(Client.java:132)
[java] at examples.dom.Client.main(Client.java:164)
[java] Exception in thread "main"
[java] Java Result: 1Hi Bruce,
I made the changes that you suggested. It didn't work. I still see the same deserialization
exception.
Sriram
Bruce Stephens <[email protected]> wrote:
Hi,
Try this format in your dynamic client:
call.setProperty("javax.xml.rpc.security.auth.username", "username");
call.setProperty("javax.xml.rpc.security.auth.password", "password");
HTHs,
Bruce
Sriram Chavali wrote:
If I had a weblogic security role enforcement in place for my WS EJB,how do I
pass the user credentials from a dynamic client? I set the USERNAME_PROPERTYand
PASSWORD_PROPERTY properties on the Call, but I see a deserializationerror on
the response and the SOAPElement interface.
A static client works fine when I pass the user credentials from thegetMyWSPort(String,
String) call.
Please help,
Sriram
"Sriram Chavali" <[email protected]> wrote:
Hi Bruce,
It worked perfectly.
Thanks for your help
Sriram
Bruce Stephens <[email protected]> wrote:
Hi Sriram,
OK, we are getting close. It looks like the problem is with the
helloComplexWorldResponse so looking at the client, I would change
the
invoke to look something like this:
String result = (String) call.invoke(new Object[] {doc});
If that still has problems, then try it without the return, i.e.make
it
a void return in the HelloWorldServiceEJB.java and go from there.
Regards,
Bruce
Sriram Chavali wrote:
Hi Brue,
Your example works fine for me. I am building an EJB implementationthat follows
your example where I see the error. The attached zip file has the
server
and client
(dynamic, which follows your example). The build file is build1.xml.
Thanks
Sriram
Bruce Stephens <[email protected]> wrote:
Hi Sriram,
hmmm...the sample I provided sends a Document with a dynamic client,
so
I'm confused as to where/why you are still seeing the same failure
as
the original post. Would you go back and look carefully at the
client
code (ClientHotelDyn.java) and note two important features:
1) adding the call.setProperty(Call.OPERATION_STYLE_PROPERTY,
"document");
2) adding the typemapping for the Document
If you are still experiencing problems, please post your codeand/or
open a dialog with our super support team: http://support.bea.com
or
[email protected]
Thanks,
Bruce
Hi Bruce,
The consumers for the service that I am building will be non-java
clients.
I wish
to demonstrate a reference implementation for them without using
the
generated
client side classes and hence the dynamic client.
Thanks for your example code. It worked fine. Just to add a
twist
to
your latest
example, I modified sample10 from Manoj's website (an EJB example)to accept an
org.w3c.dom.Document. I took your build file and tailored it
to
building
the sample10
and it worked fine for a static client, however when I modified
the
client to
be dynamic, I see the trace pasted at the end of this message.
Any
suggestions
run:
[java] javax.xml.rpc.JAXRPCException: failed to invoke
operation
'helloComp
lexWorld' due to an error in the soap layer (SAAJ); nested exceptionis: Message
[failed to deserialize xml:weblogic.xml.schema.binding.DeserializationException:
mapping lookup failure for xml type ['http://www.bea.com/servers/wls70/samples/
examples/webservices/basic/javaclass']:helloComplexWorldResponse
and
java interf
ace javax.xml.soap.SOAPElement]StackTrace[
[java]
[java] javax.xml.soap.SOAPException: failed to deserialize
xml:weblogic.xml
schema.binding.DeserializationException: mapping lookup failurefor
xml type
http://www.bea.com/servers/wls70/samples/examples/webservices/basic/javaclass']:
helloComplexWorldResponse and java interface javax.xml.soap.SOAPElement
[java] at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:
389)
[java] at weblogic.webservice.core.DefaultMessage.toJava(DefaultMessage
java:458)
[java] at weblogic.webservice.core.ClientDispatcher.receive(ClientDispa
tcher.java:297)
[java] at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDisp
atcher.java:144)
[java] at weblogic.webservice.core.DefaultOperation.invoke(DefaultOpera
tion.java:444)
[java] at weblogic.webservice.core.DefaultOperation.invoke(DefaultOpera
tion.java:430)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:53
9)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:39
2)
[java] at tutorial.sample10.client.Main.<init>(Main.java:105)
[java] at tutorial.sample10.client.Main.main(Main.java:40)
[java] Caused by: weblogic.xml.schema.binding.DeserializationException:map
ping lookup failure for xml type ['http://www.bea.com/servers/wls70/samples/exam
ples/webservices/basic/javaclass']:helloComplexWorldResponse
and
java
interface
javax.xml.soap.SOAPElement
[java] at weblogic.xml.schema.binding.RuntimeUtils.invoke_deserializer(
RuntimeUtils.java:325)
[java] at weblogic.webservice.core.DefaultPart.toJava(DefaultPart.java:
384)
[java] ... 9 more
[java] ]
[java]
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:55
9)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:39
2)
[java] at tutorial.sample10.client.Main.<init>(Main.java:105)
[java] at tutorial.sample10.client.Main.main(Main.java:40)
BUILD SUCCESSFUL
Thanks
Sriram
Bruce Stephens <[email protected]> wrote:
Hi Sriram,
Give this example a spin and see if it fits your needs.
Just curious, why do you need to have a dynamic client?
Thanks,
Bruce
Sriram Chavali wrote:
I am using WLS 8.1 on Windows XP.
Sriram
"Sriram Chavali" <[email protected]> wrote:
I modified the EchoDom example (http://webservice.bea.com/dom.zip)
client
to be
dynamic (with WSDL) and deployed the service as a document
type
service.
The ear
file is deployed correctly and I am able to execute the
service
from
the URL without
any errors. However when I run the dynamic client, I see
the
following
exception
trace. I see a similar error (serialization fails on class
weblogic.apache.xerces.dom.DocumentImpl)
when I deploy the service as rpc. What am I doing incorrectly?Please
help.
Sriram
run:
[java] javax.xml.rpc.JAXRPCException: failed to invoke
operation
'echoDom
' due to an error in the soap layer (SAAJ); nested exceptionis:
Message[
failed
to serialize interface javax.xml.soap.SOAPElementweblogic.xml.schema.binding.Se
rializationException: mapping lookup failure. class=interface
javax.xml.soap.SOA
PElement class context=TypedClassContext{schemaType=['http://examples.org']:echo
Dom}]StackTrace[
[java]
[java] javax.xml.soap.SOAPException: failed to serializeinterface
javax.x
ml.soap.SOAPElementweblogic.xml.schema.binding.SerializationException:
mapping
l
ookup failure. class=interface javax.xml.soap.SOAPElement
class
context=TypedCla
ssContext{schemaType=['http://examples.org']:echoDom}
[java] at weblogic.webservice.core.DefaultPart.invokeSerializer(Default
Part.java:328)
[java] at weblogic.webservice.core.DefaultPart.toXML(DefaultPart.java:2
97)
[java] at weblogic.webservice.core.DefaultMessage.toXML(DefaultMessage.
java:619)
[java] at weblogic.webservice.core.ClientDispatcher.send(ClientDispatch
er.java:206)
[java] at weblogic.webservice.core.ClientDispatcher.dispatch(ClientDisp
atcher.java:143)
[java] at weblogic.webservice.core.DefaultOperation.invoke(DefaultOpera
tion.java:444)
[java] at weblogic.webservice.core.DefaultOperation.invoke(DefaultOpera
tion.java:430)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:53
9)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:39
2)
[java] at examples.dom.Client.diiCall(Client.java:132)
[java] at examples.dom.Client.main(Client.java:164)
[java] Caused by: weblogic.xml.schema.binding.SerializationException:
mappi
ng lookup failure. class=interface javax.xml.soap.SOAPElement
class
context=Type
dClassContext{schemaType=['http://examples.org']:echoDom}
[java] at weblogic.xml.schema.binding.RuntimeUtils.lookup_serializer(Ru
ntimeUtils.java:151)
[java] at weblogic.xml.schema.binding.RuntimeUtils.invoke_serializer(Ru
ntimeUtils.java:187)
[java] at weblogic.xml.schema.binding.RuntimeUtils.invoke_serializer(Ru
ntimeUtils.java:174)
[java] at weblogic.webservice.core.DefaultPart.invokeSerializer(Default
Part.java:324)
[java] ... 10 more
[java] ]
[java]
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:55
9)
[java] at weblogic.webservice.core.rpc.CallImpl.invoke(CallImpl.java:39
2)
[java] at examples.dom.Client.diiCall(Client.java:132)
[java] at examples.dom.Client.main(Client.java:164)
[java] Exception in thread "main"
[java] Java Result: 1
Name: sample10.zip
sample10.zip Type: Zip Compressed Data (application/x-zip-compressed)
Encoding: base64 -
Web service as another web service client - problem in JavaEE SE?
Hello,
I observed strange behaviour with OpenESB, Glassfish (build 33) and following scenario:
I need to call web service from another web service. When I use simple schema:
web service client -> web service (as EJB) -> another Web service
everything works. But I would like to use JBI/ESB, so:
web service client -> HTTP SOAP BC -> JAVAEE SE -> web service (as EJB) -> another Web service
the following exception prevents success:
com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class cz.muni.fi.yucca.client.jbiws.gamanager.Calculate is not fou
nd. Have you run APT to generate them?
at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:254)
at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:550)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:497)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:339)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:225)
at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:584)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:287)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:270)
at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:263)
at javax.xml.ws.Service.getPort(Service.java:92)
at cz.muni.fi.yucca.client.jbiws.gamanager.GAManagerService.getGAManagerPort(GAManagerService.java:51)
When I call both services separately they work correctly, when I don't use JBI it works correctly too.
Should anybody help me solving this problem?
Thanks in advice, VladoFine,
I've found out that this problem is caused by different classloaders assigned to directly (EJBClassloader) and through-JBI (improperly configured URLClassloader) called web services.
I've moved my question to GlassFish forum (http://forums.java.net/jive/thread.jspa?threadID=24901&tstart=0) beacause of it's "technical" nature.
Despite this, any help is welcome:-)
Maybe you are looking for
-
Hello, I changed my Imac hard drive which no longer worked. I installed a hard drive Western Digital 500 GB 7200 rpm SATA3 WD5002AALX 32M Black. Sometimes I see the hard disk in the utility on the Starter CD, but access seems very slow. By cons when
-
Error in Enhanced Receiver Determination - UDF
We have a requirement to determine the receivers of the message dynamically at runtime. From one of the blog I i got the how to do material. I have created the receivers according to age. <?xml version="1.0" encoding="UTF-8"?> <ns0:MT_Person xmlns:ns
-
Hello I just made the switch from PC to Mac and am expecting my new MacBook Pro to arrive tomorrow. I have enabled my iPod as a hard drive and backed up all the files I want to transfer on it. Once I have them on my new Mac how do I reformat the iPod
-
Is there a template for objects to include/exclude for backups/replication?
Hi, I was wondering anyone has a template posted somewhere of what IFS directories/files to include and/or exclude on backups and also for MIMIX replication(I assume they would be the same list). I could just exclude of les that error, but I would li
-
Popup box in an internet service
Hi, We are using SAP R3 version 4.6c.An internet service is already published on the web.My requirement is that a warning pop up comes up while entering some data through web in the internet service.I have done the relevant code changes and the pop u