getCallerPrincipal returns always "guest"

2008-08-05 Thread Sami Jaber
hello all,

I try to do something very simple, propagate the principal and credentials
contexts from the client to the server.
Here is my client code

p.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.LocalInitialContextFactory");
p.setProperty(Context.SECURITY_AUTHENTICATION, "simple");
p.setProperty(Context.SECURITY_PRINCIPAL, "Joe");
p.setProperty(Context.SECURITY_CREDENTIALS,"secret");
new InitialContext(p);

I don't necessary need JAAS with a loginModule because the client is
supposed to be already authenticated (thru his windows username).

When I call on the EJB Impl side anywhere :
 sessionContext.getCallerPrincipal().getName() ;

getName() returns always "guest" I have inserted "joe" and "secret" in
the default PropertiesLoginModule file.

Help appreciated ...

Sami


Re: WebServices too long result

2008-08-05 Thread hofmanndavid

Sorry I forgot to tell that the exception is indeed in the client, no the in
the server


hofmanndavid wrote:
> 
> I have a webservice exposed in a embedded openejb, from another computer I
> am calling that webservice
> 
> the scenario is this: 
> I am calling a method signature like this
> String myMethod(String arg)
> 
> if the answer of myMethod is too long it shows the next exception, if it
> is not too long, it just works, the exception does not come from the
> implementation of the method of the webservice, it raised in the cilent I
> think. 
> 
> I am not sure if I am doing something wrong, the code I use is based in
> the simple-webservice pattern, no new things where added
> 
> I will greatly appreciate an answer :)
> 
> 05/08/2008 04:53:28 PM
> org.apache.cxf.service.factory.ReflectionServiceFactoryBean
> buildServiceFromWSDL
> INFO: Creating Service {http://10.129.6.137/wsdl}GemConnectWSService from
> WSDL: http://10.129.6.137:4204/GemConnectWSImpl?wsdl
> 05/08/2008 04:53:29 PM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Could not create
> XMLStreamReader(encoding UTF-8).
>   at
> org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:67)
>   at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
>   at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:429)
>   at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1955)
>   at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1791)
>   at
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>   at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
>   at
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>   at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
>   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
>   at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
>   at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
>   at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
>   at $Proxy16.listAvailableServices(Unknown Source)
>   at
> py.com.personal.webvas.gcsmclient.ws.test.MainTest.main(MainTest.java:25)
> Caused by: com.ctc.wstx.exc.WstxIOException: Connection reset
>   at
> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:548)
>   at 
> com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:604)
>   at 
> com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:629)
>   at
> com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:324)
>   at
> org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:65)
>   ... 14 more
> Caused by: java.net.SocketException: Connection reset
>   at java.net.SocketInputStream.read(Unknown Source)
>   at java.io.BufferedInputStream.fill(Unknown Source)
>   at java.io.BufferedInputStream.read1(Unknown Source)
>   at java.io.BufferedInputStream.read(Unknown Source)
>   at sun.net.www.MeteredStream.read(Unknown Source)
>   at java.io.FilterInputStream.read(Unknown Source)
>   at
> sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown
> Source)
>   at
> sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown
> Source)
>   at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:362)
>   at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:110)
>   at
> com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:245)
>   at
> com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:132)
>   at
> com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:543)
>   ... 18 more
> Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not
> create XMLStreamReader(encoding UTF-8).
>   at
> org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:175)
>   at $Proxy16.listAvailableServices(Unknown Source)
>   at
> py.com.personal.webvas.gcsmclient.ws.test.MainTest.main(MainTest.java:25)
> Caused by: org.apache.cxf.interceptor.Fault: Could not create
> XMLStreamReader(encoding UTF-8).
>   at
> org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:67)
>   at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
>   at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:429)
>   at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1955)
>   at
> org.apache.cxf.transpor

WebServices too long result

2008-08-05 Thread hofmanndavid

I have a webservice exposed in a embedded openejb, from another computer I am
calling that webservice

the scenario is this: 
I am calling a method signature like this
String myMethod(String arg)

if the answer of myMethod is too long it shows the next exception, if it is
not too long, it just works, the exception does not come from the
implementation of the method of the webservice, it raised in the cilent I
think. 

I am not sure if I am doing something wrong, the code I use is based in the
simple-webservice pattern, no new things where added

I will greatly appreciate an answer :)

05/08/2008 04:53:28 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://10.129.6.137/wsdl}GemConnectWSService from
WSDL: http://10.129.6.137:4204/GemConnectWSImpl?wsdl
05/08/2008 04:53:29 PM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not create XMLStreamReader(encoding
UTF-8).
at
org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:429)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1955)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1791)
at 
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135)
at $Proxy16.listAvailableServices(Unknown Source)
at
py.com.personal.webvas.gcsmclient.ws.test.MainTest.main(MainTest.java:25)
Caused by: com.ctc.wstx.exc.WstxIOException: Connection reset
at 
com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:548)
at 
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:604)
at 
com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:629)
at
com.ctc.wstx.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:324)
at
org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:65)
... 14 more
Caused by: java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.io.BufferedInputStream.fill(Unknown Source)
at java.io.BufferedInputStream.read1(Unknown Source)
at java.io.BufferedInputStream.read(Unknown Source)
at sun.net.www.MeteredStream.read(Unknown Source)
at java.io.FilterInputStream.read(Unknown Source)
at 
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown
Source)
at 
sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(Unknown
Source)
at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:362)
at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:110)
at
com.ctc.wstx.io.ReaderBootstrapper.initialLoad(ReaderBootstrapper.java:245)
at
com.ctc.wstx.io.ReaderBootstrapper.bootstrapInput(ReaderBootstrapper.java:132)
at 
com.ctc.wstx.stax.WstxInputFactory.doCreateSR(WstxInputFactory.java:543)
... 18 more
Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Could not
create XMLStreamReader(encoding UTF-8).
at 
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:175)
at $Proxy16.listAvailableServices(Unknown Source)
at
py.com.personal.webvas.gcsmclient.ws.test.MainTest.main(MainTest.java:25)
Caused by: org.apache.cxf.interceptor.Fault: Could not create
XMLStreamReader(encoding UTF-8).
at
org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:67)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:208)
at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:429)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1955)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1791)
at 
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.jav

Re: Running the examples - newbie question

2008-08-05 Thread Karan Malhi
Hi KR,

These are some of the jars the example depends upon. If it does not find
those jars on your machine, then it downloads them for you. Some of the
examples on the website may not have shown the full log (the downloading
part).

If your example is running successfully then you do not need to worry about
these jars. If you have ran it once, and do not want to download them again,
you can use the -o switch of maven i.e. you can run

mvn -o clean install

That will run maven in offline mode.

On Tue, Aug 5, 2008 at 3:30 PM, rad muthu <[EMAIL PROTECTED]> wrote:

> I am trying to run the examples.
>
> When I run mvn clean install I see it is downloading some of the jar from
> online.
>
> [INFO] Using default encoding to copy filtered resources.
> Downloading:
> http://people.apache.org/repo/m2-snapshot-repository//com/sun/xml/b
> ind/jaxb-impl/2.0.5/jaxb-impl-2.0.5.pom
> Downloading:
> http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.0.5/jaxb
> -impl-2.0.5.pom
> Downloading:
> http://people.apache.org/repo/m2-snapshot-repository//org/apache/ac
> tivemq/activeio-core/3.0.0-incubator/activeio-core-3.0.0-incubator.pom
> Downloading:
> http://repo1.maven.org/maven2/org/apache/activemq/activeio-core/3.0
> .0-incubator/activeio-core-3.0.0-incubator.pom
> [INFO] [compiler:compile]
>
> But in the example output it is not shown. Is it needed?. How to avoid
> this?
>
> Thanks
> KR
>



-- 
Karan Singh Malhi


Re: WebServices exposed

2008-08-05 Thread hofmanndavid

Perfect !

Thank you very much David, that fix my problem



David Blevins wrote:
> 
> 
> On Aug 5, 2008, at 12:07 PM, hofmanndavid wrote:
> 
>>
>> I have a problem and have been looking around for some hours
>>
>> The example simple-webservice works perfectly but when I want to use  
>> that
>> webservice from another machine it just does not respond. It is like  
>> openejb
>> only answer requests from localhost.
>>
>> I need to have openejb in embedded mode into my application. I just  
>> need
>> openejb to expose one webservice. Is it possible ?
>>
>> I have not much experience with webservices, but if I could have  
>> this done
>> in this way it will save my life :)
>>
>> Please if you could give me any hint I will greatly appreciate that
> 
> Absolutely.   Try this adding these properties to the initial context:
> 
>  properties.setProperty("httpejbd.port", "4204");
>  properties.setProperty("httpejbd.bind", "0.0.0.0");
> 
> -David
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/WebServices-exposed-tp18837852p18839201.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: WebServices exposed

2008-08-05 Thread David Blevins


On Aug 5, 2008, at 12:07 PM, hofmanndavid wrote:



I have a problem and have been looking around for some hours

The example simple-webservice works perfectly but when I want to use  
that
webservice from another machine it just does not respond. It is like  
openejb

only answer requests from localhost.

I need to have openejb in embedded mode into my application. I just  
need

openejb to expose one webservice. Is it possible ?

I have not much experience with webservices, but if I could have  
this done

in this way it will save my life :)

Please if you could give me any hint I will greatly appreciate that


Absolutely.   Try this adding these properties to the initial context:

properties.setProperty("httpejbd.port", "4204");
properties.setProperty("httpejbd.bind", "0.0.0.0");

-David



Running the examples - newbie question

2008-08-05 Thread rad muthu
I am trying to run the examples.

When I run mvn clean install I see it is downloading some of the jar from
online.

[INFO] Using default encoding to copy filtered resources.
Downloading:
http://people.apache.org/repo/m2-snapshot-repository//com/sun/xml/b
ind/jaxb-impl/2.0.5/jaxb-impl-2.0.5.pom
Downloading:
http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.0.5/jaxb
-impl-2.0.5.pom
Downloading:
http://people.apache.org/repo/m2-snapshot-repository//org/apache/ac
tivemq/activeio-core/3.0.0-incubator/activeio-core-3.0.0-incubator.pom
Downloading:
http://repo1.maven.org/maven2/org/apache/activemq/activeio-core/3.0
.0-incubator/activeio-core-3.0.0-incubator.pom
[INFO] [compiler:compile]

But in the example output it is not shown. Is it needed?. How to avoid this?

Thanks
KR


WebServices exposed

2008-08-05 Thread hofmanndavid

I have a problem and have been looking around for some hours

The example simple-webservice works perfectly but when I want to use that
webservice from another machine it just does not respond. It is like openejb
only answer requests from localhost.

I need to have openejb in embedded mode into my application. I just need
openejb to expose one webservice. Is it possible ?

I have not much experience with webservices, but if I could have this done
in this way it will save my life :)

Please if you could give me any hint I will greatly appreciate that
-- 
View this message in context: 
http://www.nabble.com/WebServices-exposed-tp18837852p18837852.html
Sent from the OpenEJB User mailing list archive at Nabble.com.



Re: Shutdown an embedded instance of OpenEJB programatically

2008-08-05 Thread David Blevins


On Aug 5, 2008, at 12:36 AM, Martin Vysny wrote:


On Mon, 2008-08-04 at 15:44 -0700, David Blevins wrote:


Thanks, Martin!  I'll definitely get that issue cleaned up.



David, I must thank you, for your quick answers and solutions! It's
really a pleasure to work with OpenEJB being backed by such a good
"helpdesk" :-) Thank you!


It's users like you who make things better for everyone.  Each  
question and request helps pave the way for future users.


Case in point, I'm pretty sure you were the first person to ask about  
getting OpenEJB 3.0 beta 1 and Hibernate working together.  Every  
current and future OpenEJB/Hibernate user owes you thanks in one form  
or another.  No small contribution.



In fact, we are adding a close() method to the EJB 3.1 API version
(getting a good embeddable EJB container requirement into the EJB 3.1
spec is one of my top priorities), so this is good feedback.  You're
right on the bleeding edge! :)



This is most interesting! Do you mean that all heavyweight J2EE  
servers

(which are to be compliant to EJB 3.1) will be available as embeddable
containers as well?


Exactly.  Pretty amazing isn't it?  When we launched OpenEJB off as an  
embeddable EJB container years ago we never dreamed that it would  
cause this kind of a change.  We couldn't be more excited or more proud.




My thoughts for adding a close() method was basically for @Singleton
beans as the @PreDestroy method is only called when the container is
shutdown, but canceling timers is definitely another good reason.  If
you see it mentioned in the EJB 3.1 spec, you can know definitively
you're responsible :)


Wow, I might get my salary increased :-p


Let's hope so :)  Course I'll expect a beer in return.

-David



Re: Shutdown an embedded instance of OpenEJB programatically

2008-08-05 Thread Martin Vysny
On Mon, 2008-08-04 at 15:44 -0700, David Blevins wrote:
> On Aug 4, 2008, at 5:41 AM, Martin Vysny wrote:
> 
> > On Sat, 2008-08-02 at 15:23 -0700, David Blevins wrote:
> >> On Jul 30, 2008, at 12:34 AM, Martin Vysny wrote:
> >>
> >>> Hello,
> >>> currently we are starting OpenEJB as an embedded service (by
> >>> performing a lookup of
> >>> org.apache.openejb.client.LocalInitialContextFactory in JNDI
> >>> InitialContext). Is there a way to perform a clean shutdown of this
> >>> embedded instance? We are using OpenEJB in testing environment and I
> >>> need to shutdown OpenEJB cleanly, for example to stop uncanceled
> >>> timers.
> >>
> >> Hi Martin,
> >>
> >> If you don't mind being tied to some OpenEJB code you could try
> >> something like this:
> >>
> >> import org.apache.openejb.loader.SystemInstance;
> >> import org.apache.openejb.assembler.classic.Assembler;
> >> import org.apache.openejb.assembler.classic.AppInfo;
> >> import org.apache.openejb.OpenEJB;
> >>
> >> public class Shutdown {
> >> public static void shutdown() throws Exception {
> >> Assembler assembler =
> >> SystemInstance.get().getComponent(Assembler.class);
> >> for (AppInfo appInfo : assembler.getDeployedApplications()) {
> >> assembler.destroyApplication(appInfo.jarPath);
> >> }
> >> OpenEJB.destroy();
> >> }
> >> }
> >>
> >> We could probably wrap this up into a better package and allow it to
> >> be called from the initialContext.close() method so you don't have to
> >> have any OpenEJB code in your test case.
> >>
> >> Let me know if this does the trick for you and we'll get the cleaner
> >> version in.
> >>
> >> -David
> >>
> >
> > Hi David,
> >  thanks for the solution, it works for me! The timers are canceled
> > correctly in our project now. However the shutdown code is not perfect
> > yet. Out of curiosity I tried the following scenario: start OpenEJB,
> > stop it and start it again in the same VM. The following exception was
> > thrown:
> > [stacktrace attachment]
> >
> > This is probably just a corner case (I can't imagine why would anyone
> > need to start, stop and start the OpenEJB again in same VM :), it's  
> > just
> > for the sake of completeness.
> 
> Thanks, Martin!  I'll definitely get that issue cleaned up.
> 

David, I must thank you, for your quick answers and solutions! It's
really a pleasure to work with OpenEJB being backed by such a good
"helpdesk" :-) Thank you!

> In fact, we are adding a close() method to the EJB 3.1 API version  
> (getting a good embeddable EJB container requirement into the EJB 3.1  
> spec is one of my top priorities), so this is good feedback.  You're  
> right on the bleeding edge! :)
> 

This is most interesting! Do you mean that all heavyweight J2EE servers
(which are to be compliant to EJB 3.1) will be available as embeddable
containers as well? Or I misunderstood and the close() method will only
allow remote control of the container?

> My thoughts for adding a close() method was basically for @Singleton  
> beans as the @PreDestroy method is only called when the container is  
> shutdown, but canceling timers is definitely another good reason.  If  
> you see it mentioned in the EJB 3.1 spec, you can know definitively  
> you're responsible :)
> 
Wow, I might get my salary increased :-p
> 
> -David
> 
> 




signature.asc
Description: This is a digitally signed message part


RE: Propblem with OpenEJB + Toplink unit tests

2008-08-05 Thread Marcin Kwapisz
>  
> value="org.eclipse.persistence.platform.database.HSQLPlatform"/>
>
> value="database"/>
>  
[Marcin Kwapisz] 
Hi David,

Properties in main persistence.xml (for toplink) are almost the same. I have 
set generation.output-mode to both to verify ddl statements. Database platform 
is detected automatically (check the log) so you can skip that property.
The following properties are for toplink, openjpa and hibernate respectively. 
As you can see, Hibernate was the less demanding from "unexperienced" user like 
me.


  














Regards
-- 
Marcin Kwapisz
Division of Computer Networks
Technical Univeristy of Lodz, Poland