[jboss-user] [Beginners Corner] - Error when conecting with a remote object from MBean

2008-02-19 Thread ovistanciu
Hello.

I have a remote server and a client in the form of an MBean, designed following 
the Serialization Server example from JBoss Remoting.

The Server

  | import javax.management.MBeanServer;
  | 
  | import org.jboss.remoting.InvocationRequest;
  | import org.jboss.remoting.InvokerLocator;
  | import org.jboss.remoting.ServerInvocationHandler;
  | import org.jboss.remoting.ServerInvoker;
  | import org.jboss.remoting.callback.InvokerCallbackHandler;
  | import org.jboss.remoting.transport.Connector;
  | 
  | import ro.ebsoft.doorcontrol.comm.common.CommModuleMain;
  | import ro.ebsoft.doorcontrol.interfaces.CommModule;
  | 
  | public class Main {
  | 
  | private static String transport = rmi;
  | private static String host = localhost;
  | private static int port = 5400;
  | 
  | private static CommModule response;
  | 
  | public void setupServer(String locatorURI) throws Exception {
  | InvokerLocator locator = new InvokerLocator(locatorURI);
  | System.out.println(Starting remoting server with locator URI 
of: 
  | + locatorURI);
  | Connector connector = new Connector(locator);
  | 
  | connector.create();
  | 
  | SampleInvocationHandler invocationHandler = new 
SampleInvocationHandler();
  | connector.addInvocationHandler(CommModule, invocationHandler);
  | 
  | connector.start();
  | }
  | 
  | // rmi server main class
  | public static void main(String args[]) {
  | 
  | String locatorURI = transport + :// + host + : + port
  | + /?serializationtype=jboss;
  | Main main = new Main();
  | 
  | try {
  | response = new CommModuleMain();
  | main.setupServer(locatorURI);
  | while (true) {
  | Thread.sleep(1000);
  | }
  | } catch (Exception e) {
  | e.printStackTrace();
  | }
  | }
  | 
  | public static class SampleInvocationHandler implements
  | ServerInvocationHandler {
  | 
  | @Override
  | public void addListener(InvokerCallbackHandler arg0) {
  | }
  | 
  | @Override
  | public Object invoke(InvocationRequest invocation) throws 
Throwable {
  | System.out.println(Invocation request is 
  | + invocation.getParameter());
  | 
  | return new CommModuleMain();
  | }
  | 
  | @Override
  | public void removeListener(InvokerCallbackHandler arg0) {
  | }
  | 
  | @Override
  | public void setInvoker(ServerInvoker arg0) {
  | }
  | 
  | @Override
  | public void setMBeanServer(MBeanServer arg0) {
  | }
  | 
  | }
  | }
  | 

The MBean class

  | package ro.ebsoft.doorcontrol.mbean.engine;
  | 
  | import org.jboss.remoting.Client;
  | import org.jboss.remoting.InvokerLocator;
  | import org.jboss.system.ServiceMBeanSupport;
  | 
  | import interfaces.CommModule;
  | 
  | public class CommEngine extends ServiceMBeanSupport implements 
CommEngineMBean {
  | 
  | private static String transport = rmi;
  | private static String host = localhost;
  | private static int port = 5400;
  | 
  | public String getMessage() {
  | return message;
  | }
  | 
  | public void setMessage(String message) {
  | this.message = message;
  | }
  | 
  | public void printMessage(){
  | log.info(message);
  | }
  | 
  | protected void startService() throws Exception{
  | log.info(Starting CommModuleMBean);
  | String locatorURI = transport + :// + host + : + port + 
/?serializationtype=jboss;
  | log.info(Connecting to  + locatorURI);
  | //String locatorURI = transport + :// + host + : + port;
  | 
  | InvokerLocator locator = new InvokerLocator(locatorURI);
  | Client remotingClient = new Client(locator);
  | remotingClient.connect();
  | 
  | try{
  | CommModule cm = 
(CommModule)remotingClient.invoke(CommModule);
  | }
  | catch(Throwable t){
  | t.printStackTrace();
  | }
  | }
  | 
  | protected void  stopService() throws Exception{
  | log.info(Stopping with message:  + message);
  | }
  | 
  | //setters  getters
  | }
  | 

When I run both the server and a similar client (which is not an MBean), all 
goes well. But when I deploy my client as a .sar in the app server, I get

  |  ERROR [MainDeployer] Could not create deployment: 

[jboss-user] [Remoting] - Need some advice

2008-02-15 Thread ovistanciu
Hello and please excuse my total newbieness.

I am building a web application that acts as a control panel to a collection of 
physical devices. I implemented the communication protocol as a RMI interface, 
whose methods are commands that need to be called from the web interface. The 
Remote object which acts as a RMI server resides on a host in the local 
network. The client should reside on the App Server.

For what I understand from reading the JBoss Remoting docs, the idea should be 
that I have to implement a Service on the server who acts as a client to the 
remote RMI server. The Service will be used by my EJB session beans to send 
commands to the remote server, i.e. to the devices.

Am I getting this right? If no, could you give me some tips?

I'll be happy to provide further information if needed.

Thank you for your time.

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4129614#4129614

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4129614
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: h:SelectManyListbox, s:SelectItems and Many-to-Many mapp

2008-02-06 Thread ovistanciu
No, there isn't. Just the faces message posted above (model validation failed).

View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4126892#4126892

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4126892
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: h:SelectManyListbox, s:SelectItems and Many-to-Many mapp

2008-02-05 Thread ovistanciu
Pete, I tried your example posted here: 
http://jroller.com/pmuir/entry/using_sets_in_jsf.
userGroup.xhtml now looks like this:

  | h:selectManyListbox id=locationsListBox 
value=#{dc:asList(userGroupHome.instance.locations)}
  | disabled=#{not 
s:hasRole('admin')}
  | s:convertEntity /
  | s:selectItems 
value=#{locationList.resultList} var=location
  | 
label=#{location.locationName} noSelectionLabel=None /
  | /h:selectManyListbox
  | 
where 'asList' is the function described in the link above.
Now, when trying to create a userGroup I get:
model validation failed:/members/userGroup.xhtml @33,44 
value=#{dc:asList(userGroupHome.instance.locations)}: Illegal Syntax for Set 
Operation

What am I missing?


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4126464#4126464

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4126464
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - h:SelectManyListbox, s:SelectItems and Many-to-Many mapping

2008-02-04 Thread ovistanciu
Hello.
Not sure if I'm addressing a known bug, but here it goes.

I'm using Seam 2.0.0.GA, JBoss AS 4.2.2, JDK 1.5

I have a Many-to-Many mapping:
Location entity:

  | private CollectionUserGroup userGroups;
  | 
  | 
@ManyToMany(TargetEntity=ro.ebsoft.doorcontrol.applogic.entity.UserGroup.class,
  | cascade={CascadeType.MERGE, CascadeType.PERSIST})
  | @JoinTable(name=UserGroup_Location,
  | [EMAIL PROTECTED](name=locationId)}, [EMAIL 
PROTECTED](name=userGroupId)})
  | public CollectionUserGroup getUserGroups() {  
  | return userGroups;
  | }
  | 
  | public void setUserGroups(CollectionUserGroup userGroups) {
  | this.userGroups = userGroups;
  | }
  | 

and UserGroup entity

  | private CollectionLocation locations = null;
  | 
  |  @ManyToMany(
  | cascade={CascadeType.PERSIST, CascadeType.MERGE},
  | mappedBy=userGroups,
  | targetEntity=Location.class
  | )
  | public CollectionLocation getLocations() {
  | return locations;
  | }
  | 
  | public void setLocations(CollectionLocation locations) {
  | this.locations = locations;
  | }
  | 
  | 

When adding a new UserGroup, a user can select any number of locations for the 
group.

userGroup.xhtml :

  | h:selectManyListbox id=locationsListBox 
value=#{userGroupHome.instance.locations} 
  | disabled=#{not s:hasRole('admin')}
  |   s:convertEntity/
  |   s:selectItems value=#{locationList.resultList} var=location 
label=#{location.locationName}/
  | /h:selectManyListbox
  | 

When I try to save a new group (for instance, with the 2 top locations from the 
listbox), there's a failed validation. Faces Message: Conversion Error setting 
value '0 1' for '#{userGroupHome.instance.locations}'.

I understand there's a problem binding a Set to a h:selectManyListBox (should 
use ArrayList). When trying to change CollectionLocation locations;  to 
ArrayListLocation locations;  Hibernate notifies that it does not support it 
(mapping many to many to something else than a Collection). 

What to do? Does anyone have a fix for this problem?

Thank you for your time.


View the original post : 
http://www.jboss.com/index.html?module=bbop=viewtopicp=4126217#4126217

Reply to the post : 
http://www.jboss.com/index.html?module=bbop=postingmode=replyp=4126217
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user