[jboss-user] [J2EE Design Patterns] - Re: Integrate multiple JVM's with single JBoss instance

2007-07-02 Thread smeaggie
I think you are actually looking for a Terracotta server. This is a server wich 
can cluster JVM's (local AND over a network). They seem to support JBoss too, 
although they need to work on the documentation I'm afraid. I don't have any 
experience with the product, it's on my "long running" todo list :P

You can read more on their website: http://www.terracotta.org/
this is about JBoss on their site: 
http://www.terracotta.org/confluence/display/docs1/Integrations+JBoss

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4059581#4059581

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4059581
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: async timed events and mailing

2007-06-13 Thread smeaggie
moving to 1.2.1.GA solved the problem indeed! Thanks!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053901#4053901

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053901
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: async timed events and mailing

2007-06-13 Thread smeaggie
Currently using Seam 1.2.0.PATCH1.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4053889#4053889

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4053889
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - async timed events and mailing

2007-06-13 Thread smeaggie
Hello All,

I have a small problem with emailing from my application. If a user triggers an 
action in the web pages emailing works perfectly, however I also have a timed 
service running started on deployement, wich must run every day. I use a pojo 
controller wih basicly does this:

  | @Name("notifierController")
  | @Startup()
  | @Scope(ScopeType.APPLICATION)
  | public class NotifierController {
  | @In(create = true)
  | private Notifier notifier;
  | 
  | @Create()
  | public void start() {
  | Timer nTimer = notifier.check(0, 24*60*60*1000);
  | }
  | }
  | 
the Notifier object is a stateless session bean with the check() method in the 
interface:

  | @Local()
  | public interface Notifier {
  | @Asynchronous()
  | public Timer check(@Duration long d, @IntervalDuration long i);
  | }
  | 
>From the bean implementation I try to send the email like this:

  | @Stateless()
  | @Name("notifier")
  | public class NotifierBean implements Notifier {
  | @In()
  | private Timer timer;
  | 
  | @In()
  | private Renderer renderer;
  | 
  | public Timer check(@Duration long d, @IntervalDuration long i) {
  | try {
  | this.renderer.render("/path/to/email.xhtml");
  | } catch (Exception e) {
  | e.printStackTrace();
  | }
  | 
  | return this.timer;
  | }
  | }
  | 
The email component is properly configured as it works from interface-triggered 
bean methods, when this executes I get th exception:
anonymous wrote : 
  | 12:50:15,337 ERROR [STDERR] java.lang.UnsupportedOperationException
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.seam.mock.MockApplication.createComponent(MockApplication.java:154)
  | 12:50:15,337 ERROR [STDERR] at 
com.sun.facelets.tag.jsf.ComponentHandler.createComponent(ComponentHandler.java:243)
  | 12:50:15,337 ERROR [STDERR] at 
com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:139)
  | 12:50:15,337 ERROR [STDERR] at 
com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
  | 12:50:15,337 ERROR [STDERR] at 
com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
  | 12:50:15,337 ERROR [STDERR] at 
com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.seam.ui.facelet.FaceletsRenderer.renderFacelet(FaceletsRenderer.java:107)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:56)
  | 12:50:15,337 ERROR [STDERR] at 
my.package.Notifier.check(NotifierBean.java:20)
  | 12:50:15,337 ERROR [STDERR] at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 12:50:15,337 ERROR [STDERR] at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  | 12:50:15,337 ERROR [STDERR] at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 12:50:15,337 ERROR [STDERR] at 
java.lang.reflect.Method.invoke(Method.java:585)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:47)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  | 12:50:15,337 ERROR [STDERR] at 
org.jboss.seam.interceptors.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51)
  | 12:50:15,338 ERROR [STDERR] at 
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  | 12:50:15,338 ERROR [STDERR] at 
org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
  | 12:50:15,338 ERROR [STDERR] at 
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
  | 12:50:15,338 ERROR [STDERR] at 
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
  | 12:50:15,338 ERROR [STDERR] at 
org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
  | 12:50:15,338 ERROR [STDERR] at 
sun.reflect.GeneratedMethodAccessor333.invoke(Unknown Source)
  | 12:50:15,338 ERROR [STDERR] at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  | 12:50:15,338 ERROR [STDERR] at 
java.lang.reflect.Method.invoke(Method.java:585)
  

[jboss-user] [JBoss Seam] - Re: entityManager.persist(Object) not working?

2007-03-29 Thread smeaggie
Thanks very much, I've read some more things on this subject last night because 
I see I don't really have the knowledge yet... Indeed I needed a transaction, I 
solved this by annotating the method with @Transactional(), it works perfectly 
now!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4033029#4033029

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4033029
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - entityManager.persist(Object) not working?

2007-03-29 Thread smeaggie
Hello all, I have a small question I don't know if the Seam forum is the right 
place to post, but I use a seam managed entity manager and it's behaviour 
puzzles me... A very simplified sitation sketch:

data class:

  | @Entity()
  | @Name("data")
  | public class Data implements Serializable {
  |// field declarations here (plus getters and setters)
  | }
  | 

Bean code:

  | @Name("importService")
  | @Scope(ScopeType.CONVERSATION)
  | public class ImportService implements Serializable {
  |@In()
  |private EntityManager entityManager;
  |
  |public void parse(Document d) {
  |   Data data = new Data();
  |   // Document d is an XML file, wich is parsed, all values are set in
  |   // the data object
  |   
  |   this.entityManager.persist(data);
  |   // I hoped the data would be saved by now...
  |}
  | }
  | 
Also I have this in components.xml:

  | 
  | 
And persistence.xml:

  | 
  | 
  | http://java.sun.com/xml/ns/persistence";
  | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  | xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  | http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";>
  |   
  | org.hibernate.ejb.HibernatePersistence
  | java:/MyDatasource
  | 
  |   
  |   
  |   
  |   
  | 
  |   
  | 
  | 
On deploy time, the database table Data is created perfectly, I get all the SQL 
statements on my console log. No problem. If I manually insert data, I can 
query for the data using this.entityManager.createQuery("from Data data"); even 
INSIDE the parse method of the bean, again I see the SQL statement in my 
console log. But on the entityManager.persist(data) call, there's no SQL 
statement executed. I surrounded the call with a try { ... } catch (Exception 
e) { ... } block but there are NO exceptions thrown. Just no data is saved :(

Can someone help me with this please? I really don't understand why data is not 
saved...!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4032784#4032784

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4032784
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [Security & JAAS/JBoss] - Re: Is there a tutorial on form-based login using JAAS on JB

2007-02-20 Thread smeaggie
yes there is, I just posted this one somewhere else around here too, it uses a 
database as username/password storage:

1) setup the connection to the database. put a "database-ds.xml" file in the 
deploy directory wich contains something like:

  | 
  | 
  | exampleDS
  | 
jdbc:postgresql://127.0.0.1:5432/example
  | org.postgresql.Driver
  | ex
  | ___
  | 5
  | 20
  | 
  | PostgreSQL 7.2
  |   
  | 
  | 
  | 
make sure you enter the correct driver, connection string etc. Now open 
login-config.xml in the server's conf/ directory. you need to define a security 
domain here. add this to the file:

  | 
  | 
  | 
  | guest
  | java:/exampleDS
  | SELECT PASSWD 
FROM USERS WHERE USERID=?
  | SELECT ROLEID, 
'Roles' FROM ROLES WHERE USERID=?
  | 
  | 
  | 
  | 
note the definition "exampleDomain" and how the dsJndiName is set to 
java:/exampleDS. exampleDS comes from the database connection definition above! 
the two queries in this file mean the following: the principalsQuery should 
return the password of the user where userid is the name the user entered in 
the login form. The rolesQuery must return all roles associated with the 
username. So it's time to create two tables in your database, with at least 
this info:

  | table USERS
  | +-+
  | | userid   |  passwd |
  | +-+
  | | test|  secret   |
  | +-+
  | 
  | table ROLES
  | +-+
  | |  userid| roleid   |
  | +-+
  | |  test |  admin|
  | |  test |  manager|
  | +-+
  | 
(don't mind the ascii art)

we've created a user "test" with the password "secret" and the roles "admin" 
and "manager".

time to secure the web application, open up jboss-web.xml (from the WEB-INF 
directory) and put this in it:

  | 
  | 
  |   java:/jaas/exampleDomain
  |   /example
  | 
  | 
this sets the security domain for the web application to "exampleDomain" wich 
is declared in the login-config.xml above! jboss now knows wich login module 
configuration applies to this application.
now edit web.xml (also in the WEB-INF directory) and add this:

  | 
  | manager
  | 
  | manager_pages
  | 
  | /manager/*
  | GET
  | POST
  | HEAD
  | PUT
  | OPTIONS
  | TRACE
  | DELETE
  | 
  | 
  | 
  | manager
  | 
  | 
  | 
  | NONE
  | 
  | 
  | 
  | 
  | admin
  | 
  | admin_pages
  | 
  | /admin/*
  | GET
  | POST
  | HEAD
  | PUT
  | OPTIONS
  | TRACE
  | DELETE
  | 
  | 
  | 
  | admin
  | 
  | 
  | 
  | NONE
  | 
  | 
  | 
  | 
  | FORM
  | example
  | 
  | /login.html
  | /login_error.html
  | 
  | 
  | 
  | 
  | 
  | admin
  | 
  | 
  | 
  | manager
  | 
  | 
this defines two security constraints: one for everything behind /manager 
(where only users with the "manager" role are allowed) and one for admins, 
everything behind /admin.

the login pages (login.html and login-error.html) should look like this:

  | 
  | 
  |
  |   
  |   
  |   
  |
  | 
  | 
  | 

hope this helps!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019228#4019228

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019228
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [Security & JAAS/JBoss] - Re: Latest JAAS Tutorial for Database communication

2007-02-19 Thread smeaggie
ah that's quiet another story, I described securing a web app, not ejb's. You 
must annotate the EJB's with the security domain and allowed roles, like this: 
(assuming you work with EJB3 that is)
@Stateless()
  | @SecurityDomain("exampleDomain")
  | public class MyBean implements MyBeanRemote {
  |/**
  | * allowed to everyone
  | */
  |@PermitAll()
  |public String getSimpleString() {
  |   return "unsecure";
  |}
  |
  |/**
  | * Only 'admin' role allowed
  | */
  |@RolesAllowed({"Admin"})
  |public String getAdvancedString() {
  |   return "secured";
  |}
  | }
I'm not experienced with remote clients, all my clients are local... Someone 
else has to fill in that part.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4019216#4019216

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4019216
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [Security & JAAS/JBoss] - Re: Latest JAAS Tutorial for Database communication

2007-02-19 Thread smeaggie
don't know about jGuard, but this is JAAS with database login (a real quicky 
tho, feel free to ask more).

1) setup the connection to the database. put a "database-ds.xml" file in the 
deploy directory wich contains something like:

  | 
  | 
  | exampleDS
  | 
jdbc:postgresql://127.0.0.1:5432/example
  | org.postgresql.Driver
  | ex
  | ___
  | 5
  | 20
  | 
  | PostgreSQL 7.2
  |   
  | 
  | 
  | 
make sure you enter the correct driver, connection string etc. Now open 
login-config.xml in the server's conf/ directory. you need to define a security 
domain here. add this to the file:

  | 
  | 
  | 
  | guest
  | java:/exampleDS
  | SELECT PASSWD 
FROM USERS WHERE USERID=?
  | SELECT ROLEID, 
'Roles' FROM ROLES WHERE USERID=?
  | 
  | 
  | 
  | 
note the definition "exampleDomain" and how the dsJndiName is set to 
java:/exampleDS. exampleDS comes from the database connection definition above! 
the two queries in this file mean the following: the principalsQuery should 
return the password of the user where userid is the name the user entered in 
the login form. The rolesQuery must return all roles associated with the 
username. So it's time to create two tables in your database, with at least 
this info:

  | table USERS
  | +-+
  | | userid   |  passwd |
  | +-+
  | | test|  secret   |
  | +-+
  | 
  | table ROLES
  | +-+
  | |  userid| roleid   |
  | +-+
  | |  test |  admin|
  | |  test |  manager|
  | +-+
  | 
(don't mind the ascii art)

we've created a user "test" with the password "secret" and the roles "admin" 
and "manager".

time to secure the web application, open up jboss-web.xml (from the WEB-INF 
directory) and put this in it:

  | 
  | 
  |   java:/jaas/exampleDomain
  |   /example
  | 
  | 
this sets the security domain for the web application to "exampleDomain" wich 
is declared in the login-config.xml above! jboss now knows wich login module 
configuration applies to this application.
now edit web.xml (also in the WEB-INF directory) and add this:

  | 
  | manager
  | 
  | manager_pages
  | 
  | /manager/*
  | GET
  | POST
  | HEAD
  | PUT
  | OPTIONS
  | TRACE
  | DELETE
  | 
  | 
  | 
  | manager
  | 
  | 
  | 
  | NONE
  | 
  | 
  | 
  | 
  | admin
  | 
  | admin_pages
  | 
  | /admin/*
  | GET
  | POST
  | HEAD
  | PUT
  | OPTIONS
  | TRACE
  | DELETE
  | 
  | 
  | 
  | admin
  | 
  | 
  | 
  | NONE
  | 
  | 
  | 
  | 
  | FORM
  | example
  | 
  | /login.html
  | /login_error.html
  | 
  | 
  | 
  | 
  | 
  | admin
  | 
  | 
  | 
  | manager
  | 
  | 
this defines two security constraints: one for everything behind /manager 
(where only users with the "manager" role are allowed) and one for admins, 
everything behind /admin.

the login pages (login.html and login-error.html) should look like this:

  | 
  | 
  |
  |   
  |   
  |   
  |
  | 
  | 
  | 

hope this helps!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018900#4018900

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4018900
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [Security & JAAS/JBoss] - Re: https

2007-02-19 Thread smeaggie
you can use a  tag in your web.xml to enforce https 
connections:

  | -- snip --
  | 
  | manager_access
  | 
  | manager_pages
  | 
  | /secure/*
  | GET
  | POST
  | HEAD
  | PUT
  | OPTIONS
  | TRACE
  | DELETE
  | 
  | 
  | 
  | manager
  | 
  | 
  | 
  | CONFIDENTIAL
  | 
  | 
  | -- snip --
  | 
the  here does the trick with  set 
to CONFIDENTIAL. It'll try to switch to https automaticly now when accessing 
anything behind /secure on the server. Note this example required the user to 
have the "manager" role and this requires some more configuration (login config 
etc).

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4018886#4018886

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4018886
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - Re: seam, pojo and a user thread...?

2007-01-18 Thread smeaggie
I wasn't aware of Seams support for timers at all... I must have overlooked it. 
Using EJB is not a problem, so I'll check it out tomorrow, thanks!

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003397#4003397

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003397
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user


[jboss-user] [JBoss Seam] - seam, pojo and a user thread...?

2007-01-18 Thread smeaggie
Hi all, I'm pretty new to seam, but I managed to get it working with everything 
I need, except for this one! I need a very simple task executed every 10 
seconds, switching on and off from the web interface, starting immediatly at 
deploy time and automaticly stop at undeploy or jboss shutdown. Don't worry, 
most parts work ;)

I use a simple java.util.Timer to accomplish this and some annotations to 
expose to seam. This is (somewhat simplified) my code:

  | @Name("MyService")
  | @Scope(ScopeType.APPLICATION)
  | @Startup()
  | public class MyService {
  |private Timer timer;
  |
  |@Create()
  |public void start() {
  |   this.timer = new Timer();
  |   this.timer.scheduleAtFixedRate(new MyTask(), 0, 1);
  |}
  |
  |@Destroy()
  |public void stop() {
  |   this.timer.cancel();
  |}
  | }
  | 

Code works perfectly, it's started on deploy time automaticly, and the methods 
are callable by the web interface wich stops and starts the timer as expected. 
However, on undeploy or shutting down jboss, I get the following exception:

  | [Contexts] Could not destroy component: MyService
  | java.lang.IllegalStateException: No active event context
  | <--- impressive stack trace goes here --->
  | 
and the timer keeps running... 

Can someone help me out here? Thanks in advance,
Eric

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003376#4003376

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003376
___
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user