Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6812301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:25:57+00:00 2026-05-26T20:25:57+00:00

I am new EJB framework and am in the process of learning it. I

  • 0

I am new EJB framework and am in the process of learning it. I am developing a standalone application using EJB3.1 on Eclipse IDE and Glassfish 3 as server. Below is the code snippet.

 @Remote
 public interface DataSourceRemote {
        public Connection getConnection();

    }

 @Stateless(mappedName="ejb/datasource") 
 public class DataSourceRemoteBean implements DataSourceRemote{

        @Resource(name="jdbc/datasourceDB")
        DataSource ds;

        public Connection getConnection() {

            try {

                return ds.getConnection();
            } catch (Exception e) {

                e.printStackTrace();
            }
            return null;
            }
        }

//My client code goes here
    public class Client {

        public static void main(String args[]) {

            try{
            InitialContext ctx = new InitialContext();
            DataSourceRemote bean =(DataSourceRemote)ctx.lookup("com.global.entities.DataSourceRemoteBean");                
                Connection conn = bean.getConnection();
                if(null==conn){
                    System.out.println("its null");
                }else{
                    System.out.println("connection established:"+conn.toString());
                }
            }catch (Exception e) {
                e.printStackTrace();
            }
        }
   }

When ever I try to do a JNDI look up for jdbc/datasourceDB in cleint it works fine, but when I try to do a look up on ejb/datasource and call getConnection() it throws me an error. Below is the stack trace

    javax.ejb.EJBException: java.rmi.MarshalException: CORBA MARSHAL 1330446343 No; nested exception is: 
    org.omg.CORBA.MARSHAL: FINE: IOP00810007: Underflow in BufferManagerReadStream after last fragment in message  vmcid: OMG  minor code: 7  completed: No
    at com.global.entities._DataSourceRemote_Wrapper.getConnection(com/global/entities/_DataSourceRemote_Wrapper.java)
    at com.global.client.Client.main(Client.java:24)
Caused by: java.rmi.MarshalException: CORBA MARSHAL 1330446343 No; nested exception is: 
    org.omg.CORBA.MARSHAL: FINE: IOP00810007: Underflow in BufferManagerReadStream after last fragment in message  vmcid: OMG  minor code: 7  completed: No
    at com.sun.corba.ee.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:267)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:213)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
    at com.sun.corba.ee.impl.presentation.rmi.codegen.CodegenStubBase.invoke(CodegenStubBase.java:227)
    at com.global.entities.__DataSourceRemote_Remote_DynamicStub.getConnection(com/global/entities/__DataSourceRemote_Remote_DynamicStub.java)
    ... 2 more
Caused by: org.omg.CORBA.MARSHAL: FINE: IOP00810007: Underflow in BufferManagerReadStream after last fragment in message  vmcid: OMG  minor code: 7  completed: No
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
    at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:248)
    at com.sun.corba.ee.spi.orbutil.logex.corba.CorbaExtension.makeException(CorbaExtension.java:95)
    at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.handleFullLogging(WrapperGenerator.java:387)
    at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator.access$400(WrapperGenerator.java:107)
    at com.sun.corba.ee.spi.orbutil.logex.WrapperGenerator$2.invoke(WrapperGenerator.java:511)
    at com.sun.corba.ee.spi.orbutil.proxy.CompositeInvocationHandlerImpl.invoke(CompositeInvocationHandlerImpl.java:99)
    at $Proxy24.endOfStream(Unknown Source)
    at com.sun.corba.ee.impl.encoding.BufferManagerReadStream.underflow(BufferManagerReadStream.java:128)
    at com.sun.corba.ee.impl.encoding.CDRInputStream_1_1.grow(CDRInputStream_1_1.java:113)
    at com.sun.corba.ee.impl.encoding.CDRInputStream_1_2.alignAndCheck(CDRInputStream_1_2.java:126)
    at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_long(CDRInputStream_1_0.java:496)
    at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readValueTag(CDRInputStream_1_0.java:1810)
    at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1040)
    at com.sun.corba.ee.impl.encoding.CDRInputObject.read_value(CDRInputObject.java:531)
    at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:384)
    at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readResult(DynamicMethodMarshallerImpl.java:483)
    at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:203)
    ... 5 more

Am I missing some thing?
Can anyone please help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:25:58+00:00Added an answer on May 26, 2026 at 8:25 pm

    If you’re using a Remote interface, execute a standalone application and use the JNDI to do the lookup than you’re sending the data over the wire (in other words – it’s not a local call).

    I don’t think you should send app server DataSource Connection to the client. Basically you should left the database access to your EJB on server-side rather than leak this responsibility to the client.

    If you’re learning EJBs than you can try with some simple type (Integer, String, etc.).


    If it comes to your other question “All container managed objects should not be exposed to the client when remote interface is being used“.

    I think it’s more or less true. I don’t think you should expose UserTransaction, DataSource or SessionContext container managed objects to the client.

    However, remember that an JPA entity is also managed by the container, but after detachment – it can be safely sent to the client (and perhaps reconnected/merged when it goes back).
    Another example could be a CDI bean. It can be injected by the container and in some cases you can send it to the client and modify it. The container is not able to manage the contextual nature of the CDI bean, but I think that you can still use it.

    HTH!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a new JBoss Web Application or EJB project in NetBeans, the 'Server Resources'
I'm working on a new application using EJB3 -> BlazeDS -> Flex. I can't
I am using JSF and EJB as two separate project in my application. Below
Starting a new project using EJB 3 / JPA, mainly stateless session beans and
Is anybody out there using iBATIS 3 as their persistence framework inside an EJB
I am using Log4j with Jboss EJB webservice. I am logging the application flow
I'm developing a EJB client. The EJB (2.1) server in deployed as Websphere 6.0
My application file (EAR) consists of combination of EJB and WAR. FrameWork is JSF
Is it possible to inject EJB 3.1 beans into POJO using CDI on Glassfish
Standard Java EE environment: JPA + EJB called from JSF beans. Server: glassfish 3.1.1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.