HttpSessionListener must be a bean?
Hi
i have some problem to implement the HttpSessionListener Interface to a class. I thought i read somewhere that a class implementing HttpSessionListener Interface must be a bean. Is that right?
If so, that would mean, that the constructor of that class may not have a parameter, right (i didn't worked with beans untill now)? So if i need a reference to my servlet from the "HttpSessionListener Class" i need to create this reference later using a methode that registers my Servlet somehow?!
Thanks for your help.
I have solved a part of the problem. I now can create a class implementing a HttpSessionListener and deploy it in the webapp (web.xml). It's working, means, i see when a session is created and when a session is destroyed (with System.out.println()). The class implementing the HttpSessionListener seems to be initialized before the servlet. So i don't have to create an instance of that class in my servlet.
The remaining problem is, that i need to get a reference to the class with the listener and that class needs to get a reference to my servlet because the sessionCreated() and SessionDestroyed methode need to call methodes in my Servlet. How can this be done? I think I need to get a reference to the obvisouly already existing instance of the listener class, right? But how is this done?
Thanks for your help!
Similar Messages
-
Hi, I am using tomcat 4 on NT. I am getting the bean not found error when trying to execute the following JSP. I have put the bean in web-inf\classes directory. Somewhere in this forum I found that my bean class should be in a package.
Please help with this code.
<html>
<head><title>First JSP</title></head>
<body>
<%@page language="java"%>
<jsp:useBean id="mybean" scope="page" class="FirstBean"/>
<%=mybean.getName()%>
</body>
</html>Hi, Sudha,
Is that we must use import class before we use Bean in JSP? I read some example code and they do not have that import part, and I get the same cannot find class error. I am new to JSP, please tell me if we must import our bean class or there has other ways to handle it? thank you very much.
Tony -
Error deploying entity bean on web logic server
i am trying to deploy a container managed persistence entity bean on web logic server when i run the command ejbc which generates the final jar file ready to deploy having its stub and skeleton it gives me the error that the return type of create(int) method should have a type of bean home interface while in accordance with ejb1.1 specicication it should be the type of primary key and a null value should be returned.
plz let me know where i am doing it wrong.thanks for ur quick response sir i am using this services provided by sun microsystem first time and
am really thankful to Sun Microsystem for this great deal of help to the new commers but sir my problem is still there.
following is the method which i have written in the code
public InvoicePK ejbCreate(int id)
this.id=id;
return null;
and here it is the error generated by the server deployment tool.
[9.2.8] In EJB Invoice, the return type for the create method create(int) must be the bean's remote interface type.
[9.2.8] In EJB Invoice, the findByPrimaryKey method must return the Entity bean's remote interface type.
[9.2.8] In EJB Invoice, the return type for the method findByPrimaryKey(com.swi.InvoicePK) must be the entity bean's remote interface type (for a single-object finder) or a collection thereof (for a mult-object finder).
the detail of files created by me are as follows.
1. Invoice (Entity Bean)
2. InvoicePK (Primary Key file)
3. MyRemoteInterface (remote interface for entity bean)
4. MyHomeInterface (home interface for entity bean)
plz let me know where i am doing wrong and oblige. -
Error in my bean in jdeveloper 11g release 2
hi i have this method ,am having error method getDBTransaction(). not found what could be the problem,i what this method in my bean
protected void calproce(String stmt, Object[] bindVars) {
PreparedStatement st;
st = null;
try {
// 1. Create a JDBC PreparedStatement for
st = getDBTransaction().createPreparedStatement("begin "+stmt+";end;",0);
if (bindVars != null) {
// 2. Loop over values for the bind variables passed in, if any
for (int z = 0; z < bindVars.length; z++) {
// 3. Set the value of each bind variable in the statement
st.setObject(z + 1, bindVars[z]);
// 4. Execute the statement
st.executeUpdate();
catch (SQLException e) {
throw new JboException(e);
finally {
if (st != null) {
try {
// 5. Close the statement
st.close();
catch (SQLException e) {}
Edited by: Tshifhiwa on 2012/05/03 1:35 PM
Edited by: Tshifhiwa on 2012/05/03 11:09 PMyes i use ADF BC i have this class also,how can i link to my login button,mybe you can help me,so i must not use bean,now i undestand getDBTransaction is a method you call on an AM not on a VOso how can i use this method in impl class,i what when button press call the public void PerformSdmsLogon method
package sms0000;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import oracle.jbo.JboException;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.server.ViewRowImpl;
import oracle.jbo.server.ViewRowSetImpl;
// --- File generated by Oracle ADF Business Components Design Time.
// --- Fri Apr 27 16:50:46 CAT 2012
// --- Custom code may be added to this class.
// --- Warning: Do not modify method signatures of generated methods.
public class LogOnImpl extends ViewObjectImpl {
* This is the default constructor (do not remove).
public LogOnImpl() {
* executeQueryForCollection - overridden for custom java data source support.
protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams) {
super.executeQueryForCollection(qc, params, noUserParams);
* hasNextForCollection - overridden for custom java data source support.
protected boolean hasNextForCollection(Object qc) {
boolean bRet = super.hasNextForCollection(qc);
return bRet;
* createRowFromResultSet - overridden for custom java data source support.
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet resultSet) {
ViewRowImpl value = super.createRowFromResultSet(qc, resultSet);
return value;
* getQueryHitCount - overridden for custom java data source support.
public long getQueryHitCount(ViewRowSetImpl viewRowSet) {
long value = super.getQueryHitCount(viewRowSet);
return value;
protected void callPerformSdmsLogon(String stmt, Object[] bindVars) {
PreparedStatement st;
st = null;
try {
// 1. Create a JDBC PreparedStatement for
st = getDBTransaction().createPreparedStatement("begin "+stmt+";end;",0);
if (bindVars != null) {
// 2. Loop over values for the bind variables passed in, if any
for (int z = 0; z < bindVars.length; z++) {
// 3. Set the value of each bind variable in the statement
st.setObject(z + 1, bindVars[z]);
// 4. Execute the statement
st.executeUpdate();
catch (SQLException e) {
throw new JboException(e);
finally {
if (st != null) {
try {
// 5. Close the statement
st.close();
catch (SQLException e) {}
Edited by: Tshifhiwa on 2012/05/03 5:26 PM
Edited by: Tshifhiwa on 2012/05/03 11:16 PM -
Whats a referenced bean ?
Hi i wanted to know, what exactly is the difference between using a normal managed bean and a referenced bean ....
A referenced bean according to the help docs :-
Declares a JavaBean that is available in a JSF scope. Unlike a managed bean, the application itself must instantiate this bean and ensure it is accessible in the desired scopes. The element is meant to be used as metadata for development tools.
So is this similar to the scope="application" . or does it mean , taht we have to manually handle the instantiation etc of this bean.
Furthermore whats with the metadata usage ?
Just curious....
Thanks
KHi,
the latter. It says that to work with that bean you have to instantiate it by calling its constructor
Frank -
Hello everybody
I want to import beans into my JSP page but i dont know what to do.
I have my JSP code ready and my .java file is ready and compiled. I have put the .class file in the c:\.....\site\WEB-INF\classes directory. I want to note that the \classes doesnt exist, i create it in my sites and put the .class files in but it doesnt work!
Can smb please tell me how to write the command in the JSP file and explain me the paths and the rest? i have tried many combinations but none ended with a result. It really has no use building JSPs without beans. Thank you very much!1- As you state the class file for the bean must be in the WEB-INF\classes directory, or in some subdirectory of that directory.
2 - You must send the bean to the JSP from the servlet with something like;
MyBean beany = new MyBean(); //make bean instance
request.setAttribute("bean", beany); //put in request
3 - In the JSP you must have something like:
<%@ page import="beanClassDirectory.MyBean"%>
<%
MyBean beany = (MyBean) request.getAttribute("bean");
//get bean from request
%>
From this point on you can use the bean in the JSP, but check that it is not null first.
Note: This is not the only method of getting a bean into a JSP, but just to help I've replied.
BaliBelly. -
EntityManagerFactory injection problems
I am continually getting the following error on the application server:
Version = Sun Java System Application Server 9.1_01
Running on an i86 machine with the Sun operating system installed. I do not seem to get this error on the windows version of the AS. This error was not happening, but started appearing for no apparent reason. It will inject the entity manager resource sometimes without a problem, then stop working. It is so irritating that I am thinking of getting rid of the AS altogether as I need a technology which is at least stable enough to give me reliable access to a database!
Caused by: com.sun.enterprise.InjectionException: Exception attempting to inject Env-Prop: AlexDb@Field-Injectable Resource. Class name = com.test.lis
teners.ContextListener Field name=[email protected]@@@ into class com.test.listeners.ContextListener
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:387)
at com.sun.enterprise.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:206)
at com.sun.enterprise.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:117)
at com.sun.web.server.WebContainerListener.injectInstance(WebContainerListener.java:180)
at com.sun.web.server.WebContainerListener.containerEvent(WebContainerListener.java:125)
... 45 more
Caused by: java.lang.IllegalArgumentException
at sun.reflect.UnsafeFieldAccessorImpl.ensureObj(UnsafeFieldAccessorImpl.java:37)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:57)
at java.lang.reflect.Field.set(Field.java:656)
at com.sun.enterprise.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:338)
... 49 moreHi Frank,
the doc:
jsf-1_2-mrel-spec.pdf
JavaServer™ Faces Specification
Version 1.2 - Rev A
Page - 169
5.4 - Leveraging Java EE 5 Annotations in Managed Beans
JSF Implementations that are running as a part of Java EE 5 must allow managed bean implementations to use the annotations specified in section 14.5 of the Servlet 2.5
Specification to allow the container to inject references to container managed resources into
a managed bean instance before it is made accessible to the JSF application. Only beans
declared to be in request, session, or application scope are eligble for resource
injection.
Following is an example of valid usages of this feature in a managed bean
public class User extends Object {
private @EJB ShoppingCart cart;
private @Resource Inventory inventory;
private DataSource customerData;
.... -
No way to use CMP in OC4J?
Hi, it seems we can never user CMP in OC4J.
OC4J does not support EJB-QL. So how can we implement the finder methods?
1) One way is to put finder methods in ejb home interface, and add implementation (using direct JDBC) in bean class. But the server could not find the correnspondent finder methods even we match them; Also, if we use findBy*** in home interface, and use ejbFindBy***, it still does not work.
2) Another option is to put finder method as an odinary business method in remote interface, and add implementation (using direct JDBC) in bean class. But, before we call this method, we must instantiate the bean by calling create() (without arguments, because we do not want to create record to db). We will get an error: Primary key was null.
So it seems we can never use CMP in OC4J, until it supports EJB-QL.
Thanks,I use CMP all the time. OC4J (since it is based on Orion) should generate certain finder queries (except for perhaps the WHERE clause that you may have to add yourself to the orion-ejb-jar.xml file) for you just by entering them in the home interface. You can do advanced finders as well. What you need is the proper documentation:
Checkout:
http://kb.atlassian.com/content/orionsupport/articles/finders.html
http://kb.atlassian.com/content/orionsupport/articles/ejbfinderquery.html
as good places to start. No JDBC necessary!
Cheers
Ray
Hi, it seems we can never user CMP in OC4J.
OC4J does not support EJB-QL. So how can we implement the finder methods?
1) One way is to put finder methods in ejb home interface, and add implementation (using direct JDBC) in bean class. But the server could not find the correnspondent finder methods even we match them; Also, if we use findBy*** in home interface, and use ejbFindBy***, it still does not work.
2) Another option is to put finder method as an odinary business method in remote interface, and add implementation (using direct JDBC) in bean class. But, before we call this method, we must instantiate the bean by calling create() (without arguments, because we do not want to create record to db). We will get an error: Primary key was null.
So it seems we can never use CMP in OC4J, until it supports EJB-QL.
Thanks, -
How to access "Active Sessions" using MBeans
Hi all,
I have deployed an application at EM (Enterprise Manager).
when I logged into EM and click the application I can see the number of active sessions under "Servlets and JSPs" topic.
how can I access that parameter at application level..??
(I want to access that parameter *"x"* at my web application and display Logged in users : x )
EM shows that the number of active sessions. it updates too.. so there must be some bean or record for that parameter..
how can I access that....??
Regards,
Dinuka.You can use something like the following:
package middleware.magic;
import javax.management.MBeanServerConnection;
import javax.management.ObjectName;
import javax.management.remote.JMXConnector;
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import javax.naming.Context;
import java.io.IOException;
import java.util.Hashtable;
public class Browse {
private String hostname = "172.31.0.106";
private Integer port = 7001;
private String username = "weblogic";
private String password = "transfer11g";
private String protocol = "t3";
private String jndiRoot = "/jndi/";
private String mBeanServer = "weblogic.management.mbeanservers.domainruntime";
private String serviceName = "com.bea:Name=DomainRuntimeService,Type=weblogic.management.mbeanservers.domainruntime.DomainRuntimeServiceMBean";
private JMXConnector connector;
public static void main(String[] args) {
Browse test = new Browse();
try {
MBeanServerConnection connection = test.getMBeanServerConnection();
test.getSomeInformation(connection);
test.closeJmxConnector();
} catch (Exception e) {
e.printStackTrace();
public void getSomeInformation(MBeanServerConnection connection) throws Exception {
ObjectName service = new ObjectName(serviceName);
ObjectName[] serverRunTimes = (ObjectName[]) connection.getAttribute(service, "ServerRuntimes");
for (int i = 0; i < serverRunTimes.length; i++) {
String name = (String) connection.getAttribute(serverRunTimes, "Name");
String version = (String) connection.getAttribute(serverRunTimes[i], "WeblogicVersion");
String state = (String) connection.getAttribute(serverRunTimes[i], "State");
System.out.println("Server name: " + name + ", Version: " + version + ", Server state: " + state);
for (int i = 0; i < serverRunTimes.length; i++) {
ObjectName[] applicationRuntimes = (ObjectName[]) connection.getAttribute(serverRunTimes[i], "ApplicationRuntimes");
for (int j = 0; j < applicationRuntimes.length; j++) {
String name = (String) connection.getAttribute(applicationRuntimes[j], "Name");
ObjectName[] componentRuntimes = (ObjectName[]) connection.getAttribute(applicationRuntimes[j], "ComponentRuntimes");
System.out.println("Application name: " + name);
for (int k = 0; k < componentRuntimes.length; k++) {
if (connection.getAttribute(componentRuntimes[k], "Type").equals("WebAppComponentRuntime")) {
String componentName = (String) connection.getAttribute(componentRuntimes[k], "Name");
Integer sessionsCurrent = (Integer) connection.getAttribute(componentRuntimes[k], "OpenSessionsCurrentCount");
Integer sessionsHigh = (Integer) connection.getAttribute(componentRuntimes[k], "OpenSessionsHighCount");
System.out.println(" - Component Name: " + componentName + ", Sessions Current: " + sessionsCurrent + ", Sessions High: " + sessionsHigh);
public MBeanServerConnection getMBeanServerConnection() throws IOException {
return getJmxConnector().getMBeanServerConnection();
public JMXConnector getJmxConnector() throws IOException {
JMXServiceURL serviceURL = new JMXServiceURL(protocol, hostname, port, jndiRoot + mBeanServer);
Hashtable hashtable = new Hashtable();
hashtable.put(Context.SECURITY_PRINCIPAL, username);
hashtable.put(Context.SECURITY_CREDENTIALS, password);
hashtable.put(JMXConnectorFactory.PROTOCOL_PROVIDER_PACKAGES, "weblogic.management.remote");
connector = JMXConnectorFactory.connect(serviceURL, hashtable);
return connector;
public void closeJmxConnector() throws IOException {
connector.close();
Information regarding runtimeMBean can be found here: http://download.oracle.com/docs/cd/E12839_01/apirefs.1111/e13951/core/index.html.
Open the tree Runtime MBeans, ServerRuntimeMBean and click attributes to see the available attributes (such as Name, WeblogicVersion, State etcetera).
An example output of the program above:Server name: AdminServer, Version: WebLogic Server 10.3.2.0 Tue Oct 20 12:16:15 PDT 2009 1267925 , Server state: RUNNING
Server name: soa_server1, Version: WebLogic Server 10.3.2.0 Tue Oct 20 12:16:15 PDT 2009 1267925 , Server state: RUNNING
Application name: FMW Welcome Page Application_11.1.0.0.0
- Component Name: AdminServer__11.1.0.0.0, Sessions Current: 0, Sessions High: 0
Application name: Module-FMWDFW
Application name: bea_wls_internal
- Component Name: AdminServer_/bea_wls_internal, Sessions Current: 0, Sessions High: 0
Application name: mds-soa
Application name: bea_wls_deployment_internal
- Component Name: AdminServer_/bea_wls_deployment_internal, Sessions Current: 0, Sessions High: 0
Application name: wsil-wls
- Component Name: AdminServer_/inspection.wsil, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_diagnostics
- Component Name: AdminServer_/bea_wls_diagnostics, Sessions Current: 0, Sessions High: 0
Application name: mejb
Application name: bea_wls9_async_response
- Component Name: AdminServer_/_async, Sessions Current: 0, Sessions High: 0
Application name: uddiexplorer
- Component Name: AdminServer_/uddiexplorer, Sessions Current: 0, Sessions High: 0
Application name: mds-owsm
Application name: bea_wls_management_internal2
- Component Name: AdminServer_/bea_wls_management_internal2, Sessions Current: 0, Sessions High: 0
Application name: consoleapp
- Component Name: AdminServer_/console, Sessions Current: 0, Sessions High: 2
- Component Name: AdminServer_/consolehelp, Sessions Current: 0, Sessions High: 1
Application name: DMS Application_11.1.1.1.0
- Component Name: AdminServer_/dms_11.1.1.1.0, Sessions Current: 0, Sessions High: 0
Application name: em
- Component Name: AdminServer_/em, Sessions Current: 0, Sessions High: 0
Application name: uddi
- Component Name: AdminServer_/uddi, Sessions Current: 0, Sessions High: 0
Application name: MQSeriesAdapter
Application name: OraSDPMDataSource
Application name: JmsAdapter
Application name: uddi
- Component Name: soa_server1_/uddi, Sessions Current: 0, Sessions High: 0
Application name: wsil-wls
- Component Name: soa_server1_/inspection.wsil, Sessions Current: 0, Sessions High: 0
Application name: SOAJMSModule
Application name: DbAdapter
Application name: bea_wls9_async_response
- Component Name: soa_server1_/_async, Sessions Current: 0, Sessions High: 0
Application name: composer
- Component Name: soa_server1_/soa/composer, Sessions Current: 0, Sessions High: 0
Application name: DMS Application_11.1.1.1.0
- Component Name: soa_server1_/dms_11.1.1.1.0, Sessions Current: 0, Sessions High: 0
Application name: Module-FMWDFW
Application name: usermessagingdriver-email
- Component Name: soa_server1_/sdpmessagingdriver/email-mbeanlifecycle, Sessions Current: 0, Sessions High: 0
Application name: UMSJMSSystemResource
Application name: AqAdapter
Application name: FtpAdapter
Application name: OracleBamAdapter
Application name: SOADataSource
Application name: usermessagingserver
- Component Name: soa_server1_/sdpmessaging/mbeanlifecycle, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/sdpmessaging/parlayx, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/sdpmessaging/userprefs-ui, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_internal
- Component Name: soa_server1_/bea_wls_internal, Sessions Current: 0, Sessions High: 0
Application name: SocketAdapter
Application name: SOALocalTxDataSource
Application name: FileAdapter
Application name: DefaultToDoTaskFlow
- Component Name: soa_server1_/DefaultToDoTaskFlow, Sessions Current: 0, Sessions High: 0
Application name: soa-infra
- Component Name: soa_server1_/soa-infra, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskMetadataService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskQueryService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskReportService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/IdentityService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/UserMetadataService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/RuntimeConfigService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/TaskEvidenceService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/CompositeMetadataService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/b2b, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/b2b, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/AGMetadataService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/AGQueryService, Sessions Current: 0, Sessions High: 0
- Component Name: soa_server1_/integration/services/AGAdminService, Sessions Current: 0, Sessions High: 0
Application name: wsm-pm
- Component Name: soa_server1_/wsm-pm, Sessions Current: 0, Sessions High: 0
Application name: mds-owsm
Application name: b2bui
- Component Name: soa_server1_/b2bconsole, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_diagnostics
- Component Name: soa_server1_/bea_wls_diagnostics, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_cluster_internal
- Component Name: soa_server1_/bea_wls_cluster_internal, Sessions Current: 0, Sessions High: 0
Application name: EDNLocalTxDataSource
Application name: EDNDataSource
Application name: uddiexplorer
- Component Name: soa_server1_/uddiexplorer, Sessions Current: 0, Sessions High: 0
Application name: bea_wls_deployment_internal
- Component Name: soa_server1_/bea_wls_deployment_internal, Sessions Current: 0, Sessions High: 0
Application name: worklistapp
- Component Name: soa_server1_/integration/worklistapp, Sessions Current: 0, Sessions High: 0
Application name: mds-soa
Application name: OracleAppsAdapter -
Interfacing problems using the Activex Bridge
I have a bean that's based on a JPanel. I am packaging it and then using it in Visual Basic as an OCX component.
I have to adhere to an interface on the VB side so that the bean will plug into the rest of our product.
I'm hitting several problems, all of which I'm attributing to to the fact that the packager introspects the interface for the typelib instead of asking me what I want to expose and how I want to expose it.
1) Getter/Setter methods for properties which contain additional attributes arent recognised as such.
e.g. for property foo:
public int getFoo() is fine
but
public int getFoo(int extraCriteria) doesn't work.
The packager doesn't recognise it as a valid getter and so doesn't bind it to Foo in the typelib.
NB: I've also tried explicitly binding the methods in the bean's beanInfo, (using PropertyDescriptors), but to no effect.
2) Typelib is only generated for the top level bean so how do I provide a similar interface for any java object that it returns?
Any java objects that I return from methods in my bean cannot be interfaced:
Therefore I have to deal with them all as VB Object and I'm also back to square one with my getFoo instead of "= Foo" problem.
3) The packager arbitrarily listens to, and exposes, any events that my class throws. This includes events that are fired from any of the classes that I'm extending. Therefore I'm getting 20+ events showing up from my JPanel on the VB side, NONE of which I'm interested in. When the packager finds an event firing method it automatically exposes it AND registers the activex bridge as a listener of it. Again this is a case of the packager introspecting instead of asking the programmer what they want to expose...
Basically I need help in either a) solving these specific problems, or b) coming at it from the opposite end and finding a way of getting control over what is exposed to VB. (Although this doesn't help me with problem 2)
Any suggestions?
Cheers
Paul JamesSee inline
>
I have a bean that's based on a JPanel. I am packaging
it and then using it in Visual Basic as an OCX
component.
I have to adhere to an interface on the VB side so
that the bean will plug into the rest of our product.
I'm hitting several problems, all of which I'm
attributing to to the fact that the packager
introspects the interface for the typelib instead of
asking me what I want to expose and how I want to
expose it.Did you make sure that you marked the bean in the jar
correctly? (The manifest.mf must declare the bean as bean
so that the corresponding bean info can be found in the same jar)
>
1) Getter/Setter methods for properties which contain
additional attributes arent recognised as such.
e.g. for property foo:
public int getFoo() is fine
but
public int getFoo(int extraCriteria) doesn't work.
The packager doesn't recognise it as a valid getter
and so doesn't bind it to Foo in the typelib.
NB: I've also tried explicitly binding the methods in
the bean's beanInfo, (using PropertyDescriptors), but
to no effect.That might be a COM restriction? IN that prop get and prop put
have to have a certain signature. If your method is public
and part of the bean info, then you should at least have the method.
(That always worked for me...)
>
2) Typelib is only generated for the top level bean so
how do I provide a similar interface for any java
object that it returns?Run the packager over all additional beans.
>
Any java objects that I return from methods in my bean
cannot be interfaced:
Therefore I have to deal with them all as VB Object
and I'm also back to square one with my getFoo instead
of "= Foo" problem.Once you start with your first bean, all subsequent objects
you receive from your first bean can be analyzed via the
java reflection mechanism on the VB side. Somewhere in the
documentation for the ActiveX Packager, there is sample code
on how to do this (how to get the class, find a method, invoke the
method, create new objects for some other class, pass it to your bean
etc).
>
3) The packager arbitrarily listens to, and exposes,
any events that my class throws. This includes events
that are fired from any of the classes that I'm
extending. Therefore I'm getting 20+ events showing
up from my JPanel on the VB side, NONE of which I'm
interested in. When the packager finds an event
firing method it automatically exposes it AND
registers the activex bridge as a listener of it.
Again this is a case of the packager introspecting
instead of asking the programmer what they want to
expose...The reason is that VB only knows one event interface (
marked as dispinterface). This interface has to contain all
events for the bean. I suppose the packager just goes and
collects all events it finds for the bean, including all the
inherited ones. The bridge has to be registered for all of them,
otherwise no event could pass through.
>
Basically I need help in either a) solving these
specific problems, or b) coming at it from the
opposite end and finding a way of getting control over
what is exposed to VB. (Although this doesn't help me
with problem 2)
Any suggestions?
Cheers
Paul James -
Reg: Outside In Webservice
Hi
I created a Outside in WS from a wsdl (ABAP WS) and chose generate java skeleton option on the wsdl. It creates a Stateless session bean as impl bean. Since it does not have a webservice annotation I chose to generate a WS out of it. Then i wanted to call the same WS ( to which the wsdl belongs to) I generated a WS Client out of the same wsdl in the same project. Now I have a proxy and a service in the same project for the same wsdl. When I deploy I dont see the proxy but I see the service. Any ideas why? I need the proxy to set up HTTP destination. Thank you.
Regards
Lakshminarayanan.VHi all
This problem was resolved with an internal message. The solution is as follows:
1. I can not create a proxy and generate a java bean skeleton on the same project.
2. You must create them in separate projects ( you will find the other is not necessary later) and the proxy
project must have a bean using the proxy to allow proxy definition to be intialised.
e.g use a @webserviceref("proxy name"). Only then you will see it in NWA under WS administration
proxy definitons.
3. So create a bean to use the proxy defintion (intialisation!!) or to have the same interface as the underlying webservice, in the other project create the Java skeleton. Copy the bean into your proxy project. Force it to have the annotation that uses the proxy for reasons in step 2.
4. U can now create webservice out of the copied bean in the proxy project. The other java baean skeleton project is not needed as indicated in step 1.
And it works.
HTH
Regards
LNV
Edited by: vln on Aug 14, 2008 6:04 PM
Edited by: vln on Aug 14, 2008 6:05 PM
Edited by: vln on Aug 14, 2008 6:06 PM
Edited by: vln on Aug 14, 2008 6:06 PM -
Hello!
I want to display message at screen. Message type and text must get from bean.
Write this code:
<hbj:messageBar id="mBar" >
<%
mBar.setMessageType(MessageType.ERROR);
mBar.setMessageText(UsRegBean.getValue("txt_Message"));
myFormId.setMessageBar(mBar);
myFormId.setMessageBarRequired(true);
%>
</hbj:messageBar>
But Portal give error: Error occurs during the rendering of jsp component.
If I remove line mBar.setMessageType(MessageType.ERROR);, portal work fine.
What's wrong in my code?Thanks!
<%@ page import="com.sapportals.htmlb.enum.*" %>
Solved problem -
Hi,
I have written this small code. When I try to create my enterprise bean with deploytool, I set container-managed persistant (2.0) but I can't see my primary key and Find/Select methods :
Note that when I set container-managed persistant (1.0), I see my primary key but I can connect to ejb/Cloudscape in order to gen the sql commands. it complains about j2ee server running and UI and PW while everything look ok to me...
Any ideas?
TNX,
SS
Here is my small code :
=================================================
package Connect;
import javax.ejb.*;
import java.rmi.*;
public interface ConnectEC extends EJBObject {
public String getMessage() throws RemoteException;
====================================================
package Connect;
import javax.ejb.*;
import java.rmi.*;
public interface ConnectECHome extends EJBHome {
public ConnectEC create(String message) throws CreateException, RemoteException;
public ConnectEC findByPrimaryKey(String message) throws FinderException, RemoteException;
===================================================================
package Connect;
import javax.ejb.*;
import java.rmi.*;
public class ConnectECBean implements EntityBean {
public String message;
private EntityContext ctx;
public String ejbCreate(String message) throws CreateException {
this.message = message;
return null;
public String getMessage(){
return this.message;
private String setMessage(String message){
return this.message = message;
public void ejbActivate() {}
public void ejbLoad() {}
public void ejbPassivate() {}
public void ejbPostCreate(String message) {}
public void ejbRemove() throws RemoteException {}
public void ejbStore() {}
public void setEntityContext(EntityContext ctx) {}
public void unsetEntityContext() {}in cmp 2.0, you must declare your bean class as abstract class, use setter/getter to access the fields like the following:
package Connect;
import javax.ejb.*;
import java.rmi.*;
public abstract class ConnectECBean implements EntityBean {
private EntityContext ctx;
//cmp fields
public abstract String getMessage();
public abstract void setMessage(String msg);
public String ejbCreate(String message) throws CreateException {
setMessage(message);
return null;
public void ejbActivate() {}
public void ejbLoad() {}
public void ejbPassivate() {}
public void ejbPostCreate(String message) {}
public void ejbRemove() throws RemoteException {}
public void ejbStore() {}
public void setEntityContext(EntityContext ctx) {}
public void unsetEntityContext() {} -
Problem building primary key in create(AttributList) after cancel create?
Hallo,
in the create process i make a initializiation
protected void create(AttributeList attributeList) {
super.create(attributeList);
try {
String strSQL = "select max(ver_nr) from verfuegungen where sts_id = ?";
PreparedStatement stmt = getDBTransaction().createPreparedStatement(strSQL,0);
stmt.setInt(1,getStsId().intValue());
ResultSet rs = stmt.executeQuery();
rs.next();
String snr = rs.getString(1);
int inr = 0;
if (snr != null)
inr = Integer.parseInt(snr);
inr = inr + 1;
setVerNr(new Number(inr));
the user can cancel the create process from within create form with the following method
public String onCancelCreateVerfuegung() {
BindingContainer bindings = getBindings();
bindings.getOperationBinding("DeleteNewVerfuegung").execute();
return "backpostdetails";
when the user think the cancel was wrong and want's to call the create once again he get an JBO-25013.
What can i do? I think the system has informations from the first cancelled action.
Any help is appreciated.in cmp 2.0, you must declare your bean class as abstract class, use setter/getter to access the fields like the following:
package Connect;
import javax.ejb.*;
import java.rmi.*;
public abstract class ConnectECBean implements EntityBean {
private EntityContext ctx;
//cmp fields
public abstract String getMessage();
public abstract void setMessage(String msg);
public String ejbCreate(String message) throws CreateException {
setMessage(message);
return null;
public void ejbActivate() {}
public void ejbLoad() {}
public void ejbPassivate() {}
public void ejbPostCreate(String message) {}
public void ejbRemove() throws RemoteException {}
public void ejbStore() {}
public void setEntityContext(EntityContext ctx) {}
public void unsetEntityContext() {} -
Hi,
May be this is not the right place to post this but i did not receive any reply from JBOSS forum.
I've followed the tutorial from
http://www.laliluna.de/ejb-3-tutorial-jboss.html
and created a jar file FirstEJB3Tutorial.jar. But, when when deployed the jar file to the JBOSS 4.0.4, the jmx-console does not show the JNDI deployed service. Please help.
The jar file available at
http://www.laliluna.de/download/first-ejb3-tutorial.zip
Error Message
===========
org.jboss.xb.binding.JBossXBException: Failed to parse source: The content of element type "enterprise-beans" is incompl
ete, it must match "(session|entity|message-driven)+". @ unknown[6,23]
at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:141)
at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:190)
at org.jboss.ejb3.Ejb3DescriptorHandler.parseDescriptors(Ejb3DescriptorHandler.java:549)
at org.jboss.ejb3.Ejb3HandlerFactory$DDFactory.<init>(Ejb3HandlerFactory.java:42)
at org.jboss.ejb3.Ejb3HandlerFactory.getInstance(Ejb3HandlerFactory.java:79)
Thanks in advance.org.jboss.xb.binding.JBossXBException: Failed to parse source: The
content of element type "enterprise-beans" is incomplete, it must
match "(session|entity|message-driven)+". @*unknown*[6,23]<?xml version="1.0" encoding="UTF-8"?>
I took a peek at that xml file:<ejb-jar>
<enterprise-beans>
</enterprise-beans>
</ejb-jar>... and it seems a bit incomplete to me; enterprise beans must be
session beans, entity beans or message beans; exactly what that
xml compiler is trying to tell you.
kind regards,
Jos
Maybe you are looking for
-
DPX export settings for DCP creation
I have a short film that's been accepted to a major festival that requires a DCP, and I want to create the DCP professionally. I would like to provide a true 24p DPX master to the DCP company. My final film is a 4K sequence at 23.976. I have duplic
-
To see pay method I tap on View Apple ID but get a blank screen. Why? iOS 8 iPad
I Tap on Settings, iTunes and Apps store, tap on my Apple ID to show View my Apple ID. I tap on View my Apple ID to bring up payment method but get a blank screen. How can I correct problem? I have turned iPad off and on With no improvement.
-
Extremely urgent !!! I like someone to takeover this project or guide me through it - I can compensate if you take it over. I have the source codes but I can't seem to compile them - what IDE can I use to get started. View this java applet that lets
-
Photoshop Elements 6 installation problem
Because the PS6 installation on my windows 7 PC had become unresponsive, I uninstalled it. When I tried to reinstall it using the download button next to my order number on the Adobe website, I got the message: You have no downloads. How can I get
-
Itunes won't launch after installing - error
I've tried intalling and reinstalling different versions iTunes, including 7.6.2 up to the latest version. They all seem to install fine, but when I try and launch iTunes I get the following error message: 'The folder 'iTunes' cannot be found or crea