Re: Missing resource injection in Tomcat/Axis vs Jetty/CXF

2008-11-17 Thread Janko Heilgeist
Hi Jarek,

thanks for your help with this issue. I opened GERONIMO-4416 for the
bug. Should I open a separate bug with the Axis2 project or do you
expect the bug to be in the Geronimo-specific wiring?

Janko

Jarek Gawor wrote:
> Janko,
> 
> I was able to replicate the problem with Axis2. It is creating an
> extra instance of the bean but that instance won't be used for
> anything. The properly injected bean will be used for all the calls.
> 
> Can you open a bug with this issue?
> 
> Thanks,
> Jarek
> 
> On Fri, Nov 14, 2008 at 2:13 AM, Janko Heilgeist
> <[EMAIL PROTECTED]> wrote:
>> Hi Jarek,
>>
>> your advice didn't work, unfortunately. The server logs still show the
>> additional "DEFAULT"-bean. I've attached the files you requested plus my
>> openejb-jar.xml just for completeness.
>>
>> Janko
>>
>> Jarek Gawor wrote:
>>> I think you end up with deploying two ejbs because the name of bean
>>> specified in the DD does not match the bean name of the annotated
>>> class. And so, the container thinks you are deploying two separate
>>> beans. To fix it, you could try adding "name=MyWebService" attribute
>>> to the @Stateless annotation.
>>>
>>> If that still does not work right, send me your ejb-xml.jar file and
>>> the bean class.
>>>
>>> Jarek
>>>
>>> On Thu, Nov 13, 2008 at 2:33 AM, Janko Heilgeist
>>> <[EMAIL PROTECTED]> wrote:
 Hi,

 I've got a problem when deploying web services under Geronimo
 Tomcat/Axis. Not every instance of the stateless bean seems to receive
 the @Resource that I would like to have injected into the bean. I create
 a simple web service with an injected string that is accessed inside a
 @PostConstruct method and inside an exposed web method.

 // relevant excerpts 
 @Resource
 private String someString = "DEFAULT";

 @PostConstruct
 public void init() {
logger.info(String.format("init: EJB = '%08x', someString = '%s'",
 hashCode(), this.someString));
 }

 public void doSomething(int counter) {
logger.info(String.format("doSomething: EJB = '%08x', someString =
 '%s'", hashCode(), this.someString));
 }

 Excerpts from ejb-jar.xml:

 
MyWebService

com.heilgeist.tests.tst_ws_with_resource.ws_ejb.MyServiceEJBImpl




 com.heilgeist.tests.tst_ws_with_resource.ws_ejb.MyServiceEJBImpl/someString

java.lang.String
Hello, world!

 

 When I access this web service I get the following lines in the server log:

 08:12:41,381 INFO  [MyServiceEJBImpl] init: EJB = '00b6d31c', someString
 = 'Hello, world!'
 08:12:41,477 INFO  [MyServiceEJBImpl] init: EJB = '01c50523', someString
 = 'DEFAULT'
 08:12:41,745 INFO  [MyServiceEJBImpl] doSomething: EJB = '00b6d31c',
 someString = 'Hello, world!'

 The second line indicates, that there is an additional instance of the
 stateless bean, that doesn't receive the injected string. It is only
 created once directly following the deployment of the web service. Even
 if further MYServiceEJBImpl instances are created later on to handle
 concurrent requests there is only a single instance of the bean with the
 default string. It's web service method is never called. Using the
 Jetty/CXF package this additional stateless bean is not created:

 08:09:54,557 INFO  [MyServiceEJBImpl] init: EJB = '015db507', someString
 = 'Hello, world!'
 08:09:54,558 INFO  [MyServiceEJBImpl] doSomething: EJB = '015db507',
 someString = 'Hello, world!'

 Can someone please shed some light on this funny behavior of Axis?

 Regards, Janko

>>



Re: Set Keystore Password From GShell?

2008-11-17 Thread Jason Dillon
I'm not sure that this exists at them moment, but IMO it seems like a  
good idea to provide.  You may be able to enable the gshell-bsf plugin  
and with your favorite scripting language execute a script which would  
set the password... though you'd need to peep at the console code to  
see how that works to get it functional.


But on this topic, I think it would be very, very, very good (maybe  
add more verys) to have gshell equivilents to *ALL* web-console  
functions.


 * * *

Not everyone wants or needs a web console, and I could argue that more  
advanced admins required command-line accessible configuration so they  
can effectively automate *ALL* tasks.


--jason


On Nov 16, 2008, at 9:11 AM, Doug Reeder wrote:


http://cwiki.apache.org/GMOxDOC21/administering-certificates.html
explains how to configure an HTTPS listener to use SSL, including  
setting the keystore and keystore password.  However, this requires  
the console, which is not installed on my production server, to keep  
the memory footprint small.


I can set the keystore used by the HTTPS listener on my production  
server in var/config/config.xml, but not the password.  Is there a  
way to do this from GShell, or bash?






RE: JNDI Context Lookup Help

2008-11-17 Thread Mark Aufdencamp
Thanks David,  Worked like a charm!  Guess G got a little more precise
after 1.1.1:)  It's been wrong for the last year, G-1.1.1 must have been
more forgiving.  I bet my definition in geronimo-web.xml was wrong.

>  Original Message 
> Subject: Re: JNDI Context Lookup Help
> From: David Jencks <[EMAIL PROTECTED]>
> Date: Mon, November 17, 2008 3:05 pm
> To: user@geronimo.apache.org
> 
> 
> Shouldn't your name be java:comp/env/web/ContentLocation  (no slash  
> before the comp)?
> 
> thanks
> david jencks
> 
> On Nov 17, 2008, at 11:57 AM, Mark Aufdencamp wrote:
> 
> > Hi All,
> >
> > It's been a while since I had to ask for help from the list, but I  
> > hit a
> > snag migrating an application from G-1.1.1 to G-2.1.3.  Specifically,
> > I'm having a problem with a JNDI context lookup inside a
> > ServletContextListener.  I presume this is a problem with the move  
> > to a
> > global JNDI namespace in G-1.2 and forward.  I have had the same  
> > result
> > in 1.2-beta and 2.1.3.  The Documentation and Google have not helped  
> > me
> > here.
> >
> > I'm looking up an  defined in the web.xml:
> >
> > 
> >   web/ContentLocation
> >   java.lang.String
> >   /SomeDirectoryHeirarchyName/
> > 
> >
> >
> > Access code as follows:
> >
> > String contentLocation = null;
> > String contentLocationJNDIName = "java:/comp/env/web/ContentLocation";
> >
> > Context ctx = null;
> > boolean initialContextSuccess = false;
> > try {
> >  ctx = new InitialContext();
> >  initialContextSuccess = true;
> > } catch (NamingException namingException){
> >  namingException.printStackTrace();
> > }
> >
> > if(initialContextSuccess){
> >  try{
> >contentLocation = (String) ctx.lookup(contentLocationJNDIName);
> >  } catch(NamingException namingException){
> > namingException.printStackTrace();
> >  }
> > } else{
> > // Error Handling
> > }
> >
> >
> > The ctx.lookup() throws a javax.naming.NotContextException:
> > comp/env/web/ContentLocation.
> >
> > Do I need to define Properties for the InitialContext Factory, add
> > something to my geronimo-web.xml plan, or utilize a different JNDI  
> > name?
> >
> > Thanks for your help,
> >
> > Mark Aufdencamp
> > [EMAIL PROTECTED]
> >
> >
> >
> >
> >
> >
> >



Re: JNDI Context Lookup Help

2008-11-17 Thread David Jencks
Shouldn't your name be java:comp/env/web/ContentLocation  (no slash  
before the comp)?


thanks
david jencks

On Nov 17, 2008, at 11:57 AM, Mark Aufdencamp wrote:


Hi All,

It's been a while since I had to ask for help from the list, but I  
hit a

snag migrating an application from G-1.1.1 to G-2.1.3.  Specifically,
I'm having a problem with a JNDI context lookup inside a
ServletContextListener.  I presume this is a problem with the move  
to a
global JNDI namespace in G-1.2 and forward.  I have had the same  
result
in 1.2-beta and 2.1.3.  The Documentation and Google have not helped  
me

here.

I'm looking up an  defined in the web.xml:


  web/ContentLocation
  java.lang.String
  /SomeDirectoryHeirarchyName/



Access code as follows:

String contentLocation = null;
String contentLocationJNDIName = "java:/comp/env/web/ContentLocation";

Context ctx = null;
boolean initialContextSuccess = false;
try {
 ctx = new InitialContext();
 initialContextSuccess = true;
} catch (NamingException namingException){
 namingException.printStackTrace();
}

if(initialContextSuccess){
 try{
   contentLocation = (String) ctx.lookup(contentLocationJNDIName);
 } catch(NamingException namingException){
namingException.printStackTrace();
 }
} else{
// Error Handling
}


The ctx.lookup() throws a javax.naming.NotContextException:
comp/env/web/ContentLocation.

Do I need to define Properties for the InitialContext Factory, add
something to my geronimo-web.xml plan, or utilize a different JNDI  
name?


Thanks for your help,

Mark Aufdencamp
[EMAIL PROTECTED]











JNDI Context Lookup Help

2008-11-17 Thread Mark Aufdencamp
Hi All,

It's been a while since I had to ask for help from the list, but I hit a
snag migrating an application from G-1.1.1 to G-2.1.3.  Specifically,
I'm having a problem with a JNDI context lookup inside a
ServletContextListener.  I presume this is a problem with the move to a
global JNDI namespace in G-1.2 and forward.  I have had the same result
in 1.2-beta and 2.1.3.  The Documentation and Google have not helped me
here.

I'm looking up an  defined in the web.xml:


   web/ContentLocation
   java.lang.String
   /SomeDirectoryHeirarchyName/



Access code as follows:

String contentLocation = null;
String contentLocationJNDIName = "java:/comp/env/web/ContentLocation";

Context ctx = null;
boolean initialContextSuccess = false;
try {
  ctx = new InitialContext();
  initialContextSuccess = true;
} catch (NamingException namingException){
  namingException.printStackTrace();
}

if(initialContextSuccess){
  try{
contentLocation = (String) ctx.lookup(contentLocationJNDIName);
  } catch(NamingException namingException){
 namingException.printStackTrace();
  }
} else{
 // Error Handling
}


The ctx.lookup() throws a javax.naming.NotContextException:
comp/env/web/ContentLocation. 

Do I need to define Properties for the InitialContext Factory, add
something to my geronimo-web.xml plan, or utilize a different JNDI name?

Thanks for your help,

Mark Aufdencamp
[EMAIL PROTECTED]









Re: Missing resource injection in Tomcat/Axis vs Jetty/CXF

2008-11-17 Thread Jarek Gawor
Janko,

I was able to replicate the problem with Axis2. It is creating an
extra instance of the bean but that instance won't be used for
anything. The properly injected bean will be used for all the calls.

Can you open a bug with this issue?

Thanks,
Jarek

On Fri, Nov 14, 2008 at 2:13 AM, Janko Heilgeist
<[EMAIL PROTECTED]> wrote:
> Hi Jarek,
>
> your advice didn't work, unfortunately. The server logs still show the
> additional "DEFAULT"-bean. I've attached the files you requested plus my
> openejb-jar.xml just for completeness.
>
> Janko
>
> Jarek Gawor wrote:
>> I think you end up with deploying two ejbs because the name of bean
>> specified in the DD does not match the bean name of the annotated
>> class. And so, the container thinks you are deploying two separate
>> beans. To fix it, you could try adding "name=MyWebService" attribute
>> to the @Stateless annotation.
>>
>> If that still does not work right, send me your ejb-xml.jar file and
>> the bean class.
>>
>> Jarek
>>
>> On Thu, Nov 13, 2008 at 2:33 AM, Janko Heilgeist
>> <[EMAIL PROTECTED]> wrote:
>>> Hi,
>>>
>>> I've got a problem when deploying web services under Geronimo
>>> Tomcat/Axis. Not every instance of the stateless bean seems to receive
>>> the @Resource that I would like to have injected into the bean. I create
>>> a simple web service with an injected string that is accessed inside a
>>> @PostConstruct method and inside an exposed web method.
>>>
>>> // relevant excerpts 
>>> @Resource
>>> private String someString = "DEFAULT";
>>>
>>> @PostConstruct
>>> public void init() {
>>>logger.info(String.format("init: EJB = '%08x', someString = '%s'",
>>> hashCode(), this.someString));
>>> }
>>>
>>> public void doSomething(int counter) {
>>>logger.info(String.format("doSomething: EJB = '%08x', someString =
>>> '%s'", hashCode(), this.someString));
>>> }
>>>
>>> Excerpts from ejb-jar.xml:
>>>
>>> 
>>>MyWebService
>>>
>>>com.heilgeist.tests.tst_ws_with_resource.ws_ejb.MyServiceEJBImpl
>>>
>>>
>>>
>>>
>>> com.heilgeist.tests.tst_ws_with_resource.ws_ejb.MyServiceEJBImpl/someString
>>>
>>>java.lang.String
>>>Hello, world!
>>>
>>> 
>>>
>>> When I access this web service I get the following lines in the server log:
>>>
>>> 08:12:41,381 INFO  [MyServiceEJBImpl] init: EJB = '00b6d31c', someString
>>> = 'Hello, world!'
>>> 08:12:41,477 INFO  [MyServiceEJBImpl] init: EJB = '01c50523', someString
>>> = 'DEFAULT'
>>> 08:12:41,745 INFO  [MyServiceEJBImpl] doSomething: EJB = '00b6d31c',
>>> someString = 'Hello, world!'
>>>
>>> The second line indicates, that there is an additional instance of the
>>> stateless bean, that doesn't receive the injected string. It is only
>>> created once directly following the deployment of the web service. Even
>>> if further MYServiceEJBImpl instances are created later on to handle
>>> concurrent requests there is only a single instance of the bean with the
>>> default string. It's web service method is never called. Using the
>>> Jetty/CXF package this additional stateless bean is not created:
>>>
>>> 08:09:54,557 INFO  [MyServiceEJBImpl] init: EJB = '015db507', someString
>>> = 'Hello, world!'
>>> 08:09:54,558 INFO  [MyServiceEJBImpl] doSomething: EJB = '015db507',
>>> someString = 'Hello, world!'
>>>
>>> Can someone please shed some light on this funny behavior of Axis?
>>>
>>> Regards, Janko
>>>
>
>


EJB unit testing JPA projects

2008-11-17 Thread ericp56

Hi All,

OpenEJB unit testing works great.

However, I am now trying to unit test a JPA EJB and get the following error:

Apache OpenEJB 3.0build: 20080408-04:13
http://openejb.apache.org/
INFO - openejb.home = C:\eclipseRC3\workspace\ScrapEjb
INFO - openejb.base = C:\eclipseRC3\workspace\ScrapEjb
INFO - Configuring Service(id=Default Security Service,
type=SecurityService, provider-id=Default Security Service)
INFO - Configuring Service(id=Default Transaction Manager,
type=TransactionManager, provider-id=Default Transaction Manager)
INFO - Configuring Service(id=SchedulerDB2, type=Resource,
provider-id=Default JDBC Database)
INFO - Configuring Service(id=SchedulerDB, type=Resource,
provider-id=Default JDBC Database)
INFO - Configuring Service(id=Default JDK 1.3 ProxyFactory,
type=ProxyFactory, provider-id=Default JDK 1.3 ProxyFactory)
INFO - Found EjbModule in classpath:
C:\eclipseRC3\workspace\ScrapEjb\build\classes
INFO - Configuring app: C:\eclipseRC3\workspace\ScrapEjb\build\classes
INFO - Configuring Service(id=Default Stateless Container, type=Container,
provider-id=Default Stateless Container)
INFO - Auto-creating a container for bean ScrapClass:
Container(type=STATELESS, id=Default Stateless Container)
INFO - Auto-linking resource-ref 'SchedulerDB2' in bean ScrapClass to
Resource(id=SchedulerDB2)
INFO - Auto-linking resource-ref 'SchedulerDB' in bean ScrapClass to
Resource(id=SchedulerDB)
INFO - Configuring PersistenceUnit(name=ScrapEjb)
INFO - Loaded Module: C:\eclipseRC3\workspace\ScrapEjb\build\classes
ERROR - FATAL ERROR: Unknown error in Assembler.  Please send the following
stack trace and this message to [EMAIL PROTECTED] :
 org.apache.xbean.recipe.ConstructionException: Error invoking factory
method: public static javax.sql.DataSource
org.apache.openejb.resource.jdbc.DataSourceFactory.create(boolean,boolean)
...
Caused by: java.lang.NoClassDefFoundError:
org/apache/commons/dbcp/managed/BasicManagedDataSource
...

OpenEjb-core.3.0.jar is included in the classpath, so the
BasicManagedDataSource is available.

What's happening here?

Eric
-- 
View this message in context: 
http://www.nabble.com/EJB-unit-testing-JPA-projects-tp20541493s134p20541493.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.