Duran (6) [Avatar] Offline
#1
Hi,

I'm having 3 seperate problems with EJB3/glassfish/netbeans.I successfully created a stateless session bean and servlet.Now I am running into problems now that I am trying to use entities.

Firstly,I had the toplink ddl-generation property set to drop-and-create.I deployed and saw that the tables were created, although they were not populated when I invoked my stateless ItemManager's addBid(Bid bid) method.Now, if I try to undeploy/deploy the EAR I get the following error no matter what value the ddl-generation property has.

2ndly,as soon as I invoke the method that uses one of my entities i receive a huge nonsensical stack-trace of which the only possible hint I can see is "at java.util.HashSet.readObject(HashSet.java:291)"since I have a Set<Bid>=new HashSet<Bid>()In my servlet method(yes I know bad design but I'll fix it after I can get entities working!) :

javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA MARSHAL 1398079745 Maybe; nested exception is:
org.omg.CORBA.MARSHAL: ----------BEGIN server-side stack trace----------
org.omg.CORBA.MARSHAL: vmcid: SUN minor code: 257 completed: Maybe
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9684)
at com.sun.corba.ee.impl.logging.ORBUtilSystemException.couldNotFindClass(ORBUtilSystemException.java:9699)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1042)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:896)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:890)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_abstract_interface(CDRInputStream_1_0.java:880)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_abstract_interface(CDRInputStream.java:511)
at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectDelegate(IIOPInputStream.java:386)
at com.sun.corba.ee.impl.io.IIOPInputStream.readObjectOverride(IIOPInputStream.java:547)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:345)
at java.util.HashSet.readObject(HashSet.java:291)
at sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.corba.ee.impl.io.IIOPInputStream.invokeObjectReader(IIOPInputStream.java:1679)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1202)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:422)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:362)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:32smilie
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:966)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1052)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObjectField(IIOPInputStream.java:1974)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputClassFields(IIOPInputStream.java:2199)
at com.sun.corba.ee.impl.io.IIOPInputStream.inputObject(IIOPInputStream.java:1211)
at com.sun.corba.ee.impl.io.IIOPInputStream.simpleReadObject(IIOPInputStream.java:422)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValueInternal(ValueHandlerImpl.java:362)
at com.sun.corba.ee.impl.io.ValueHandlerImpl.readValue(ValueHandlerImpl.java:32smilie
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.readRMIIIOPValueType(CDRInputStream_1_0.java:966)
at com.sun.corba.ee.impl.encoding.CDRInputStream_1_0.read_value(CDRInputStream_1_0.java:1052)
at com.sun.corba.ee.impl.encoding.CDRInputStream.read_value(CDRInputStream.java:475)
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl$14.read(DynamicMethodMarshallerImpl.java:36smilie
at com.sun.corba.ee.impl.presentation.rmi.DynamicMethodMarshallerImpl.readArguments(DynamicMethodMarshallerImpl.java:435)
at com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:152)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
at com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
at com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
at com.sun.corba.ee.impl.protocol.SharedCDRClientRequestDispatcherImpl.marshalingComplete(SharedCDRClientRequestDispatcherImpl.java:183)
at com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:219)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192)
at com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
at com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
at ejb3inaction.duran.__ItemManagerRemote_Remote_DynamicStub.insertItem(ejb3inaction/duran/__ItemManagerRemote_Remote_DynamicStub.java)
at ejb3inaction.duran._ItemManagerRemote_Wrapper.insertItem(ejb3inaction/duran/_ItemManagerRemote_Wrapper.java)
at servlets.TestEJBServlet.processRequest(TestEJBServlet.java:61)
at servlets.TestEJBServlet.doGet(TestEJBServlet.java:7smilie
at javax.servlet.http.HttpServlet.service(HttpServlet.java:71smilie
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:317)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:19smilie
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:19smilie
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:28smilie
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:271)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:202)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:150)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:637)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:56smilie
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:813)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)

I ensured that my entity jar has a correct persistence.xml and that the jar is added as a library to the Java EE modules that need it.I have also ensured that my entities are serializable.

And my last problem is that I receive the following error on glassfish start/restart:
Jndi name conflict found in [ItemManagement]. Jndi name [ejb3inaction.duran.ItemManagerRemote] for bean [ItemManagerBean] is already in use.
LDR5013: Naming exception while creating EJB container:
javax.naming.NameAlreadyBoundException: Use rebind to override

Unfortunately,looking at the glassfish admin console didn't reveal any obvious duplicate applications that I could remove to resolve it....

Please assist me ?

Message was edited by:
Duran
reza_rahman (456) [Avatar] Offline
#2
Re: Netbeans/Glassfish issues
Duran,

This is unfortunately not enough info for me to be able to help you meaningfully. Can you kindly post some code (starting from where the exception is being thrown)? Off hand, it looks like you may have some issues with the IDE setup/entity mapping. Also, it looks like you are using @Remote when you don't really need to. Try @Local instead.

Hope it helps,
Reza
Duran (6) [Avatar] Offline
#3
Re: Netbeans/Glassfish issues
I don't suppose it's necessary to use @Column when ddl-generation is set to drop-and-create?Because I don't have any @Column definitions asI just assumed it would choose the column names by inspecting the field names...
reza_rahman (456) [Avatar] Offline
#4
Re: Netbeans/Glassfish issues
Duran,

No, @Column should not be necessary.

Cheers,
Reza
Duran (6) [Avatar] Offline
#5
Re: Netbeans/Glassfish issues
Okay will post my code in 12hrs...
Duran (6) [Avatar] Offline
#6
Re: Netbeans/Glassfish issues
Okay I've given up with Netbeans/glassfish bundle.I have installed a standalone glassfish and am now trying to use the asadmin tool instead.
I just get problems when I try to deply chapter9...it says

javax.naming.NameNotFoundException: ActionBazaarDS not found

I dont know if I'm supposed to create this DS or what..I did not make any changes to common.xml though.Could you point out if I am missing something?

common.xml:

<?xml version="1.0" encoding="iso-8859-1"?>
<project name="anttasks">

<property environment="env"/>

<!-- ** Customize as per your environment **** -->

<property name="J2EE_HOME" value="${env.J2EE_HOME}"/>
<property name="JAVA_HOME" value="${env.JAVA_HOME}"/>
<property name="SPRING_HOME" value="${env.SPRING_HOME}"/>
<property name="admin.host" value="localhost" />
<property name="admin.port" value="4848" />
<property name="admin.user" value="admin" />
<property name="http.port" value="3734" />

<property name="admin.password" value="adminadmin" />
<property name="PWD_FILE" value="{$J2EE_HOME}/adminpass"/>

<property name="ASADMIN" value="asadmin.bat" />
<property name="WSIMPORT" value="wsimport.bat" />
<property name="APPCLIENT" value="appclient.bat" />



<!-- Glassfish example <property name="J2EE_HOME" value="d:opensourceglassfish"/> <br /> -->




<path id="common.j2ee.class.path">

<!-- Compile classpath for J2EE based applications for Sun Glassfish -->

<pathelement location="${J2EE_HOME}/lib/javaee.jar"/>
<pathelement location="${J2EE_HOME}/lib/toplink-essentials.jar"/>
<!-- Add path your JDBC Driver for running the chapter 12 - Java SE example -->

<pathelement location="${J2EE_HOME}/lib/ojdbc14.jar"/>
<pathelement location="${J2EE_HOME}/lib/ant/lib/xercesImpl.jar"/>


<pathelement location="${SPRING_HOME}/dist/modules/spring-jpa.jar"/>
<pathelement location="${SPRING_HOME}/dist/modules/spring-dao.jar"/>
<pathelement location="${SPRING_HOME}/dist/spring.jar"/>
<pathelement location="${SPRING_HOME}/dist/modules/spring-beans.jar"/>


<!-- Compile classpath for J2EE based applications for OC4J -->

<pathelement location="."/>
<pathelement location="${J2EE_HOME}/lib/jndi.jar"/>
<pathelement location="${J2EE_HOME}/lib/ejb.jar"/>
<pathelement location="${J2EE_HOME}/lib/ejb30.jar"/>
<pathelement location="${J2EE_HOME}/lib/persistence.jar"/>
<pathelement location="${J2EE_HOME}/lib/jms.jar"/>


<!-- Compile classpath for J2EE based applications for JBoss -->
<pathelement location="${J2EE_HOME}/server/all/deploy/ejb3.deployer/jboss-ejb3x.jar"/>
<pathelement location="${J2EE_HOME}/server/all/lib/jboss-j2ee.jar"/>
<pathelement location="${J2EE_HOME}/server/all/lib/ejb3-persistence.jar"/>

</path>

<property name="common.j2ee.class.path" refid="common.j2ee.class.path"/>

<!-- Target for displaying build information. -->
<target name="common">
<echo message="BuildName: ${ant.project.name}"/>
<echo message="BuildHome: ${basedir}"/>
<echo message="BuildFile: ${ant.file}"/>
<echo message="BuildJVM: ${ant.java.version}"/>
</target>

</project>

Message was edited by:
Duran
dpanda (136) [Avatar] Offline
#7
Re: Netbeans/Glassfish issues
Read the readme in appendix please. It describes, how to create these resources!