I'm working on an old project in symfony 2.8, i can't upgrade to new versions right now.
Every time i clear the cache on the server i'm working on, I have this error :
FatalErrorException in classes.php line 6203:
Error: Cannot redeclare class Psr\Log\LoggerInterface
I see that LoggerInterface is declared twice in the class.php, that's the problem but i don't know why or where it is declared.
namespace Symfony\Component\HttpKernel\Log
{
use Psr\Log\LoggerInterface as PsrLogger;
interface LoggerInterface extends PsrLogger
{
...
}
and
namespace Psr\Log
{
interface LoggerInterface
{
...
}
I found a similar issue on github : Removing the file class.php from the cache folder
It works fine but it's annoying. I'd like really to fix it.
This problem doesn't happen on production server, only in local setup/other servers
Related
i'm having problems getting config values into my microprofile app. I have created a META-INF/microprofile-config.properties file like this:
configEntry=HelloWorld
I've got a simple test class like this:
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.context.Initialized;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.inject.ConfigProperty;
#ApplicationScoped
public class ConfigTest {
#Inject
#ConfigProperty(name = "configEntry", defaultValue = "missing")
private String configValue;
#Inject
Config conf;
public void init(#Observes #Initialized(ApplicationScoped.class) final Object init) {
System.out.println("configEntry = " + configValue);
}
}
I run this on TomEE MP 8.0.10 (downloaded standalone binaries). But whatever I do, configEntry is always 'missing' and when I debug-inspect the Config instance, I can see that there are 3 ConfigSources loaded (SystemPropertyConfigSource, SystemEnvConfigSource,TomEEConfigSource) but none is containing any entry for configValue.
I have also tried to create my own ConfigSource via META-INF/services/org.eclipse.microprofile.config.spi.ConfigSource. Same problem here: My test ConfigSource never gets included in the list of ConfigSoruces.
Is there any kind of secret (TomEE flag) to make this work? Did I miss something crucial, or is TomEE simply not supporting microprofile-config.properties (any longer)?
I found the problem:
This was due to an incompatible maven build configuration. All guides and tutorials I found usually specify the pre-build location of the file, not the location they must end up in the war file/dir. I did put them into the correct pre-build location, but maven placed them 'wron' (inside /META-INF/ not WEB-INF/classes/META-INF).
So, here for all with a similar confusion, after the build this is where the files must reside to be found:
microprofile-config.properties: /WEB-INF/classes/META-INF/
spi services directory: /WEB-INF/classes/META-INF/
spi custom ConfigSource text file: /WEB-INF/classes/META-INF/services/
`I'm new to gwtp and trying to learn it .I am trying to run a simple gwtp project on eclipse (Kepler) and my gwtp project contains a new presenter I have created under client package and i have only edited the UI.xml file just to check .But I dont seem to understand what the problem is ,as I'm trying to run the project in super dev mode Click here to see the console snap, i am getting this error :
Starting Jetty on port 8888
[WARN] FAILED guiceFilter: com.google.inject.ConfigurationException: Guice configuration errors:
1) No implementation for com.gwtplatform.dispatch.rpc.server.Dispatch was bound.
while locating com.gwtplatform.dispatch.rpc.server.Dispatch
for parameter 1 at com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl.(DispatchServiceImpl.java:54)
while locating com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl
2) No implementation for com.gwtplatform.dispatch.rpc.server.RequestProvider was bound.
while locating com.gwtplatform.dispatch.rpc.server.RequestProvider
for parameter 2 at com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl.(DispatchServiceImpl.java:54)
while locating com.gwtplatform.dispatch.rpc.server.guice.DispatchServiceImpl
You are most probably missing the installation of the GWTP needed modules.
Client Module file you need to install the GWTP modules (DefaultModule and RpcDispatchAsyncModule).
You should have something like:
public class ClientModule extends AbstractPresenterModule {
#Override
protected void configure() {
install(new DefaultModule());
install(new RpcDispatchAsyncModule()); // binds DispatchAsync to RpcDispatchAsync
install(new ApplicationModule()); //This is your main application module
// DefaultPlaceManager Places
bindConstant().annotatedWith(DefaultPlace.class).to(NameTokens.home);
bindConstant().annotatedWith(ErrorPlace.class).to(NameTokens.home);
bindConstant().annotatedWith(UnauthorizedPlace.class).to(NameTokens.home);
}
}
Hello i am trying to implement the Unity dependency pattern into my wcf project. I have installed the required packages and am trying to setup the registeredtypes into the container. I am strictly following the examples on the codeplex website but i keep getting "WcfServiceFactory does not implement inherited abstract member ConfigureContainer." Which is kinda strange since im overriding it in the servicefactory. I had a look in the example project but i cant seem to find what im doing wrong. Please help!
namespace WCFService
{
public class WcfServiceFactory : UnityServiceHostFactory
{
protected override void ConfigureContainer(IUnityContainer container)
{
// register all your components with the container here
container
.RegisterType<IPersonRepository, PersonRepository>();
}
}
}
Well in the end it seems it was an issue with the packages installed. After removing all packages and reinstalling them there was no longer an issue... :S
I created a simple entity and then used NetBeans "create rest services from entity" wizard to generate the rest resource. All good so far. It gives a #Path of the entity package to the resource as follows:
#Stateless
#Path("org.hellorest.entity.project")
public class ProjectFacadeREST extends AbstractFacade<Project> {
#PersistenceContext(unitName = "HelloRestPersistanceUnit")
private EntityManager em;
...
...
}
I am able to hit the end point at localhost:8081/HelloRest/resources/org.hellorest.entity.project/133
I changed the #Path to #Path("project"). I am not able to hit the end points at this path. The old longer path still works. What am I missing?
Looks like the old class is still loaded by the server.
If this happens you should Clean & Build your NetBeans project. This should undeploy the application. Run the project to redeploy the application.
If it still doesn't work a restart of the server before redeploying may help.
There is an option in the NetBeans project properties in the Run tab named Deploy on Save. If this is enabled (it is by default), changed classes should be recompiled and redeployed automatically, but sometimes this doesn't work because GlassFish hasn't properly unloaded the class.
See also:
Netbeans deploy on save: how is it supposed to work?
I'm using play application (using Play version 2.1.0) with RabbitMQ and do not have any view component.
So i would like to invoke this play application without hitting the execution URL (http://localhost:9000/<routing_info>) on server startup.
Would also like to know if there is any way in Play 2.1.0 version to run the application on server startup, i mean bootstrapping. Is this option available in play 2.1.0.
As i've read through the documentation its mentioned only for 1.2 version.
Please help!!
Play allows you to define a 'global' object which will be instantiated automatically by Play when the application starts.
In application.conf you should find the following:
# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
application.global=global.Global
On a new play application, this line is commented out. I've uncommented it and made it point to an object called Global in the global package. You can make it what ever you want.
Your global object should extend GlobalSettings.
In my applications, I use a static initialiser block to run code when that class is loaded:
public class Global extends GlobalSettings
{
static
{
...
}
}