CDI 2.0 (Weld): Can't inject non CDI component - dependency-injection

In a rest endpoint deployed on Wildfly 20, I need to inject an external non CDI instance of the javax.ws.rs.core.UriBuilder class. For example:
#Path("...")
public class MyResource
{
...
#Inject
private UriBuilder uriBuilder;
...
}
Here is the producer:
public class UriBuilderProducer
{
#Produces
public UriBuilder getUriBuilder()
{
return UriBuilder.fromResource(Customer.class);
}
}
The beans.xml file reads as follows:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_2_0.xsd"
version="2.0" bean-discovery-mode="all">
</beans>
However, the deployment fails raising the following exception:
15:03:24,837 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC000001: Failed to start service jboss.deployment.unit."myresource.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."myresource.war".WeldStartService: Failed to start service
at org.jboss.msc#1.4.11.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1731)
at org.jboss.msc#1.4.11.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads#2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type UriBuilder with qualifiers #Default
at injection point [UnbackedAnnotatedField] #Inject private ...MyResource.uriBuilder
at ...MyResource.uriBuilder(MyResource.java:0)
What did I miss here ?
Many thanks in advance for any help.
Kind regards,
Seymour

My bad, I've put the beans.xml in the wrong place. In order to land in the WEB-INF directory of the resulted WAR, one needs to put it in src/main/webapp/WEB-INF and not in src/main/resources/WEB-INF, as one would expect, based on maven COC (Convention Over Configuration) rules.
Having this file in the right place solves the issue, of course. Sorry for the inconvenience.
Kind regards,
Seymour

Related

Apache Sentry API for Policy Management

I am looking for way to define policy for Role pragmatically. Is there any API available for Sentry ? Either REST/JAVA ?
Any documentation or link will be great help?
Sentry exposes apache thrift client interface, here you can find thrift api definition sentry_policy_service.thrift. You can use it for client source code generating.
Additionally, Cloudera releases compiled client libraries compatible to Sentry Service, distributed as a part of CDH i.e.:
<dependency>
<groupId>org.apache.sentry</groupId>
<artifactId>sentry-provider-db</artifactId>
<version>1.5.1-cdh5.5.1</version>
</dependency>
available in Cloudera's maven repository:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<repositories>
<repository>
<id>cloudera</id>
<url>https://repository.cloudera.com/artifactory/cloudera-repos/</url>
</repository>
</repositories>
</project>
Here is a sample program using "sentry-provider-db" to get the permission details of a given hive database, (this program may not be defining policy for Role, but this program might give you an idea, to use other methods to achieve that)
public class ConnectSentry {
public static void main(String[] args) throws IOException, SentryUserException, LoginException {
String userName=args[0];
String databaseName=args[1];
Configuration conf = new Configuration();
conf.set(ClientConfig.SERVER_RPC_ADDRESS, "servernamexx.domain");
conf.set(ClientConfig.SERVER_RPC_PORT, "8038"); //default port is 8038, verify this setting in configuration of Sentry
System.setProperty("javax.security.auth.login.name", "userName");
System.setProperty("java.security.auth.login.config", "login.conf");
System.setProperty("java.security.krb5.conf", "krb5.conf");
System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
System.setProperty("sun.security.krb5.debug", "false");
conf.set(ServerConfig.PRINCIPAL, "sentry/<sentry-server-principal>");
SentryPolicyServiceClientDefaultImpl sentryPolicyServiceClientDefaultImpl = new SentryPolicyServiceClientDefaultImpl(
conf);
sentryPolicyServiceClientDefaultImpl.listUserRoles(userName).
forEach(rolesentry -> {//System.out.println(rolesentry.getRoleName());
try {
sentryPolicyServiceClientDefaultImpl.listAllPrivilegesByRoleName(userName, rolesentry.getRoleName()).forEach(
allpriv ->{
String db = allpriv.getDbName();
String permission=allpriv.getAction();
if (db.equals(args[1]))
{
System.out.println("found database and permission is "+permission);
}
}
);
} catch (SentryUserException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
});
}
}
Refer the below program to get idea about the available methods
https://github.com/apache/incubator-sentry/blob/master/sentry-provider/sentry-provider-db/src/main/java/org/apache/sentry/provider/db/service/thrift/SentryPolicyServiceClientDefaultImpl.java
Below methods and class might be useful for you:
public class SentryPolicyServiceClientDefaultImpl implements SentryPolicyServiceClient
public synchronized void importPolicy(Map>> policyFileMappingData,
String requestorUserName, boolean isOverwriteRole)
Post a comment, if you need sample krb5.conf, login.conf and pom.xml

CDI Injection in a Wildfly application

I've written an HttpServlet which gets deployed to a Wildfly container in a WAR file. The servlet looks like this:
public class MyCallback extends HttpServlet {
#Inject
#Any
private Event<MyEvent> event;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
String eventName = request.getParameter("EVENT_NAME");
MyEvent e = new MyEvent(eventName);
event.fire(e);
}
}
I also created a beans.xml file (as detailed here) and placed it in my WEB-INF directory. Unfortunately, I still get a NullPointerException when the code tries to execute the event.fire(e) line, which suggests to me the injection isn't working.
What am I doing wrong?
Try adding at least one CDI bean (it doesn't have to do anything), e.g.
#ApplicationScoped
public class JustABean { }
I had similar issue on Wildfly beta, it seems without a single "normal" bean CDI engine just wouldn't kick in.
Also Wildfly ships CDI 1.1 where beans.xml is optional.

Injecting Stateless Local EJB (3.1) into #WebComponent in WebLogic 12c not working

I have a Java EE 6 War project containing the following:
An EJB declared as so (it's also a JAX-RS Service):
#Path("/booksList")
#Produces("application/json")
#Stateless
#LocalBean
#Local(BooksListEJB.class)
public class BooksListEJBImpl implements BooksListEJB
A WebComponent declared as so:
#WebServlet(urlPatterns="/initDbData")
public class DataInitListener extends HttpServlet {
#EJB
private BooksListEJB booksListEJB;
An empty beans.xml file in the WEB-INF folder
When I deploy it in WebLogic 12c, I get the following error:
<Warning> <weblogic.jaxrs.onwls.deploy.ejb.provider.EJBComponentProviderFactory> <BEA-000000> <An instance of EJB class com.shivandragon.jee6TestService.ejb.impl.BooksListEJBImpl could not be looked up using simple form name. Attempting to look up using the fully-qualified form name.
javax.naming.NameNotFoundException: While trying to look up comp/env/BooksListEJBImpl in /app/webapp/jee6Test-service-0.1-SNAPSHOT.war/2039754748.; remaining na
me 'comp/env/BooksListEJBImpl'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1180)
at weblogic.jndi.internal.ApplicationNamingNode.lookup(ApplicationNamingNode.java:146)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:253)
at weblogic.jndi.internal.WLContextImpl.lookup(WLContextImpl.java:426)
at weblogic.jndi.factories.java.ReadOnlyContextWrapper.lookup(ReadOnlyContextWrapper.java:45)
Truncated. see log file for complete stacktrace
I've looked similar questions, and found the suggestion to add #ManagedBean to the servlet. Tried that but had the same error.
My question is:
Shouldn't this work, am I misusing some Java EE 6 directive/standard?
In EJB 3.1 have been added new Bean view - LocaBean. You can develop a bean without need implement any inerfaces. That beans view is "no-interface view", annotated with #LocalBean and injected by classname. There are beans that implemented some local interfaces and has "local view" and should be injected via local interface. In your code you mixed no-interface view bean and local view bean. You should delete the #LocalBean annotation as #Sam answered.
Updated
I test it on WebLogic Server 12.1.1.0.
Create a simple interface with one method:
package ejbrest;
public interface SessionEJBLocal {
public String hello();
}
Then create a EJB with the RESTful annotations:
package ejbrest;
// ... imports
#Path("/booksList")
#Produces("application/json")
#Stateless
#Local(SessionEJBLocal.class)
public class SessionEJBBean implements SessionEJBLocal {
public SessionEJBBean() {
}
#Override
#GET
public String hello() {
return "Hello, world";
}
}
The deployment descriptor, web.xml (you can see it does not have any servlet definitions):
<?xml version = '1.0' encoding = 'UTF-8'?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
</web-app>
You can create a servlet for the local bean injection demo:
package ejbrest;
// ... imports
#WebServlet(name = "DemoServlet", urlPatterns = { "/demoservlet" })
public class DemoServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
#EJB
private SessionEJBLocal ejb;
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException {
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<head><title>DemoServlet</title></head>");
out.println("<body>");
out.println("<p>The servlet has received a GET. This is the reply: " +
ejb.hello() + "</p>");
out.println("</body></html>");
out.close();
}
}
After deployment you can try call your RESTful service by url:
http://[host]:[port]/[appcontext]/resources/booksList
Response:
Hello, world
Also, your demo servlet will be accessable by url:
http://[host]:[port]/[appcontext]/demoservlet
Response:
The servlet has received a GET. This is the reply:Hello, world
By default Oracle WebLogic Server use resources as link on Jersey servlet. Please read the official documentation for informs about all supported deployments variants.

How to mock Grails Services in Camel Production Route unit tests

I need to write Unit tests for production routes in Grails which use Services referenced by Camel bean component. My requirement is neither to change nor to copy existing routes in test.
Problem is to somehow mock Service bean and add it to Camel registry.
I was able to do this using 'bind' method on 'context.registry.registry' object. Is there any functionality to do that in more safe way? Camel version is 2.10, Grails 2.1
Route is:
from('direct:validate').to('bean:camelService?method=echo')
CamelService is just simple class:
package com
class CamelService {
def echo(text) {
println "text=$text"
text
}
}
Test is following (route copied only to make question simpler):
package com
import grails.test.mixin.*
import org.apache.camel.builder.RouteBuilder
import org.apache.camel.test.junit4.CamelTestSupport
#TestFor(CamelService)
class RouteTests extends CamelTestSupport {
#Override
protected RouteBuilder createRouteBuilder() throws Exception {
return new RouteBuilder() {
#Override
public void configure() throws Exception {
from('direct:validate').to('bean:camelService?method=echo')
}
};
}
void testMockBean() throws Exception {
context.registry.registry.bind 'camelService', service
def result = template.requestBody('direct:validate', 'message')
assert result != null
assert result == 'message'
}
}
Camel allows you to plugin any custom registry you want, and out of the box it uses a Jndi based registry, which is why you can bind a service to it with the code example. An alternative is to use a SimpleRegistry which is just a Map, so you can put a service into the registry using the put method from the Map. You would then need to override createCamelContext method from the CamelTestSupport class and
pass in the SimpleRegistry to the constructor of DefaultCamelContext.
Anyway your code is safe as long you use the non-Spring CamelTestSupport class, as its using the JNDI based registrry out of the box. If you use CamelSpringTestSupport, then its a spring based registry, and you would need to use the spring app context to add your bean to it.
You can inject your components using CamelSpringtestSupport rather than CamelTestSupport as your base class.
Reading the documentation on Spring Test will help you for sure, and you might find interesting to use mock in your tests.
Anyway, you can build a custom context for your test, containing your bean's declaration and load it in the test.
public class RouteTests extends CamelSpringTestSupport {
#Override
protected AbstractApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("route-test-context.xml");
}
#Test
public void testMockBean(){
//...
}
}
route-test-context.xml
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<bean id="service" ref="com.CamelService"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<package>com</package>
</camelContext>
</beans>

WCF Session Service hosted in ASP.NET MVC 2.0 application

I have a must to host WCF Service using WCF Session mechanism.
I've read http://msdn.microsoft.com/en-us/library/ms733040.aspx but it is not enough...
My simple scenearion:
I have solution with 4 projects.
First - SessionWCF.Base, it is simple Class Library that contains base interface IServiceBase for my service.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace SessionWCF.Base
{
[ServiceContract(SessionMode = SessionMode.Required)]
public interface IServiceBase
{
[OperationContract(IsInitiating = true, IsTerminating = false)]
void BeginSession(string message);
[OperationContract(IsInitiating = false, IsTerminating = false)]
string GetMessage(int number);
[OperationContract(IsInitiating = false, IsTerminating = true)]
void EndSession();
}
}
Second - SessionWCF.Lib, it is WCF Class Library that contains service interface ISessionService and service class SessionService , it has project reference to SessionWCF.Base
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using SessionWCF.Base;
namespace SessionWCF.Lib
{
[ServiceContract(SessionMode = SessionMode.Required)]
public interface ISessionService : IServiceBase
{
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.Activation;
namespace SessionWCF.Lib
{
[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class SessionService : ISessionService
{
string message = "";
#region ISessionService Members
public void BeginSession(string message)
{
this.message = message;
}
public string GetMessage(int number)
{
return "message: " + message + " number: " + number;
}
public void EndSession()
{
message = "";
}
#endregion
}
}
Third - SessionWCF.Web it is ASP.NET MVC 2.0 application that has inside SessionService.svc file. I've deleted code behind and opened XML editor, this service is pointed to service from SessionWCF.Lib, and of course this project has reference to SessionWCF.Lib.
SessionService.svc:
<%# ServiceHost Language="C#" Debug="true" Service="SessionWCF.Lib.SessionService" CodeBehind="SessionWCF.Lib.SessionService.cs" %>
Web.config:
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
<service behaviorConfiguration="SessionServiceBehavior" name="SessionWCF.Web.SessionService">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="largeMessageHttpBinding" contract="SessionWCF.Lib.ISessionService">
<identity>
<dns value="**********"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
<host>
<baseAddresses>
<add baseAddress="http://**********/SessionWCF/SessionService.svc"/>
</baseAddresses>
</host>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="largeMessageHttpBinding" maxReceivedMessageSize="10485760">
<readerQuotas maxArrayLength="100000"/>
</binding>
</wsHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
<behavior name="SessionServiceBehavior">
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="True"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Fourth - SessionWCF.WPF it is standard WPF application that contanins SessionProxy class and in xaml form click event to call web service. This project has project reference to first one SessionWCF.Base.
SessionProxy class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SessionWCF.Base;
using System.ServiceModel;
namespace SessionWCF.WPF
{
public class SessionProxy
{
public IServiceBase Proxy { get; set; }
public SessionProxy(string url)
{
WSHttpBinding binding = new WSHttpBinding();
binding.ReceiveTimeout = new TimeSpan(0, 10, 0);
binding.OpenTimeout = new TimeSpan(0, 1, 0);
ChannelFactory<IServiceBase> factory = new ChannelFactory<IServiceBase>(binding,
new EndpointAddress(url));
Proxy = factory.CreateChannel();
}
}
}
Click event in xaml form:
private void Button_Click(object sender, RoutedEventArgs e)
{
string url = "http://**********/SessionWCF/SessionService.svc";
SessionProxy client = new SessionProxy(url);
client.Proxy.BeginSession("my message");
string msg = client.Proxy.GetMessage(666);
client.Proxy.EndSession();
txtMsg.Text = msg;
}
Now:
When I call web service in web browser I've get following error:
Error in '/SessionWCF' Application.
Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it.]
System.ServiceModel.Description.DispatcherBuilder.BuildChannelListener(StuffPerListenUriInfo stuff, ServiceHostBase serviceHost, Uri listenUri, ListenUriMode listenUriMode, Boolean supportContextSession, IChannelListener& result) +16376242
System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) +1940
System.ServiceModel.ServiceHostBase.InitializeRuntime() +82
System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +64
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +789
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +287
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1132
[ServiceActivationException: The service '/SessionWCF/SessionService.svc' cannot be activated due to an exception during compilation. The exception message is: Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it..]
System.Runtime.AsyncResult.End(IAsyncResult result) +890624
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +180062
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
When I call it in my xaml event I get ServiceActivationException:
The requested service, 'http://**********/SessionWCF/SessionService.svc' could not be activated. See the server's diagnostic trace logs for more information.
Is it wrong configuration in web.config?
Maybe I'm missing something in service attributes?
And the most important. Why it alerts me about BasicHttpBinding when I'm not using it ???
Any one could help me with this please? It is critical to my current project...
Regards,
Daniel Skowroński
UPDATE:
#marc_s
Firstly:
I think that server-side is wrong because when I simply paste url
'http://**********/SessionWCF/SessionService.svc' in any web browser I'll get error
"Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it. " instead metadata...
Secondly:
In my client WPF application I have always two options:
First - Create service reference and IDE will automatically generate proxy class and add all configuration to app.config.
Here I can't do that because I'm getting the same error as in web browser when I point to web service in Service Reference designer.
Second - Create poxy manually and app binding configuration from code, this gives me opportunity create proxy step by step, but it seems that ServiceActivationException it is the same problem "ACTIVATION", you can see in stack trace this lines:
[ServiceActivationException: The service '/SessionWCF/SessionService.svc' cannot be activated due to an exception during compilation. The exception message is: Contract requires Session, but Binding 'BasicHttpBinding' doesn't support it or isn't configured properly to support it..]
System.Runtime.AsyncResult.End(IAsyncResult result) +890624
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +180062
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136
Regards,
Daniel Skowroński
UPDATE:
#marc_s
I don't this it is the case because:
Firstly:
<services>
<service name="SessionWCF.Web.SessionService"
behaviorConfiguration="SessionServiceBehavior">
Service name it is a name of web service file inside asp.net application, so it points to SessionService.svc which belongs to SessionWCF.Web assembly (the same name as project).
Secondly:
<%# ServiceHost Language="C#" Debug="true"
Service="SessionWCF.Lib.SessionService"
CodeBehind="SessionWCF.Lib.SessionService.cs" %>
Service= is a factory method that gets "type" of the service to create, it also needs class description so CodeBehind= must be pointed to SessionService.cs file where factory method can find SessionService type inside SessionWCF.Lib assembly.
Mentioned two statements are not the issue because when NOT using State Service scenario this works like a charm...
I believe that for the State Service it must me configure something more in web.config are I'm missing something in interface/class description in WCF Class Library...
I'm still in critical situation...
Regards,
Daniel Skowroński
UPDATE
#marc_s you wrote
I think you're wrong here on the SVC
file - check out:
msdn.microsoft.com/en-us/library/aa751792.aspx
- the Service=".." attribute must be "The value of the Service attribute is
the common language runtime (CLR) type
name of the service implementation." -
you need to specify the .NET name of
the service implementation class here
! That's your
SessionWCF.Lib.SessionService class.
I agree with you becouse it is exacly what I've wrote :-)
You point this article: http://msdn.microsoft.com/en-us/library/aa751792.aspx
But a few lines below and you will see what it is under the hood:
new ServiceHost( typeof( MyNamespace.MyServiceImplementationTypeName) );
So when I typed:
<%# ServiceHost Language="C#" Debug="true"
Service="SessionWCF.Lib.SessionService"
CodeBehind="SessionWCF.Lib.SessionService.cs" %>
I pointed exacly: SessionWCF.Lib - namespace, SessionService - class where I have my service implemented.
I my example SessionWCF.Lib - it is both assembly name for .dll and namespace inside SessionWCF.Lib project what you can see at the top of this post when I describe second project in my solution, starting by "Second - SessionWCF.Lib, it is ..."
And again this solution WORKS perfectly without Session functionality of WCF, but it is NOT WORKING when I use WCF Session what I need...
Thanks for engagement but issue must be elsewhere...
UPDATE 2010-07-08
#marc_s was right about wrong configuration in web.config.
Proper configuration must have to be the same name as in Wcf Library:
<service behaviorConfiguration="SessionServiceBehavior" name="SessionWCF.Lib.SessionService">
Regards,
Daniel Skowroński
#marc_s was right about wrong configuration in web.config.
Proper configuration must have to be the same name as in Wcf Library:
<service behaviorConfiguration="SessionServiceBehavior" name="SessionWCF.Lib.SessionService">

Resources