EJB or not EJB?
Hi all,
I am fairly new to J2EE, and have recently been reading up on it, checking out the blueprints and the tutorials.
I have recently finished a web app based on Microsoft technology (ASP and COM+), and we now wish to rewrite it the J2EE way.
My dilema is that I cannot decide if I need to use EJB's, or if the application really warrants it. I could easily just build it in the Web container using JSP, Servlets and JavaBeans.
Basically, the app. is just a glorified tool for clients to browse/search through a very large database (45 million entries). We have lots of behind the scenes functionality to provide page level access control that interfaces with a legacy CICS server, but essentially that about it. The majority of the front end will be implemented in applets.
Any guidance would be gratefully received.
As per my recommendation you should use EJB in your application because of the following factors:-
1. You can separate the presentation logic, business logic and the data persistence logic of your application using EJB.
2. For presentation always use JSP ,unless it is applet.It should contain least(not none) java code.
3. The EJBs should be used for business logic and persistence logic. EJBs are broadly of 2 types i.e. Session beans and Entity Beans. Use Session beans for workflow management and Entity Beans for persistence management. Keep in mind that it is useful to use Enity beans only if reusability of the database access logic is required. Non reusable database logic can be coded in Session beans as using in it Entity beans will result in unwanted overheads.
4. You can easily manage transactions using EJB, just by making a simple entry in the XML deployment desciptor.To accomplish this using JSP/Servlet you need to use java transactions API(UserTransaction and all).
5. You donot need to write the database access logic in case of CMP entity beans.
6. Container manages synchronisation of the data in the entity bean and the data in the database, thus it ensures that you always get latest data from the database. The synchronised is taken care by the callback methods defined in the EntityBean interface.
7. In case of entity beans perfomance is optimised since Container is handling complex things like maintaining the pool of instances of Stateless Session beans and Entity Beans. The instances are swapped between different EJB object as and when required by the container. Also the instances are returned to the instance pool once they have been used.
I feel that these few points can help you.
Similar Messages
-
Can not find my EJB's from my Servlet
Hi
I am new to EJB and am trying to get a Servlet to call some sessionless EJB beans. I have got it working in JDeveloper but when I deploy it to orion application server I keep getting a javax.naming.NameNotFoundException exception throw from the Servlet when it tries to find the first EJB.
The code in the Servlet is:
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "admin");
env.put(Context.SECURITY_CREDENTIALS, "jewels");
// env.put(Context.PROVIDER_URL, "ormi://localhost:23891/current-workspace-app");
env.put(Context.PROVIDER_URL, "ormi://localhost:23791/dev");
Context ctx = new InitialContext(env);
System.out.println("Getting mapping class ejb");
//mapping
ExponentMappingServiceHome mappingHome = (ExponentMappingServiceHome)ctx.lookup("ExponentMappingServiceHome");
ExponentMappingService mapping = mappingHome.create();
My EJB xml looks like this:
<?xml version = '1.0' encoding = 'windows-1252'?>
<!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>
<session>
<description>Session Bean ( Stateless )</description>
<display-name>ExponentMappingService</display-name>
<ejb-name>ExponentMappingService</ejb-name>
<home>com.exponent.ejb.service.map.ExponentMappingServiceHome</home>
<remote>com.exponent.ejb.service.map.ExponentMappingService</remote>
<ejb-class>com.exponent.ejb.service.map.ExponentMappingServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
<description>Session Bean ( Stateless )</description>
<display-name>ExponentMappingViewsService</display-name>
<ejb-name>ExponentMappingViewsService</ejb-name>
<home>com.exponent.ejb.service.map.ExponentMappingViewsServiceHome</home>
<remote>com.exponent.ejb.service.map.ExponentMappingViewsService</remote>
<ejb-class>com.exponent.ejb.service.map.ExponentMappingViewsServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
<session>
<description>Session Bean ( Stateless )</description>
<display-name>FalconService</display-name>
<ejb-name>FalconService</ejb-name>
<home>com.exponent.ejb.service.FalconServiceHome</home>
<remote>com.exponent.ejb.service.FalconService</remote>
<ejb-class>com.exponent.ejb.service.FalconServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
I have been trying for a while to get the JNDI naming right but everything I try gets the above error. Any help would be great.
Thanks
AndreYou have to lookup for "ExponentMappingService", and not "ExponentMappingServiceHome"
The name you give in the <ejb-name> tag in ejb-jar.xml is the JNDI name of the EJB. This is the name u have to look up. -
I m not getting connected to oracle 9i database using my ejb...
hi i have made a simple ejb which simply connects to a database of oracle 9i using a datasource on oracle 10g application server...but now my problem is that when i am trying to deploy the ejb ..it is not getting deployed...it shows the following error..
Deployment failed:nested exception
resolution:
base exception:
com.evermind.server.rmi.OrionRemoteException
Disconnected:Connection reset. Disconnected:Connection reset.
the code i am using for EJB class is as follows
package Simpapp;
import javax.ejb.*;
import java.sql.*;
import javax.naming.*;
import javax.sql.DataSource;
public class SimpappBean implements SessionBean {
static final String DATASOURCE = "bajaj";
static final String SQL = "select * from login ";
DataSource ds;
public String upper (String input) throws java.rmi.RemoteException {
try {
Connection conn = ds.getConnection ("bajaj10g","bajaj10g");
Statement sql = conn.createStatement ();
//sql.setString (1, input);
ResultSet results = sql.executeQuery (SQL);
if (results.next () == false) {
System.out.println ("No rows for "+ input);
throw new java.rmi.RemoteException ("SQL failure");
} // if
String result = results.getString ("username");
results.close ();
sql.close ();
conn.close ();
if (result == null) {
System.out.println ("NULL result for "+ input);
throw new java.rmi.RemoteException ("SQL failure");
} else
return (result);
} catch (SQLException sqle) {
System.err.println ("While executing SQL: " +
sqle.getMessage ());
throw new java.rmi.RemoteException ("SQL failure");
} catch (Exception e) {
System.err.println ("Unknown Exception: " +
e.getMessage ());
throw new java.rmi.RemoteException ("Bean Exception: " +
e.getMessage ());
} // catch
} // simpapp
public void ejbCreate () {
try {
Context ctx = new InitialContext ();
ds = (DataSource) ctx.lookup (DATASOURCE);
} catch (Exception e) {
System.out.println ("While creating Bean " +
e.getMessage ());
} // catch
} // ejbCreate
public void ejbRemove () {}
public void ejbActivate () {}
public void ejbPassivate () {}
public void setSessionContext (SessionContext ctx) {}
} // SimpappBeancan any body suggest me where lies the problem???
all my Home ,Remote classes are doing well when they are used for any other simple helloworld type of programIs that the only Oracle client installed? If you have another one hanging around it could be using the wrong tnsnames file.
-
Queries are not getting executed in the EJB
Hi,
I am using Stateless EJB for database transactions. I have one getConnection() method in it which I am calling in every method for connection. I have created one more method in that I am executing one simple query for count(*) from one table and returning the count in the Web dynpro application. But I am not getting the count. It seems the query is not getting executed. I have added classes12 jar externally to the EJB and also to the WebDynpro application. Is there anything I am missing????
Thanks,
Swati GaurHi Swati Gaur,
Did you print any logs in the your code to print the count after executing the query?
For debugging purpose you can try
System.err.println("Count after executing the query "+count);
count is the variable which contains the count after executing the sql query.
Check for the above statement in default trace. If count is printing in default trace then the problem is in your webdynpro code.
Hope this helps!
Regards,
Jaya. -
Foreign key fields not getting populated in datacontrol palette for EJB app
Hi,
I am quite new to ADF and EJB.I developed a jdeveloper application with JSF and EJB tiers.(I am using jdeveloper 10.1.3.5)
For database the default HR database is used.I created the entities for the EMPLOYEES and DEPARTMENTS table.
I also created a session bean and a data control for the session bean.
I am having a JSF page that receives all the details of a new Employee and insert into database (i.e persistEntity)
But the Employees constructor from the Data control palette is not populating the MANAGERID and DEPARTMENTID fields which are
the foreign key constraints for the EMPLOYEES table and hence while trying to persist the entity
with the auto populated fields an error message is thrown.
If I used ADF BC instead of EJB then i could populate all the fields including MANAGERID and DEPARTMENTID.
Is it possible to have two text fields for Manager and Department in the jsf to insert the Employee details with EJB as the Model?.
If possible how do I bind the values of these fields to the Employees entity object in EJB.
Kindly need your insights on this.
Thanks,
Guna.Hi,
How are you using MANAGER_ID and DEPARTMENT_ID fields, are they exposed as Long (or some other numeric type), or did you map them on the entity, something like this
@ManyToOne
private Employee manager; // this by default uses the column named MANAGER_ID
@ManyToOne
private Department department; // this by default uses the column named DEPARTMENT_ID
.... If you mapped them (which is the right way), when you create an employee you should set these attributes before persisting the entity, by using employee.setManager(manager) and employee.setDepartment(department). Then, the foreign keys get populated automatically by your persistence provider (Toplink).
If you are using data controls, it is a little different process to set the department and manager, but you should take a look at this tutorial http://www.oracle.com/technology/obe/obe11jdev/ps1/ejb/ejb.html , it will hopefully answer a lot of your questions.
Pedja -
Problem with ejbs in Netweaver 2004s-Class not found exception
Hello,
I have a webdynpro project(Newtweaver 2004s) referring to a stateless session bean. I created an ejb and defined two public parts - part 1 contains EJB components and part 2 contains some Exception classes I refer to in my webdynpro project. I added these parts to my webdynpro project as dependencies for compile and runtime. I am able to compile and deploy the webdynpro project without any issue but I get runtime errors saying the following:
com.sap.tc.webdynpro.services.exceptions.WDRuntimeException: Failed to create delegate for component com.test.techops.ccf.data.Data. (Hint: Is the corresponding DC deployed correctly? Does the DC contain the component?)
at com.sap.tc.webdynpro.progmodel.generation.ControllerHelper.createDelegate(ControllerHelper.java:110)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.<init>(DelegatingComponent.java:51)
at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.init(ClientComponent.java:382)
at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:362)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.initApplication(ApplicationSession.java:707)
at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:269)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:759)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:712)
at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:261)
at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doPost(DispatcherServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:387)
at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:365)
at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:944)
at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:266)
at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:174)
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
at java.security.AccessController.doPrivileged(Native Method)
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at com.sap.tc.webdynpro.progmodel.generation.ControllerHelper.createDelegate(ControllerHelper.java:74)
... 27 more
Caused by: java.lang.NoClassDefFoundError: com/test/techops/ccfejb/util/CCFException --> Defined in my ejb (public part)
at com.test.techops.ccf.data.wdp.InternalData.<init>(InternalData.java:240)
... 32 more
I did not have any issues when the code was running on Netweaver 2004 but now it does not seem to work when I migrated to 2004s. Can anyone please advice me on what the problem might be ?
Thanks,
RamaHi Harsha,
Thanks for your quick reply.
Trying to figure it out by comparing JRE versions but still no result. I have found one problem is that
when Gantt is loaded , Java in control panel loads all the Applets requried in to its Resources.
These Resources are missing for the user for whom the Gantt error is produced.
Loaded Resources can be found in the below Path :
ControlPanel -> Java-> General Tab -> View Button -> select Resources in Show .
So, How to load these resources ??? . Is there any setting to do that ???
Regards,
Ravikiran.K -
Hi ,
I have an EJB A which is already deployed when the server starts. A second ejb
B is deployed at a later time.
EJB A calls methods in EJB B. I use reflection in EJB A to call methods in EJB
B.
I get a NoSuchMethodException when I call the create method in the Home object
of EJB B. If I add the ejb jar file to the classpath before the server starts
then it is able to resolve the method.
The problem is the EJBs which are called from EJB A is not known before the server
is started. New EJBs can be deployed at runtime and EJB A should be able call
the methods in newly deployed EJB's.
I also use the URLClassLoader to load all the classes in the jar file of the newly
deployed EJB in EJB A and it still gives a NoSuchMethodException because it cannot
resolve the stub class.
My error log is shown below.
This is an urgent issue.
Thanks
SampleConnector::testEJBService called
In Key : P1 Value : Input2
In Key : P3 Value : Input1
In Key : P2 Value : SomeConst
Loaded Class = com.bizwave.samples.rejb.SampleRemote
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_EOImpl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_HomeImpl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_Impl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteHome
java.lang.NoSuchMethodException
at java.lang.Class.getMethod0(Native Method)
at java.lang.Class.getDeclaredMethod(Class.java:1151)
at com.bizwave.samples.ejb.SampleConnectorEJB.testEJBService(SampleCon
ctorEJB.java:181)
at com.bizwave.samples.ejb.SampleConnectorEJB_be5y1v_EOImpl.testEJBSer
ce(SampleConnectorEJB_be5y1v_EOImpl.java:98)
at java.lang.reflect.Method.invoke(Native Method)
at com.bizwave.fc.utils.ClassUtils.invokeEJBMethod(ClassUtils.java:109
at com.bizwave.infra.fjet.engine.EJBServiceStepMgr.executeService(EJBS
viceStepMgr.java:91)Hi,
I am attaching a test case. This test case actually demonstrates a security bug.
Unzip the file and modify the StartWeblogic.cmd in domainA to not refer to the
SampleRemoteEJB.jar in the classpath. If u run the test client under the client
dir u will see a NoSuchMethodException.
The reason is it is not able to load the dynamically generated stub file.
Initially I had the getMethod and it didn't work. You might have to modify the
files to suit ur env. The easier way is to run th edomain wizard and create 2
domains. Run the servers in development mode and place the jars under the applications
dir
Thanks
Rajesh Mirchandani <[email protected]> wrote:
Do you have any old EJB classes in your classpath? Did you recompile
your EJBs if you
upgraded from a old release or a Service pack?
Bob Lee wrote:
Hmmmm. That's an interesting problem.
Why is it giving you a NoSuchMethodException instead of a
ClassNotFoundException?
Can you post the code from SampleConctorEJB.java, line 181?
Try changing your call to getDeclaredMethod() to getMethod().
getDeclaredMethod() searches only the class you called it on, whereas
getMethod() traverses to the superclasses and interfaces. You onlyneed
getDeclaredMethod() when you're accessing a nonpublic method.
Not sure if this will help, but it's worth a shot.
Bob
Vasu wrote:
Hi ,
I have an EJB A which is already deployed when the server starts.
A second ejb
B is deployed at a later time.
EJB A calls methods in EJB B. I use reflection in EJB A to call methodsin EJB
B.
I get a NoSuchMethodException when I call the create method in theHome object
of EJB B. If I add the ejb jar file to the classpath before the serverstarts
then it is able to resolve the method.
The problem is the EJBs which are called from EJB A is not knownbefore the server
is started. New EJBs can be deployed at runtime and EJB A shouldbe able call
the methods in newly deployed EJB's.
I also use the URLClassLoader to load all the classes in the jarfile of the newly
deployed EJB in EJB A and it still gives a NoSuchMethodExceptionbecause it cannot
resolve the stub class.
My error log is shown below.
This is an urgent issue.
Thanks
SampleConnector::testEJBService called
In Key : P1 Value : Input2
In Key : P3 Value : Input1
In Key : P2 Value : SomeConst
Loaded Class = com.bizwave.samples.rejb.SampleRemote
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_EOImpl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_HomeImpl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_Impl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteHome
java.lang.NoSuchMethodException
at java.lang.Class.getMethod0(Native Method)
at java.lang.Class.getDeclaredMethod(Class.java:1151)
at com.bizwave.samples.ejb.SampleConnectorEJB.testEJBService(SampleCon
ctorEJB.java:181)
at com.bizwave.samples.ejb.SampleConnectorEJB_be5y1v_EOImpl.testEJBSer
ce(SampleConnectorEJB_be5y1v_EOImpl.java:98)
at java.lang.reflect.Method.invoke(Native Method)
at com.bizwave.fc.utils.ClassUtils.invokeEJBMethod(ClassUtils.java:109
at com.bizwave.infra.fjet.engine.EJBServiceStepMgr.executeService(EJBS
viceStepMgr.java:91)
Rajesh Mirchandani
Developer Relations Engineer
BEA Support
[user_projects.zip] -
@EJB not working when used in Cactus ServletTestCase
Hi All,
I am running my tests using Cactus ServletTestCase servlet and testing my EJB from there. I deploy my EAR application (my test servlet is in WAR, EJB in EAR modul)
When I run the test, I got NPE as the @EJB is not working and EJB ref is not initialized. Strange thing is, the @EJB is working fine from any other servlet or POJO in WAR.
Test result:
<webresult>
−
<exception classname="java.lang.NullPointerException">
<message>null</message>
−
<stacktrace>
java.lang.NullPointerException
at test.fenix.legalsubject.TestLegalSubjectController.testConvert(TestLegalSubjectController.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:155)
at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:120)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:94)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:218)
at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java:1)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:102)
at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:218)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java:1)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:73)
at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:218)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java:1)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:718)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:411)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:290)
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:568)
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)
</stacktrace>
</exception>
</webresult>
my test class:
public class TestLegalSubjectController extends ServletTestCase {
* Class under test
static final Logger log = Logger
.getLogger(TestLegalSubjectController.class);
* TODO nemuzu to rozchodit
@EJB
public LegalSubjectController legalSubject;
local interface:
@Local
public interface LegalSubjectController extends ControllerFilter {
public LegalSubjectWizardData getByID(Long ID);
public void createLegalSubject(LegalSubjectWizardData legalSubjectWizardData);
public LegalSubject findByName(String name);
EJB implementation
@Stateless
public class LegalSubjectControllerBean implements LegalSubjectController, LegalSubjectControllerRemote {
private static final Logger log = Logger.getLogger(LegalSubjectControllerBean.class);
I am stucked with this one, dont want to use the EJB2 way with JNDI look up. Any suggestions much appreciated!Was anyone ever able to figure out a solution for this issue? I'm having the exact same problem right now and this is the only reference to it I've been able to find online.
Thanks!
-Blake -
Unable to load the EJB module. DeploymentContext does not contain any EJB.
I'm writing an enterprise application to familiarize myself with Glassfish 3.1.2 and EJB 3.1. I've created several local, stateless beans, and injected one into a JSF managed bean. The ejb and web modules compile fine, but when I launch the application with Glassfish I get the following startup error and the application does not deploy. I don't understand what it means, can someone ellaborate?
SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer prepare method
SEVERE: Exception while invoking class org.glassfish.javaee.full.deployment.EarDeployer prepare method
SEVERE: Exception while preparing the app
SEVERE: Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for D:\Documents\NetBeansProjects\Test\dist\gfdeploy\Test\Test-war_war.
If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected
org.glassfish.deployment.common.DeploymentException: Unable to load the EJB module. DeploymentContext does not contain any EJB. Check the archive to ensure correct packaging for D:\Documents\NetBeansProjects\Test\dist\gfdeploy\Test\Test-war_war.
If you use EJB component annotations to define the EJB, and an ejb or web deployment descriptor is also used, please make sure that the deployment descriptor references a Java EE 5 or higher version schema, and that the metadata-complete attribute is not set to true, so the component annotations can be processed as expected
at org.glassfish.javaee.full.deployment.EarDeployer.prepare(EarDeployer.java:166)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:871)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:389)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:348)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:363)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1085)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:95)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1291)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1259)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:461)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:212)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:179)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper$Hk2DispatcherCallable.call(ContainerMapper.java:354)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)My guess is that you deployed an ejb without bean in it. when you have an ejb module, be sure you have at least one bean present.
Are you sure you have implementend some beans? Or did you do this only in the web module?
Try adding an @Stateless bean doing nothing in you ejb module, redeploy and let me know if that works -
Problem deploying connector: META-INF/ejb-jar.xml not found in jar file
Has anyone seen this problem:
I built Sun's Blackbox implementation and packaged
it identical to the BlackBoxNoTx.rar included with
Weblogic's 'jconnector' sample (even using the same
ra.xml and weblogic-ra.xml). When I try to deploy
it, the server reports:
java.io.FileNotFoundException:
META-INF/ejb-jar.xml not found in jar file
I have no idea why the server thinks my connector
is an EJB. If I deploy the BlackBoxNoTx.rar included
with the sample, everything works without a hitch.
The only variable that I'm changing in my BlackBoxNoTx.rar
is that I build the Blackbox classes myself--otherwise,
the RAR packagings are identical. Any assistance is
greatly appreciated since I'm banging my head against
a wall...
Thanks,
-jason
I was finally able to resolve this one. On the odd chance that someone else encounters
the same problem, here's what went wrong:
My RAR file had two directories: 'META-INF' and 'meta-inf'. The first was created
by the jar tool and contained the manifest.mf file. The second I created manually
and it contained my ra.xml and weblogic-ra.xml. When I examined the RAR using
any tools or I extracted the contents, it looked like it only contained one directory:
META-INF (because NT is case-insensitive).
"Jason L" <[email protected]> wrote:
>
>Has anyone seen this problem:
>
>I built Sun's Blackbox implementation and packaged
>it identical to the BlackBoxNoTx.rar included with
>Weblogic's 'jconnector' sample (even using the same
>ra.xml and weblogic-ra.xml). When I try to deploy
>it, the server reports:
>
>java.io.FileNotFoundException:
>META-INF/ejb-jar.xml not found in jar file
>
>I have no idea why the server thinks my connector
>is an EJB. If I deploy the BlackBoxNoTx.rar included
>with the sample, everything works without a hitch.
>The only variable that I'm changing in my BlackBoxNoTx.rar
>is that I build the Blackbox classes myself--otherwise,
>the RAR packagings are identical. Any assistance is
>greatly appreciated since I'm banging my head against
>a wall...
>
>Thanks,
>
>-jason
-
Not able to update single file in a non ejb Module related jar
Hey all,
I have depoyed my j2ee application <b>.ear</b> on NW webAS .
This application apart from having all the ejb Modules related jar, <b>also has a jar which has all my properties files</b> being accessed by my application.
Very often is it required by me to update these files and restart the application. However i couldnot find a way to update these single files.
When i select by deployed application.ear and click <b>Single File Update</b> feature provided by SAP in visual Admin, it shown only ejb modulerelated jar. It dosent show my jar containing properties file.
I have to redeploy my application again everytime i change a small properties file.
Please let me if there is a way to update these sngle filesHi,
>
Vikram D Salvi wrote:
> MOVE-CORRESPONDING ZSTRUC_CM TO I_TAB. not working
>
> UPDATE ZTEST_CM FROM ZSTRUC_CM. not working
Instead of the move statement you need to use the append work area to internal table statement. you need to have the same structure for the work area and the internal tbale.
Then use the modify data base table from internal table statement.
Regards
Ansari -
One of them uses Enterprise Java Beans implemented with a SUN NetDynamics application server. The other is a straight Java application. Ideally I want the second application to remotely invoke methods on the existing Java beans, so the existing business logic will not be duplicated.
This would seem to be simple, but NetDynamics appears to substitute some proprietary code for part of the EJB interface, and it is not immediately obvious how to let "foreign" java programs access the beans.
I would appreciate it if anyone is able to provide any information on how to achieve this. If you know of any sample code that I could look at, that would be a help too. This may (or may not) be known to SUN as a "stand alone java client".hi,
can someone help me how to implement logging for method entry parameters and
method exit return value.
can someone help me how to use log4j and integrate it to the method entry
logging and method exit logging.
Here what i need is without writing the log statements for the method entry and
method exit i need to log it to the file
along with other log4j debug statements i provide in the file.I should be able
to configure whether to enable/disable the logging
for method entry and method exit. In method entry i should be able to log the
parameters the method take and in method exit
i should be able to log te return value to the log file, before the method is
returned to the callee.
i hope i am clear
Thanks in advance. -
Med Rec medrec tutorial 10 deployments-- EJB Modules EJB is not shown
This note adds missing steps in the Med Rec (medrec) Tutorial 10
The tutorial shows how to use EJBGEN to generate EJB classes (incl java source) from .ejb files.
Unfortunately it is missing a few key details. These are described below.
Many thanks to Chris Wall for supplying the answers and hints.
Q: The tutorial includes deploying the manually generated physSessionEjb’s. After doing the step that generates the PhysSession*.java files, onefinds that when trying to deploy that there are no class files – nothing has been built. Are the class files supposed to be generated by the ejbgen step?
[Chris] No, EJBGen just generates the local and remote interfaces and descriptors only. An additional step should be added to explain how to build the newly generated EJBs. I believe you are correct in calling “src/physicianEar$ ant –f build.xml build”.
Q: Manually built the class files using ‘ant –f build.xml build’ in the physicianEar src dir – but that failed in the acc.split.dir step with class not found /org/apache/struts/action/ActionForm.
Obviously did not get the struts jars on the classpath. But as much of the build as completed did include creating the class files.
[Chris] Yes, it looks like struts.jar is not in the classpath. Is this the “build.split.dir” or “appc.split.dir” target? In either case, wlcompile and wlappc should recognized all libs in "${app-inf.dest.lib}" and append them to the compile/appc classpath automatically. The libs should have been copied during the “prepare” target. Can you make sure that struts.jar exists in c:/medrec_tutorial/build/physicianEar/APP-INF/lib? If not, re-run the target with verbose: “src/physicianEar$ ant -verbose -f build.xml build”, and make sure that the libs are copied in the “prepare” target.
Q: When doing the deploy step, we get no errors but on the console window and do not see the tutorial_deployment item under DeploymentsàEJB Modules. There is something under Deployments-->Applications --> tutorial_deployment. It appears the deploy failed since there’s nothing under Deployments --> EJB Modules, and what is there is ‘left over’ from deploying the jar (the ear?) that contains the stuff deployed by the deploy step at the start of tutorial 10.
[Chris] Once the build is successful, you must deploy the EAR. This is done by executing : “src/physicianEar$ ant -f build.xml redeploy.physician.ear”. Again, a step that was left out. Yes, you should be looking at Deployments--> Applications--> tutorial_deployment. So, to summarize: generated the local and remote and descriptors for the EJB, compile the EJB and package the EAR, deploy the EAR, and then view the deployment in the console.This note adds missing steps in the Med Rec (medrec) Tutorial 10
The tutorial shows how to use EJBGEN to generate EJB classes (incl java source) from .ejb files.
Unfortunately it is missing a few key details. These are described below.
Many thanks to Chris Wall for supplying the answers and hints.
Q: The tutorial includes deploying the manually generated physSessionEjb’s. After doing the step that generates the PhysSession*.java files, onefinds that when trying to deploy that there are no class files – nothing has been built. Are the class files supposed to be generated by the ejbgen step?
[Chris] No, EJBGen just generates the local and remote interfaces and descriptors only. An additional step should be added to explain how to build the newly generated EJBs. I believe you are correct in calling “src/physicianEar$ ant –f build.xml build”.
Q: Manually built the class files using ‘ant –f build.xml build’ in the physicianEar src dir – but that failed in the acc.split.dir step with class not found /org/apache/struts/action/ActionForm.
Obviously did not get the struts jars on the classpath. But as much of the build as completed did include creating the class files.
[Chris] Yes, it looks like struts.jar is not in the classpath. Is this the “build.split.dir” or “appc.split.dir” target? In either case, wlcompile and wlappc should recognized all libs in "${app-inf.dest.lib}" and append them to the compile/appc classpath automatically. The libs should have been copied during the “prepare” target. Can you make sure that struts.jar exists in c:/medrec_tutorial/build/physicianEar/APP-INF/lib? If not, re-run the target with verbose: “src/physicianEar$ ant -verbose -f build.xml build”, and make sure that the libs are copied in the “prepare” target.
Q: When doing the deploy step, we get no errors but on the console window and do not see the tutorial_deployment item under DeploymentsàEJB Modules. There is something under Deployments-->Applications --> tutorial_deployment. It appears the deploy failed since there’s nothing under Deployments --> EJB Modules, and what is there is ‘left over’ from deploying the jar (the ear?) that contains the stuff deployed by the deploy step at the start of tutorial 10.
[Chris] Once the build is successful, you must deploy the EAR. This is done by executing : “src/physicianEar$ ant -f build.xml redeploy.physician.ear”. Again, a step that was left out. Yes, you should be looking at Deployments--> Applications--> tutorial_deployment. So, to summarize: generated the local and remote and descriptors for the EJB, compile the EJB and package the EAR, deploy the EAR, and then view the deployment in the console. -
Hi
I am just a starter on WLPortal.
I have created a barebone Application from scratch. I have synchronized it properly
from EBCC to WLP. But When I am trying to access the home page of my application,
I am getting from stack trace -
<Nov 6, 2002 5:37:59 PM IST> <Error> <PortalAppflow> <Could not lookup PortalManagerHome
in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager.
javax.naming.NameNotFoundException: Unable to resolve comp/env/ejb/PortalManager
Resolved: 'comp/env' Unresolved:'ejb' ; remaining name 'PortalManager'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:802)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:209)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:173)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:181)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:181)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:323)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:36)
at weblogic.jndi.internal.AbstractURLContext.lookup(AbstractURLContext.java:124)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at com.bea.p13n.util.JndiHelper.lookupNarrow(JndiHelper.java:96)
at com.bea.portal.appflow.PortalAppflowHelper.<clinit>(PortalAppflowHelper.java:64)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.init(PortalWebflowServlet.java:78)
at javax.servlet.GenericServlet.init(GenericServlet.java:258)
at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubImpl.java:700)
at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStubImpl.java:643)
at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:588)
at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:368)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:242)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:215)
at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112)
at jsp_servlet.__index._jspService(__index.java:92)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2459)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Nov 6, 2002 5:37:59 PM IST> <Error> <HTTP> <[WebAppServletContext(19695286,FirstWebApp,/FirstWebApp)]
Servlet failed with Exception
java.lang.NullPointerException:
at com.bea.portal.appflow.PortalAppflowHelper.createPortalManager(PortalAppflowHelper.java:82)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.setupPortalRequest(PortalWebflowServlet.java:187)
at com.bea.portal.appflow.servlets.internal.PortalWebflowServlet.doGet(PortalWebflowServlet.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:215)
at weblogic.servlet.jsp.PageContextImpl.forward(PageContextImpl.java:112)
at jsp_servlet.__index._jspService(__index.java:92)
at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:265)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:304)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:200)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:2459)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2039)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
When I decompiled the class PortalAppflowHelper, I found a static block in it,
which was as under-
static
debug = Debug.getInstance(com.bea.portal.appflow.PortalAppflowHelper.class);
try
if(debug.ON)
debug.out("Looking up PortalManagerHome using EJB reference java:comp/env/ejb/PortalManager");
portalManagerHome = (PortalManagerHome)JndiHelper.lookupNarrow("java:comp/env/ejb/PortalManager",
com.bea.portal.manager.ejb.PortalManagerHome.class);
if(debug.ON)
debug.out("Successfully retrieved PortalManagerHome " + portalManagerHome);
catch(Exception e)
PortalAppflowLogger.errorFindingPortalManagerHome("java:comp/env/ejb/PortalManager",
e);
I have checked the PortalManager's JNDI name on WLConsole. Its ${APPNAME}.BEA_portal.PortalManager.
Should I change it?
When I tried to change it, I started getting other weird errors.
Thanks
Neeraj HansNeeraj -
The Portal framework code (including PortalAppflowHelper) uses ejb
references to find the PortalManager (and other EJBs) from servlets and
taglibs; that is what is signified by the java:comp/env/... name.
Since you built your webapp from scratch (instead of using the portal
wizard), you will need to make sure the you have the appropriate
<ejb-ref> entries in your web.xml, and the corresponding
<ejb-reference-description> entries in your weblogic.xml. By default,
you will need at least mappings for:
- ejb/PortalManager
- ejb/UserManager
- ejb/GroupManager
- ejb/PipelineExecutor
- ejb/EventService
See either the resulting webapp from using the portal wizard or
BEA_HOME/weblogic700/samples/portal/sampleportalDomain/beaApps/sampleportal/sampleportal/WEB-INF
for example syntax.
Greg
Neeraj Hans wrote:
Hi
I am just a starter on WLPortal.
I have created a barebone Application from scratch. I have
synchronized it properly
from EBCC to WLP. But When I am trying to access the home page of my
application,
I am getting from stack trace -
<Nov 6, 2002 5:37:59 PM IST> <Error> <PortalAppflow> <Could not lookup
PortalManagerHome
in the JNDI tree using EJB reference java:comp/env/ejb/PortalManager.
javax.naming.NameNotFoundException: Unable to resolve
comp/env/ejb/PortalManager
Resolved: 'comp/env' Unresolved:'ejb' ; remaining name 'PortalManager'
at <stack trace lines snipped>
When I decompiled the class PortalAppflowHelper, I found a static
block in it,
which was as under-
static
debug =
Debug.getInstance(com.bea.portal.appflow.PortalAppflowHelper.class);
try
if(debug.ON)
debug.out("Looking up PortalManagerHome using EJB
reference java:comp/env/ejb/PortalManager");
portalManagerHome =
(PortalManagerHome)JndiHelper.lookupNarrow("java:comp/env/ejb/PortalManager",
com.bea.portal.manager.ejb.PortalManagerHome.class);
if(debug.ON)
debug.out("Successfully retrieved PortalManagerHome "
+ portalManagerHome);
catch(Exception e)
PortalAppflowLogger.errorFindingPortalManagerHome("java:comp/env/ejb/PortalManager",
e);
I have checked the PortalManager's JNDI name on WLConsole. Its
${APPNAME}.BEA_portal.PortalManager.
Should I change it?
When I tried to change it, I started getting other weird errors.
Thanks
Neeraj Hans -
EJB 3.0 entity found within JDeveloper but not on OAS 10.1.3
I'm tearing my hair out with this!
Basically I have an entity bean with a primary key annotated with @Id, a stateful session bean facade which has an EntityManager injected through @Resource, and a java client in JDeveloper which calls this bean through a lookup.
In JDeveloper 10.1.3 it works fine, no problems. I deploy the app, along with a JSP version of this client, to Oracle AS 10.1.3.0 - the deploy goes through without a problem. Whenever I try to use the JSP to test that it's working, I get a NPE in the server logs - but it only points to the compiled JSP class, and therefore not corresponding to a line in the actual JSP!
Here is the error stack trace:
06/10/12 12:01:51 java.lang.NullPointerException
06/10/12 12:01:51 at usernametest.jspService(_usernametest.java:121)
06/10/12 12:01:51 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:59)
06/10/12 12:01:51 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:416)
06/10/12 12:01:51 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:478)
06/10/12 12:01:51 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:401)
06/10/12 12:01:51 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
06/10/12 12:01:51 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:719)
06/10/12 12:01:51 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
06/10/12 12:01:51 at com.evermind.server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
06/10/12 12:01:51 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
06/10/12 12:01:51 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
06/10/12 12:01:51 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
06/10/12 12:01:51 at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
06/10/12 12:01:51 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303
06/10/12 12:01:51 at java.lang.Thread.run(Thread.java:595)
Does this look obvious to anyone? All I am asking is a general idea to what the problem might be. I have been looking at this for 2 weeks and keep going round in circles. If anyone here has any idea that would be much appreciated.
I will supply other code (JSP, bean) if necessary, as this isn't a Java forum ;)
Thanks in advance
PaulHi Lonneke,
Here is the bean class:
import java.util.List;
import javax.annotation.Resource;
import javax.ejb.Stateful;
import javax.persistence.EntityManager;
import javax.persistence.Query;
@Stateful(name="cart")
public class CartBean implements CartRemote, CartLocal {
@Resource
protected EntityManager manager;
public CartBean() {
public User getUser(String username){
User user = manager.find(User.class, username);
return user;
public List<Ereq> getEreqs(String username) {
Query query = manager.createNativeQuery("SELECT p.BAAN_ACTIVITY_CODE, p.CLIENT_REF_NO, p.DELIVERY_SITE, p.EREQ_MESSAGE, p.EREQ_REF_NO, p.EREQ_STATUS, " +
"p.LAB_REF_NO, p.ORDER_DATE, p.PROJECT_CODE, p.PURCHASED_ORDER_NUMBER, p.REQUIRED_DATE, p.USER_FULLNAME " +
"FROM Processed_Ereq p, Ereq_User_Link e, Users u " +
"WHERE p.ereq_ref_no = e.ereq_ref_no " +
"AND e.user_id = u.user_id " +
"AND u.username= '" + username + "'", Ereq.class);
return query.getResultList();
Here is the JSP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ page contentType="text/html;charset=windows-1252"%>
<%@ page import="sun.misc.BASE64Encoder,java.util.regex.*" %>
<%@ page import="com.evotec.ereq.CartLocal" %>
<%@ page import="com.evotec.ereq.User" %>
<%@ page import="javax.naming.InitialContext" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%!String m_username = "pbarrett";%>
<%!String emailAddress = "";%>
<%
try {
InitialContext ctx = new InitialContext();
//CartLocal cart = (CartLocal) session.getAttribute("Cart");
//if (cart==null) {
CartLocal cart = (CartLocal) ctx.lookup("java:comp/env/cart");
//session.setAttribute("Cart", cart);
//ereqs = cart.getEreqs(m_username);
User user = cart.getUser(m_username);
emailAddress = user.getEmailAddress();
%>
<html>
<body>
you are: <%= m_username %><BR>
your email address is: <%= emailAddress %><BR>
</body>
</html>
<%
catch (NullPointerException e){
e.printStackTrace();
%>
Any help is welcome
Thanks
Paul -
EJB 3.0 and JAX-RPC 1.1 Not Working Together
I've came across a strange behavior when building a JAX-RPC 1.1 service in WebLogic 10 on top of a EJB 3.0 bean:
Business Interface
@Remote
@WebService(targetNamespace="http://coronelado.sf.net")
public interface AuthenticationBO {
boolean login(String email, String password) throws AuthenticationBOException;
Bean
@Stateless(name="AuthenticationBO")
@TransactionManagement(BEAN)
@WLHttpTransport(contextPath="coronelado-service", serviceUri="AuthenticationBOService")
@WebService(endpointInterface="net.sf.coronelado.business.AuthenticationBO")
public class AuthenticationBOBean implements AuthenticationBO {
ejb-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
<enterprise-beans>
<session>
<ejb-name>AuthenticationBO</ejb-name>
<service-endpoint>net.sf.coronelado.business.AuthenticationBO</service-endpoint>
</session>
</enterprise-beans>
</ejb-jar>After I deploy the bean, two web services, not one, are listed in the console: AuthenticationBOService and AuthenticationBOBeanService (a duplicate), and the following error message is printed:
[JAM] Warning: failed to resolve class net.sf.coronelado.business.AuthenticationBOBeanAm I missing something here?http://fernandoribeiro.eti.br/2007/06/27/bug-in-weblogic-10-web-services/
Maybe you are looking for
-
I need to have full path of file when file get uploaded (using EXTjs). Due to security reason in firefox, it just show file name. Is it possible to make it work setting any properties in about:config.
-
How do I make a 2-color PDF?
An ad I've created uses black and a PMS color. How do I export the PDF so that only the two plates are used and no process colors? Thanks, Michele
-
Connecting to url keeps popping up and can't play song
looking for help. my wife's itunes on her gateway pc is getting a quick window pop up when she tries to play some songs from the itunes store. the window says "connecting to url" yet the song won't play. I have never seen anything like this. how can
-
Hi can you please tell me the use of Cells in Bex analyzer. Will it have effect on signs (+/-). Regards, Anita
-
Mysql Table column attribute and ADF applcation
Hi, The column names of a table in MySql database are not display when creating a New Entity object within ADF application. please how can the table columns be display to the entity object ? Thanks